diff options
author | Willy Tarreau <w@1wt.eu> | 2017-05-16 19:18:55 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-07-18 18:38:45 +0100 |
commit | 550845d02afb926d50d1487f9e2b954270c83963 (patch) | |
tree | ee97b91c45f6c28e99bc33d7a47895b8774e22b3 | |
parent | cc21fe1ff77acfab555df5577ea46fc89932f3b2 (diff) |
char: lp: fix possible integer overflow in lp_setup()
commit 3e21f4af170bebf47c187c1ff8bf155583c9f3b1 upstream.
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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-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 97c3edb95ae7..bb8e370c9c48 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -858,7 +858,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; } |