All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197
Date: Wed, 6 Dec 2023 09:31:50 +0800	[thread overview]
Message-ID: <202312060947.C52WRrtX-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Nicolin Chen <nicolinc@nvidia.com>
CC: Jason Gunthorpe <jgg@ziepe.ca>
CC: Yi Liu <yi.l.liu@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: b5021cb264e67baf051569a41debe277c279952b iommufd: Share iommufd_hwpt_alloc with IOMMUFD_OBJ_HWPT_NESTED
date:   6 weeks ago
:::::: branch date: 28 hours ago
:::::: commit date: 6 weeks ago
config: x86_64-randconfig-103-20231202 (https://download.01.org/0day-ci/archive/20231206/202312060947.C52WRrtX-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20231206/202312060947.C52WRrtX-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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202312060947.C52WRrtX-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197

vim +226 drivers/iommu/iommufd/hw_pagetable.c

7074d7bd67d495 Jason Gunthorpe 2023-07-17  170  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  171  int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  172  {
7074d7bd67d495 Jason Gunthorpe 2023-07-17  173  	struct iommu_hwpt_alloc *cmd = ucmd->cmd;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  174  	struct iommufd_hw_pagetable *hwpt;
b5021cb264e67b Nicolin Chen    2023-10-25  175  	struct iommufd_ioas *ioas = NULL;
b5021cb264e67b Nicolin Chen    2023-10-25  176  	struct iommufd_object *pt_obj;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  177  	struct iommufd_device *idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  178  	int rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  179  
b5021cb264e67b Nicolin Chen    2023-10-25  180  	if (cmd->__reserved)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  181  		return -EOPNOTSUPP;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  182  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  183  	idev = iommufd_get_device(ucmd, cmd->dev_id);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  184  	if (IS_ERR(idev))
7074d7bd67d495 Jason Gunthorpe 2023-07-17  185  		return PTR_ERR(idev);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  186  
b5021cb264e67b Nicolin Chen    2023-10-25  187  	pt_obj = iommufd_get_object(ucmd->ictx, cmd->pt_id, IOMMUFD_OBJ_ANY);
b5021cb264e67b Nicolin Chen    2023-10-25  188  	if (IS_ERR(pt_obj)) {
b5021cb264e67b Nicolin Chen    2023-10-25  189  		rc = -EINVAL;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  190  		goto out_put_idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  191  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  192  
b5021cb264e67b Nicolin Chen    2023-10-25  193  	if (pt_obj->type == IOMMUFD_OBJ_IOAS) {
b5021cb264e67b Nicolin Chen    2023-10-25  194  		struct iommufd_hwpt_paging *hwpt_paging;
b5021cb264e67b Nicolin Chen    2023-10-25  195  
b5021cb264e67b Nicolin Chen    2023-10-25  196  		ioas = container_of(pt_obj, struct iommufd_ioas, obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @197  		mutex_lock(&ioas->mutex);
89db31635c87a7 Nicolin Chen    2023-10-25  198  		hwpt_paging = iommufd_hwpt_paging_alloc(ucmd->ictx, ioas, idev,
89db31635c87a7 Nicolin Chen    2023-10-25  199  							cmd->flags, false);
89db31635c87a7 Nicolin Chen    2023-10-25  200  		if (IS_ERR(hwpt_paging)) {
89db31635c87a7 Nicolin Chen    2023-10-25  201  			rc = PTR_ERR(hwpt_paging);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  202  			goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  203  		}
89db31635c87a7 Nicolin Chen    2023-10-25  204  		hwpt = &hwpt_paging->common;
b5021cb264e67b Nicolin Chen    2023-10-25  205  	} else {
b5021cb264e67b Nicolin Chen    2023-10-25  206  		rc = -EINVAL;
b5021cb264e67b Nicolin Chen    2023-10-25  207  		goto out_put_pt;
b5021cb264e67b Nicolin Chen    2023-10-25  208  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  209  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  210  	cmd->out_hwpt_id = hwpt->obj.id;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  211  	rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd));
7074d7bd67d495 Jason Gunthorpe 2023-07-17  212  	if (rc)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  213  		goto out_hwpt;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  214  	iommufd_object_finalize(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  215  	goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  216  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  217  out_hwpt:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  218  	iommufd_object_abort_and_destroy(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  219  out_unlock:
b5021cb264e67b Nicolin Chen    2023-10-25  220  	if (ioas)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  221  		mutex_unlock(&ioas->mutex);
b5021cb264e67b Nicolin Chen    2023-10-25  222  out_put_pt:
b5021cb264e67b Nicolin Chen    2023-10-25  223  	iommufd_put_object(pt_obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  224  out_put_idev:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  225  	iommufd_put_object(&idev->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @226  	return rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  227  }
e2a4b294784957 Joao Martins    2023-10-24  228  

:::::: The code at line 226 was first introduced by commit
:::::: 7074d7bd67d495cb3f6fe7c7c96b357a3b9d4ec2 iommufd: Add IOMMU_HWPT_ALLOC

:::::: TO: Jason Gunthorpe <jgg@nvidia.com>
:::::: CC: Jason Gunthorpe <jgg@nvidia.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2023-12-06  1:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  1:31 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-22  2:07 drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197 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=202312060947.C52WRrtX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@lists.linux.dev \
    /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.