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

Configure Feed

Select the types of activity you want to include in your feed.

xen: add error handling for xenbus_printf

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>

authored by

Zhouyang Jia and committed by
Juergen Gross
84c029a7 1fe83888

+15 -3
+15 -3
drivers/xen/manage.c
··· 289 289 return; 290 290 } 291 291 292 - if (sysrq_key != '\0') 293 - xenbus_printf(xbt, "control", "sysrq", "%c", '\0'); 292 + if (sysrq_key != '\0') { 293 + err = xenbus_printf(xbt, "control", "sysrq", "%c", '\0'); 294 + if (err) { 295 + pr_err("%s: Error %d writing sysrq in control/sysrq\n", 296 + __func__, err); 297 + xenbus_transaction_end(xbt, 1); 298 + return; 299 + } 300 + } 294 301 295 302 err = xenbus_transaction_end(xbt, 0); 296 303 if (err == -EAGAIN) ··· 349 342 continue; 350 343 snprintf(node, FEATURE_PATH_SIZE, "feature-%s", 351 344 shutdown_handlers[idx].command); 352 - xenbus_printf(XBT_NIL, "control", node, "%u", 1); 345 + err = xenbus_printf(XBT_NIL, "control", node, "%u", 1); 346 + if (err) { 347 + pr_err("%s: Error %d writing %s\n", __func__, 348 + err, node); 349 + return err; 350 + } 353 351 } 354 352 355 353 return 0;