RE: [PATCH 09/18] vfio/mdev: Add missing error handling to dev_set_name()

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

 



> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Wednesday, March 24, 2021 1:55 AM
> 
> This can fail, and seems to be a popular target for syzkaller error
> injection. Check the error return and unwind with put_device().
> 
> Fixes: 7b96953bc640 ("vfio: Mediated device Core driver")
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
>  drivers/vfio/mdev/mdev_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/mdev/mdev_core.c
> b/drivers/vfio/mdev/mdev_core.c
> index 517b6fd351b63a..4b5e372ed58f26 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -258,7 +258,9 @@ int mdev_device_create(struct mdev_type *type,
> const guid_t *uuid)
>  	list_add(&mdev->next, &mdev_list);
>  	mutex_unlock(&mdev_list_lock);
> 
> -	dev_set_name(&mdev->dev, "%pUl", uuid);
> +	ret = dev_set_name(&mdev->dev, "%pUl", uuid);
> +	if (ret)
> +		goto mdev_fail;
> 
>  	/* Check if parent unregistration has started */
>  	if (!down_read_trylock(&parent->unreg_sem)) {
> --
> 2.31.0





[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