kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] vfio/spapr: Postpone default window creation
@ 2017-01-17 13:55 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-01-17 13:55 UTC (permalink / raw)
  To: aik; +Cc: kvm

Hello Alexey Kardashevskiy,

The patch d9c728949ddc: "vfio/spapr: Postpone default window
creation" from Nov 30, 2016, leads to the following static checker
warning:

	drivers/vfio/vfio_iommu_spapr_tce.c:1180 tce_iommu_ioctl()
	warn: inconsistent returns 'mutex:&container->lock'.

drivers/vfio/vfio_iommu_spapr_tce.c
  1114                  if (copy_from_user(&create, (void __user *)arg, minsz))
  1115                          return -EFAULT;
  1116  
  1117                  if (create.argsz < minsz)
  1118                          return -EINVAL;
  1119  
  1120                  if (create.flags)
  1121                          return -EINVAL;
  1122  
  1123                  mutex_lock(&container->lock);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1124  
  1125                  ret = tce_iommu_create_default_window(container);
  1126                  if (ret)
  1127                          return ret;


We can't return directly while holding the lock.

  1128  
  1129                  ret = tce_iommu_create_window(container, create.page_shift,
  1130                                  create.window_size, create.levels,
  1131                                  &create.start_addr);
  1132  
  1133                  mutex_unlock(&container->lock);
  1134  
  1135                  if (!ret && copy_to_user((void __user *)arg, &create, minsz))
  1136                          ret = -EFAULT;
  1137  
  1138                  return ret;
  1139          }


regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-17 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 13:55 [bug report] vfio/spapr: Postpone default window creation Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).