diff options
author | Willy Tarreau <w@1wt.eu> | 2017-05-16 19:18:55 +0200 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-06-08 06:12:46 -0400 |
commit | d0e929a4e63f5b4a95a7daaf68d3738d1ec06d8c (patch) | |
tree | b9dc2628a22b3f108911fc1f937a6caada819ce2 /drivers/char | |
parent | da6d8dbb5da7cb0286d2ab11724c27f2023f4032 (diff) |
char: lp: fix possible integer overflow in lp_setup()
[ Upstream commit 3e21f4af170bebf47c187c1ff8bf155583c9f3b1 ]
The lp_setup() code doesn't apply any bounds checking when passing
"lp=none", and only in this case, resulting in an overflow of the
parport_nr[] array. All versions in Git history are affected.
Reported-By: Roee Hay <roee.hay@hcl.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/lp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index c4094c4e22c1..34ef474a3923 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -859,7 +859,11 @@ static int __init lp_setup (char *str) } else if (!strcmp(str, "auto")) { parport_nr[0] = LP_PARPORT_AUTO; } else if (!strcmp(str, "none")) { - parport_nr[parport_ptr++] = LP_PARPORT_NONE; + if (parport_ptr < LP_NO) + parport_nr[parport_ptr++] = LP_PARPORT_NONE; + else + printk(KERN_INFO "lp: too many ports, %s ignored.\n", + str); } else if (!strcmp(str, "reset")) { reset = 1; } |