Re: [PATCH] dm mpath: fix memory leak for attached_handler_name

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

 



On Sat, 2019-04-27 at 18:54 +0800, Yufen Yu wrote:
> If multipath does not set flag MPATHF_RETAIN_ATTACHED_HW_HANDLER,
> parse_path() would forget to free attached_handler_name when
> successfully exit, resulting in memory leak.

I believe this should rather be done in parse_path(), as
setup_scsi_dh() nullifies the pointer anyway when it "steals" it.
I'll send a patch shortly.

Thanks,
Martin





> 
> Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx>
> ---
>  drivers/md/dm-mpath.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index 00e738c1222f..850a7c637a88 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -841,6 +841,8 @@ static int setup_scsi_dh(struct block_device
> *bdev, struct multipath *m,
>  			m->hw_handler_name = *attached_handler_name;
>  			*attached_handler_name = NULL;
>  		}
> +	} else {
> +		kfree(*attached_handler_name);
>  	}
>  
>  	if (m->hw_handler_name) {


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux