[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MW2PR07MB4042EC187A6945E4F39D97FAE37F0@MW2PR07MB4042.namprd07.prod.outlook.com>
Date: Tue, 12 Jun 2018 07:52:26 +0000
From: "Rangankar, Manish" <Manish.Rangankar@...ium.com>
To: Zhouyang Jia <jiazhouyang09@...il.com>
CC: Dept-Eng QLogic Storage Upstream
<QLogic-Storage-Upstream@...ium.com>,
"James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] scsi: qla4xxx: add error handling for try_module_get
> -----Original Message-----
> From: Zhouyang Jia <jiazhouyang09@...il.com>
> Sent: Tuesday, June 12, 2018 10:18 AM
> Cc: Zhouyang Jia <jiazhouyang09@...il.com>; Dept-Eng QLogic Storage
> Upstream <QLogic-Storage-Upstream@...ium.com>; James E.J. Bottomley
> <jejb@...ux.vnet.ibm.com>; Martin K. Petersen <martin.petersen@...cle.com>;
> linux-scsi@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH] scsi: qla4xxx: add error handling for try_module_get
>
> When try_module_get fails, the lack of error-handling code may cause
> unexpected results.
>
> This patch adds error-handling code after calling try_module_get.
>
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
> drivers/scsi/qla4xxx/ql4_os.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index
> 0e13349..6b677ab 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -7687,7 +7687,10 @@ static int qla4xxx_sysfs_ddb_logout_sid(struct
> iscsi_cls_session *cls_sess)
> * to be seamless without actually destroying the
> * session
> **/
> - try_module_get(qla4xxx_iscsi_transport.owner);
> + if (!try_module_get(qla4xxx_iscsi_transport.owner))
> + ql4_printk(KERN_WARNING, ha,
> + "%s: cannot get module.\n", __func__);
> +
> iscsi_destroy_endpoint(ddb_entry->conn->ep);
>
> spin_lock_irqsave(&ha->hardware_lock, flags); @@ -8970,7 +8973,9
> @@ static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha)
> * to be seamless without actually destroying the
> * session
> **/
> - try_module_get(qla4xxx_iscsi_transport.owner);
> + if (!try_module_get(qla4xxx_iscsi_transport.owner))
> + ql4_printk(KERN_WARNING, ha,
> + "%s: cannot get module.\n",
> __func__);
> iscsi_destroy_endpoint(ddb_entry->conn->ep);
> qla4xxx_free_ddb(ha, ddb_entry);
> iscsi_session_teardown(ddb_entry->sess);
> --
> 2.7.4
Thanks,
Acked-by: Manish Rangankar <Manish.Rangankar@...ium.com>
Powered by blists - more mailing lists