tree: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git preview
head: d0687472d5b56e2018b833723082c2717e96c074
commit: a5d24e660f35f16cfe30031dcbd7356f7a002398 [30/54] cxl/core/port: Use dedicated lock for decoder target list
config: s390-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220125/[email protected]/config)
compiler: s390-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
smatch warnings:
drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.
vim +527 drivers/cxl/core/port.c
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 498 static int decoder_populate_targets(struct cxl_decoder *cxld,
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 499 struct cxl_port *port, int *target_map)
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 500 {
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 501 int rc = 0, i;
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 502
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 503 if (!target_map)
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 504 return 0;
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 505
42c377a63d21df drivers/cxl/core/port.c Dan Williams 2022-01-05 506 cxl_device_lock(&port->dev);
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 507 if (list_empty(&port->dports)) {
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 508 rc = -EINVAL;
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 509 goto out_unlock;
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 510 }
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 511
a5d24e660f35f1 drivers/cxl/core/port.c Dan Williams 2022-01-21 512 write_seqlock(&cxld->target_lock);
Lock
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 513 for (i = 0; i < cxld->nr_targets; i++) {
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 514 struct cxl_dport *dport = find_dport(port, target_map[i]);
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 515
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 516 if (!dport) {
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 517 rc = -ENXIO;
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 518 goto out_unlock;
Missing write_sequnlock() on this path
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 519 }
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 520 cxld->target[i] = dport;
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 521 }
a5d24e660f35f1 drivers/cxl/core/port.c Dan Williams 2022-01-21 522 write_sequnlock(&cxld->target_lock);
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 523
48667f676189ec drivers/cxl/core/bus.c Dan Williams 2021-09-21 524 out_unlock:
42c377a63d21df drivers/cxl/core/port.c Dan Williams 2022-01-05 525 cxl_device_unlock(&port->dev);
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 526
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 @527 return rc;
a5c25802168993 drivers/cxl/core/bus.c Dan Williams 2021-09-08 528 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On Wed, Jan 26, 2022 at 2:09 AM Dan Carpenter <[email protected]> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git preview
> head: d0687472d5b56e2018b833723082c2717e96c074
> commit: a5d24e660f35f16cfe30031dcbd7356f7a002398 [30/54] cxl/core/port: Use dedicated lock for decoder target list
> config: s390-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220125/[email protected]/config)
> compiler: s390-linux-gcc (GCC) 11.2.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
>
> smatch warnings:
> drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.
This report is too late. The branch was posted on the 22nd. The bug
was already found and fixed manually:
https://lore.kernel.org/r/164316562430.3437160.122223070771602475.stgit@dwillia2-desk3.amr.corp.intel.com