浏览代码

Input: xen - check return value of xenbus_printf

Internally, xenbus_printf uses memory allocation, so it can fail under
memory pressure, leaving the input device configured as absolute with the
backend supplying relative coordinates.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Julien Grall <julien.grall@citrix.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Insu Yun 9 年之前
父节点
当前提交
ec7aa963bf
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      drivers/input/misc/xen-kbdfront.c

+ 8 - 2
drivers/input/misc/xen-kbdfront.c

@@ -129,8 +129,14 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename,
+				    "request-abs-pointer", "1");
+		if (ret) {
+			pr_warning("xenkbd: can't request abs-pointer");
+			abs = 0;
+		}
+	}
 
 
 	/* keyboard */
 	/* keyboard */
 	kbd = input_allocate_device();
 	kbd = input_allocate_device();