From: Dan Carpenter Date: Sat, 19 Dec 2015 17:22:21 +0000 (-0800) Subject: Input: egalax_ts_serial - fix potential NULL dereference on error X-Git-Tag: v4.5-rc1~119^2^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8dcb3c7628f19192dd568fbee9094a2d4b14b6af;p=thirdparty%2Fkernel%2Flinux.git Input: egalax_ts_serial - fix potential NULL dereference on error We didn't check input_allocate_device() for failures so it could lead to a NULL deref. Fixes: 6b0f8f9c52ef ('Input: add eGalaxTouch serial touchscreen driver') Signed-off-by: Dan Carpenter Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/touchscreen/egalax_ts_serial.c b/drivers/input/touchscreen/egalax_ts_serial.c index a078c1c2c3f91..657bbae608c8d 100644 --- a/drivers/input/touchscreen/egalax_ts_serial.c +++ b/drivers/input/touchscreen/egalax_ts_serial.c @@ -105,7 +105,7 @@ static int egalax_connect(struct serio *serio, struct serio_driver *drv) egalax = kzalloc(sizeof(struct egalax), GFP_KERNEL); input_dev = input_allocate_device(); - if (!egalax) { + if (!egalax || !input_dev) { error = -ENOMEM; goto err_free_mem; }