multipath: strdup multipath alias, so that it isn't deleted.
Benjamin Marzinski
maintainerPATCH 1/1 multipath: strdup multipath alias, so that it isn't deleted.
When a multipath device is added to multipathd with ev_add_map(), the alias is not duplicated, and is freed immediately after ev_add_map() returns, causing a memory error. This patch corrects that.
--- libmultipath/structs_vec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
libmultipath/structs_vec.c +1 -1
@@ -373,7 +373,7 @@ add_map_without_path (struct vectors * vecs, char * alias)if (!mpp || !alias)return NULL ; - mpp->alias = alias; + mpp->alias =STRDUP (alias);if (setup_multipath (vecs, mpp)) { mpp->alias =NULL ;
Signature · 1 line
1.7.4.4
Benjamin Marzinski
maintainerChristophe, would it be possible to get this merged?
Thanks,
-Ben
Quoted 29 lines · Benjamin Marzinski
When a multipath device is added to multipathd with
ev_add_map(), the alias is not duplicated, and is freed immediately afterev_add_map()returns, causing a memory error. This patch corrects that.Signed-off-by Benjamin Marzinski <[email protected]>--- libmultipath/structs_vec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)libmultipath/structs_vec.c +1
-1@@ -373,7 +373,7 @@ add_map_without_path (struct vectors * vecs, char * alias)if (!mpp || !alias)return NULL ; - mpp->alias = alias; + mpp->alias =STRDUP (alias);if (setup_multipath (vecs, mpp)) { mpp->alias =NULL ;Signature · 6 lines
1.7.4.4 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 5 lines · Benjamin Marzinski
When a multipath device is added to multipathd with
ev_add_map(),Quoted 1 line
the alias is not duplicated, and is freed immediately after
ev_add_map()Quoted 2 lines
returns, causing a memory error. This patch corrects that.
Merged.
Do you think the "mpp->alias = NULL" is still necessary in the following setup_multipath() error code path ? alias is set to NULL by free_multipath() these days ...
Quoted 2 lines
if (setup_multipath(vecs, mpp)) {
mpp->alias = NULL; <========Benjamin Marzinski
maintainerQuoted 12 lines · Christophe Varoqui
Quoted 5 lines · Benjamin Marzinski
When a multipath device is added to multipathd with
ev_add_map(),Quoted 1 line
the alias is not duplicated, and is freed immediately after
ev_add_map()Quoted 2 lines
returns, causing a memory error. This patch corrects that.
Merged.
Do you think the "
mpp->alias= NULL" is still necessary in the followingsetup_multipath()error code path ? alias is set to NULL byfree_multipath()these days ...
Yeah, that looks like it can safely go.
-Ben
Quoted 2 lines
Quoted 2 lines
if (setup_multipath(vecs, mpp)) { mpp->alias = NULL; <========