]> git.itanic.dy.fi Git - linux-stable/commit
dm mpath: always free attached_handler_name in parse_path()
authorMartin Wilck <mwilck@suse.com>
Mon, 29 Apr 2019 09:48:15 +0000 (11:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2019 16:22:20 +0000 (18:22 +0200)
commit560c6fd312c9d8891f3282771178ba0b929356c8
treef1f4ead69f32b883f8c4d5730ab241a66e34d412
parent96ecf4c59f08b37f1e0f024d4976544525ce578c
dm mpath: always free attached_handler_name in parse_path()

commit 940bc471780b004a5277c1931f52af363c2fc9da upstream.

Commit b592211c33f7 ("dm mpath: fix attached_handler_name leak and
dangling hw_handler_name pointer") fixed a memory leak for the case
where setup_scsi_dh() returns failure. But setup_scsi_dh may return
success and not "use" attached_handler_name if the
retain_attached_hwhandler flag is not set on the map. As setup_scsi_sh
properly "steals" the pointer by nullifying it, freeing it
unconditionally in parse_path() is safe.

Fixes: b592211c33f7 ("dm mpath: fix attached_handler_name leak and dangling hw_handler_name pointer")
Cc: stable@vger.kernel.org
Reported-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-mpath.c