Re: [PATCH 1/9] vfio: Make vfio_(un)register_notifier accept a vfio_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 4/18/22 11:44 AM, Jason Gunthorpe wrote:
On Mon, Apr 18, 2022 at 11:28:30AM -0400, Tony Krowiak wrote:
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index a4555014bd1e72..8a5c46aa2bef61 100644
+++ b/drivers/vfio/vfio.c
@@ -2484,19 +2484,15 @@ static int vfio_unregister_group_notifier(struct vfio_group *group,
   	return ret;
   }
-int vfio_register_notifier(struct device *dev, enum vfio_notify_type type,
+int vfio_register_notifier(struct vfio_device *dev, enum vfio_notify_type type,
   			   unsigned long *events, struct notifier_block *nb)
   {
-	struct vfio_group *group;
+	struct vfio_group *group = dev->group;
Is there a guarantee that dev != NULL? The original code below checks
the value of dev, so why is that check eliminated here?
Yes, no kernel driver calls this with null dev. The original code
should have been a WARN_ON as it is just protecting against a buggy
driver. In this case if the driver is buggy we simply generate a
backtrace through a null deref panic.

Jason

Regarding the vfio_ap parts:
Reviewed-by: Tony Krowiak <akrowiak@xxxxxxxxxxxxx>





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux