diff options
author | Zhouyang Jia <jiazhouyang09@gmail.com> | 2018-06-15 07:34:52 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-24 13:09:01 +0200 |
commit | 395c67c1c02d6282a61224139560050c9d238479 (patch) | |
tree | 695de717c8ed28a7365c8f3b9936a035eb525c47 /drivers | |
parent | 72bc7a2f77ba0993815947735d234b6e5c63eb6c (diff) | |
download | linux-stable-395c67c1c02d6282a61224139560050c9d238479.tar.gz linux-stable-395c67c1c02d6282a61224139560050c9d238479.tar.bz2 linux-stable-395c67c1c02d6282a61224139560050c9d238479.zip |
xen: add error handling for xenbus_printf
[ Upstream commit 84c029a73327cef571eaa61c7d6e67e8031b52ec ]
When xenbus_printf fails, the lack of error-handling code may
cause unexpected results.
This patch adds error-handling code after calling xenbus_printf.
Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/manage.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index c425d03d37d2..587d12829925 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -292,8 +292,15 @@ static void sysrq_handler(struct xenbus_watch *watch, const char *path, return; } - if (sysrq_key != '\0') - xenbus_printf(xbt, "control", "sysrq", "%c", '\0'); + if (sysrq_key != '\0') { + err = xenbus_printf(xbt, "control", "sysrq", "%c", '\0'); + if (err) { + pr_err("%s: Error %d writing sysrq in control/sysrq\n", + __func__, err); + xenbus_transaction_end(xbt, 1); + return; + } + } err = xenbus_transaction_end(xbt, 0); if (err == -EAGAIN) @@ -345,7 +352,12 @@ static int setup_shutdown_watcher(void) continue; snprintf(node, FEATURE_PATH_SIZE, "feature-%s", shutdown_handlers[idx].command); - xenbus_printf(XBT_NIL, "control", node, "%u", 1); + err = xenbus_printf(XBT_NIL, "control", node, "%u", 1); + if (err) { + pr_err("%s: Error %d writing %s\n", __func__, + err, node); + return err; + } } return 0; |