[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1891546521.01644873481638.JavaMail.epsvc@epcpadp4>
Date: Mon, 14 Feb 2022 19:33:52 +0900
From: Jinyoung CHOI <j-young.choi@...sung.com>
To: ALIM AKHTAR <alim.akhtar@...sung.com>,
"avri.altman@....com" <avri.altman@....com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"bvanassche@....org" <bvanassche@....org>,
"beanhuo@...ron.com" <beanhuo@...ron.com>,
Daejun Park <daejun7.park@...sung.com>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"cang@...eaurora.org" <cang@...eaurora.org>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging
to "struct blk_mq_queue_map" must be a vaild value.
If nr_queues is set to 0, the system may encounter the "divide zero"
depending on the type of architecture.
blk_mq_map_queues() -> queue_index()
Signed-off-by: Jinyoung Choi <j-young.choi@...sung.com>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 41d85b69fa50..36c5ca62ae0c 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2674,21 +2674,21 @@ static int ufshcd_map_queues(struct Scsi_Host *shost)
for (i = 0; i < shost->nr_maps; i++) {
struct blk_mq_queue_map *map = &shost->tag_set.map[i];
switch (i) {
case HCTX_TYPE_DEFAULT:
case HCTX_TYPE_POLL:
map->nr_queues = 1;
break;
case HCTX_TYPE_READ:
map->nr_queues = 0;
- break;
+ continue;
default:
WARN_ON_ONCE(true);
}
map->queue_offset = 0;
ret = blk_mq_map_queues(map);
WARN_ON_ONCE(ret);
}
return 0;
}
--
2.25.1
Powered by blists - more mailing lists