Input: xen - check return value of xenbus_printf
authorInsu Yun <wuninsu@gmail.com>
Mon, 19 Oct 2015 16:42:21 +0000 (09:42 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 23 Oct 2015 06:32:01 +0000 (23:32 -0700)
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>
drivers/input/misc/xen-kbdfront.c

index 23d0549539d43904299c51810730f5d34955d952..0a9ad2cfb55c7fb53e39ef84e366668f5c531094 100644 (file)
@@ -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)
                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 */
        kbd = input_allocate_device();