summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2017-05-16 19:18:55 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-16 23:05:20 +0200
commit3e21f4af170bebf47c187c1ff8bf155583c9f3b1 (patch)
tree276f65a380b1f288c65b17a7a11819fcd971e493 /drivers/char
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
char: lp: fix possible integer overflow in lp_setup()
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/lp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 565e4cf04a02..8249762192d5 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;
}