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/scsiback: 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: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

Zhouyang Jia and committed by
Juergen Gross
7c63ca24 93efbd39

+13 -3
+13 -3
drivers/xen/xen-scsiback.c
··· 1012 1012 { 1013 1013 struct v2p_entry *entry; 1014 1014 unsigned long flags; 1015 + int err; 1015 1016 1016 1017 if (try) { 1017 1018 spin_lock_irqsave(&info->v2p_lock, flags); ··· 1028 1027 scsiback_del_translation_entry(info, vir); 1029 1028 } 1030 1029 } else if (!try) { 1031 - xenbus_printf(XBT_NIL, info->dev->nodename, state, 1030 + err = xenbus_printf(XBT_NIL, info->dev->nodename, state, 1032 1031 "%d", XenbusStateClosed); 1032 + if (err) 1033 + xenbus_dev_error(info->dev, err, 1034 + "%s: writing %s", __func__, state); 1033 1035 } 1034 1036 } 1035 1037 ··· 1071 1067 snprintf(str, sizeof(str), "vscsi-devs/%s/p-dev", ent); 1072 1068 val = xenbus_read(XBT_NIL, dev->nodename, str, NULL); 1073 1069 if (IS_ERR(val)) { 1074 - xenbus_printf(XBT_NIL, dev->nodename, state, 1070 + err = xenbus_printf(XBT_NIL, dev->nodename, state, 1075 1071 "%d", XenbusStateClosed); 1072 + if (err) 1073 + xenbus_dev_error(info->dev, err, 1074 + "%s: writing %s", __func__, state); 1076 1075 return; 1077 1076 } 1078 1077 strlcpy(phy, val, VSCSI_NAMELEN); ··· 1086 1079 err = xenbus_scanf(XBT_NIL, dev->nodename, str, "%u:%u:%u:%u", 1087 1080 &vir.hst, &vir.chn, &vir.tgt, &vir.lun); 1088 1081 if (XENBUS_EXIST_ERR(err)) { 1089 - xenbus_printf(XBT_NIL, dev->nodename, state, 1082 + err = xenbus_printf(XBT_NIL, dev->nodename, state, 1090 1083 "%d", XenbusStateClosed); 1084 + if (err) 1085 + xenbus_dev_error(info->dev, err, 1086 + "%s: writing %s", __func__, state); 1091 1087 return; 1092 1088 } 1093 1089