[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ed19f75-20d0-9870-1334-8d0eaabd0534@oracle.com>
Date: Thu, 14 Jun 2018 17:54:44 -0400
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Zhouyang Jia <jiazhouyang09@...il.com>
Cc: Juergen Gross <jgross@...e.com>,
"James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
xen-devel@...ts.xenproject.org, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] scsi: xen-scsifront: add error handling for
xenbus_printf
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@...il.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
Powered by blists - more mailing lists