Re: [PATCH] vdpa_sim_blk: Fix the potential leak of mgmt_dev

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

 



On Mon, Aug 21, 2023 at 10:18 AM Shawn.Shao <shawn.shao@xxxxxxxxxxxxxxx> wrote:
>
> If the shared_buffer allocation fails, need to unregister mgmt_dev first.
>

Please add a Fixes tag.

Other than this

Acked-by: Jason Wang <jasowang@xxxxxxxxxx>

Thanks

> Signed-off-by: Shawn.Shao <shawn.shao@xxxxxxxxxxxxxxx>
> ---
>  drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> index 00d7d72713be..b3a3cb165795 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> @@ -499,12 +499,13 @@ static int __init vdpasim_blk_init(void)
>                                          GFP_KERNEL);
>                 if (!shared_buffer) {
>                         ret = -ENOMEM;
> -                       goto parent_err;
> +                       goto mgmt_dev_err;
>                 }
>         }
>
>         return 0;
> -
> +mgmt_dev_err:
> +       vdpa_mgmtdev_unregister(&mgmt_dev);
>  parent_err:
>         device_unregister(&vdpasim_blk_mgmtdev);
>         return ret;
> --
> 2.34.1
>

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux