Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Insu Yun and committed by
Dmitry Torokhov
ec7aa963 ba564e78

+8 -2
+8 -2
drivers/input/misc/xen-kbdfront.c
··· 129 129 130 130 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0) 131 131 abs = 0; 132 - if (abs) 133 - xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1"); 132 + if (abs) { 133 + ret = xenbus_printf(XBT_NIL, dev->nodename, 134 + "request-abs-pointer", "1"); 135 + if (ret) { 136 + pr_warning("xenkbd: can't request abs-pointer"); 137 + abs = 0; 138 + } 139 + } 134 140 135 141 /* keyboard */ 136 142 kbd = input_allocate_device();