Skip to content

Commit

Permalink
Input: xen - check return value of xenbus_printf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Insu Yun authored and Dmitry Torokhov committed Oct 23, 2015
1 parent ba564e7 commit ec7aa96
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/input/misc/xen-kbdfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ec7aa96

Please sign in to comment.