Message ID | 20230420101116.173-1-avri.altman@wdc.com |
---|---|
State | New |
Headers | show |
Series | [v3] scsi: ufs: mcq: Limit the amount of inflight requests | expand |
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 03c47f9a2750..9cebec6be35c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8468,6 +8468,12 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba) if (ret) goto err; + if (hba->nutrs * hba->nr_hw_queues > SZ_64K - 1) { + dev_info(hba->dev, "there can be at most 64K inflight requests\n"); + ret = -EINVAL; + goto err; + } + /* * Previously allocated memory for nutrs may not be enough in MCQ mode. * Number of supported tags in MCQ mode may be larger than SDB mode.