瀏覽代碼

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 <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Dan Carpenter 9 年之前
父節點
當前提交
8dcb3c7628
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/input/touchscreen/egalax_ts_serial.c

+ 1 - 1
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;
 	}