lkml.org 
[lkml]   [2018]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] scsi: xen-scsifront: add error handling for xenbus_printf
From
Date
On 06/14/2018 12:08 PM, Zhouyang Jia wrote:
> 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>
> ---
> v1->v2:
> - Fix dereferencing before checking
> ---
> drivers/scsi/xen-scsifront.c | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
> index 36f59a1..a7f6111 100644
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -654,10 +654,16 @@ static int scsifront_dev_reset_handler(struct scsi_cmnd *sc)
> static int scsifront_sdev_configure(struct scsi_device *sdev)
> {
> struct vscsifrnt_info *info = shost_priv(sdev->host);
> + int err;
>
> - if (info && current == info->curr)
> - xenbus_printf(XBT_NIL, info->dev->nodename,
> + if (info && current == info->curr) {
> + err = xenbus_printf(XBT_NIL, info->dev->nodename,
> info->dev_state_path, "%d", XenbusStateConnected);
> + if (err) {
> + dev_err(&info->dev->dev, "writing dev_state_path\n");

These errors should be reported using xenbus_dev_error().

And the second patch too.

-boris


\
 
 \ /
  Last update: 2018-06-14 23:58    [W:0.118 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site