[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210731075148.72494-1-islituo@gmail.com>
Date: Sat, 31 Jul 2021 00:51:48 -0700
From: Tuo Li <islituo@...il.com>
To: jejb@...ux.ibm.com, martin.petersen@...cle.com,
sumit.semwal@...aro.org, christian.koenig@....com,
colin.king@...onical.com, jiapeng.chong@...ux.alibaba.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org, baijiaju1990@...il.com,
Tuo Li <islituo@...il.com>, TOTE Robot <oslab@...nghua.edu.cn>
Subject: [PATCH] scsi: csiostor: fix possible null-pointer dereference in csio_eh_lun_reset_handler()
The variable rn is checked in:
if (!rn)
If rn is NULL, the program goes to the label fail:
fail:
CSIO_INC_STATS(rn, n_lun_rst_fail);
However, rn is dereferenced in this macro:
#define CSIO_INC_STATS(elem, val) ((elem)->stats.val++)
To fix this possible null-pointer dereference, the function returns
FAILED directly if rn is NULL.
Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
Signed-off-by: Tuo Li <islituo@...il.com>
---
drivers/scsi/csiostor/csio_scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 56b9ad0a1ca0..df0bf8348860 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2070,7 +2070,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
struct csio_scsi_level_data sld;
if (!rn)
- goto fail;
+ return FAILED;
csio_dbg(hw, "Request to reset LUN:%llu (ssni:0x%x tgtid:%d)\n",
cmnd->device->lun, rn->flowid, rn->scsi_id);
--
2.25.1
Powered by blists - more mailing lists