From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, SEO HOYOUNG <hy50.seo@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, beanhuo@micron.com,
bvanassche@acm.org, kwangwon.min@samsung.com,
kwmad.kim@samsung.com, sh425.lee@samsung.com, sc.suh@samsung.com,
quic_nguyenb@quicinc.com, cpgs@samsung.com,
grant.jung@samsung.com, junwoo80.lee@samsung.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
SEO HOYOUNG <hy50.seo@samsung.com>
Subject: Re: [PATCH v3] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
Date: Wed, 22 Nov 2023 04:23:11 -0500 [thread overview]
Message-ID: <5cd4171c-d992-4e3c-96c7-91bb0ae9feb6@suswa.mountain> (raw)
In-Reply-To: <20231121071128.7743-1-hy50.seo@samsung.com>
Hi SEO,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/SEO-HOYOUNG/scsi-ufs-core-fix-racing-issue-during-ufshcd_mcq_abort/20231121-151923
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/20231121071128.7743-1-hy50.seo%40samsung.com
patch subject: [PATCH v3] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
config: powerpc-randconfig-r071-20231122 (https://download.01.org/0day-ci/archive/20231122/202311220618.OnEhSic6-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231122/202311220618.OnEhSic6-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311220618.OnEhSic6-lkp@intel.com/
smatch warnings:
drivers/ufs/core/ufs-mcq.c:515 ufshcd_mcq_sq_cleanup() warn: variable dereferenced before check 'cmd' (see line 511)
vim +/cmd +515 drivers/ufs/core/ufs-mcq.c
8d7290348992f2 Bao D. Nguyen 2023-05-29 498 int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
8d7290348992f2 Bao D. Nguyen 2023-05-29 499 {
8d7290348992f2 Bao D. Nguyen 2023-05-29 500 struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
8d7290348992f2 Bao D. Nguyen 2023-05-29 501 struct scsi_cmnd *cmd = lrbp->cmd;
8d7290348992f2 Bao D. Nguyen 2023-05-29 502 struct ufs_hw_queue *hwq;
8d7290348992f2 Bao D. Nguyen 2023-05-29 503 void __iomem *reg, *opr_sqd_base;
8d7290348992f2 Bao D. Nguyen 2023-05-29 504 u32 nexus, id, val;
8d7290348992f2 Bao D. Nguyen 2023-05-29 505 int err;
8d7290348992f2 Bao D. Nguyen 2023-05-29 506
aa9d5d0015a8b7 Po-Wen Kao 2023-06-12 507 if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
aa9d5d0015a8b7 Po-Wen Kao 2023-06-12 508 return -ETIMEDOUT;
aa9d5d0015a8b7 Po-Wen Kao 2023-06-12 509
5363c9d813101c SEO HOYOUNG 2023-11-21 510 if (!ufshcd_cmd_inflight(cmd) ||
5363c9d813101c SEO HOYOUNG 2023-11-21 @511 test_bit(SCMD_STATE_COMPLETE, &cmd->state))
^^^^^^^^^^^
The patch adds a new unchecked dereference
5363c9d813101c SEO HOYOUNG 2023-11-21 512 return 0;
5363c9d813101c SEO HOYOUNG 2023-11-21 513
8d7290348992f2 Bao D. Nguyen 2023-05-29 514 if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) {
8d7290348992f2 Bao D. Nguyen 2023-05-29 @515 if (!cmd)
^^^
But the old code assumed "cmd" could be NULL
8d7290348992f2 Bao D. Nguyen 2023-05-29 516 return -EINVAL;
8d7290348992f2 Bao D. Nguyen 2023-05-29 517 hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
8d7290348992f2 Bao D. Nguyen 2023-05-29 518 } else {
8d7290348992f2 Bao D. Nguyen 2023-05-29 519 hwq = hba->dev_cmd_queue;
8d7290348992f2 Bao D. Nguyen 2023-05-29 520 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2023-11-22 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20231121070851epcas2p2ba11977edde23d3dcb87581e410806c8@epcas2p2.samsung.com>
2023-11-21 7:11 ` [PATCH v3] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort SEO HOYOUNG
2023-11-21 17:57 ` Bart Van Assche
2023-11-22 9:23 ` Dan Carpenter [this message]
2023-11-21 22:52 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5cd4171c-d992-4e3c-96c7-91bb0ae9feb6@suswa.mountain \
--to=dan.carpenter@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=cpgs@samsung.com \
--cc=grant.jung@samsung.com \
--cc=hy50.seo@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=junwoo80.lee@samsung.com \
--cc=kwangwon.min@samsung.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=martin.petersen@oracle.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=quic_nguyenb@quicinc.com \
--cc=sc.suh@samsung.com \
--cc=sh425.lee@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.