multipathd: fix mpp->hwe handling on path removal
PATCH 1/1 multipathd: fix mpp->hwe handling on path removal
In my previous patch f0462f0c8338, I overlooked that during path removal, the path that mpp->hwe references may be removed and and thus mpp->hwe may become stale. Fix it.
--- multipathd/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
multipathd/main.c +11 -0
@@ -1076,6 +1076,14 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) mpp->alias); goto fail; } + +/* +* Make sure mpp->hwe doesn't point to freed memory +* We call extract_hwe_from_path() below to restore mpp->hwe +*/ +if (mpp->hwe == pp->hwe) + mpp->hwe =NULL ; +if ((i =find_slot (mpp->paths, (void *)pp)) !=-1 )vector_del_slot (mpp->paths, i);
@@ -1109,6 +1117,9 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)*/ } +if (mpp->hwe ==NULL ) +extract_hwe_from_path (mpp); +if (setup_map (mpp, params,PARAMS_SIZE , vecs)) {condlog (0 ,"%s: failed to setup map for" " removal of path %s" , mpp->alias, pp->dev);
Signature · 1 line
2.17.1
Christophe,
without this patch, current upstream multipath _crashes_ on path removal. Please apply it. If reviewers disagree with this fix, I can post updates later.
Martin
Quoted 46 lines · Martin Wilck
In my previous patch
f0462f0c8338, I overlooked that during path removal,
the path thatmpp->hwereferences may be removed and and thus mpp-Quoted 1 line
hwe
may become stale. Fix it.
Fixes f0462f0c8338 "libmultipath: use vector for for pp->hwe and mp-Quoted 1 line
hwe"
Signed-off-by Martin Wilck <[email protected]>--- multipathd/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)multipathd/main.c +4
-0@@ -1076,6 +1076,14 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) mpp->alias); goto fail; } + +/* +* Make sure mpp->hwe doesn't point to freed memory +* We call extract_hwe_from_path() below to restore
mpp->hwemultipathd/main.c +7
-0+*/ +if (mpp->hwe == pp->hwe) + mpp->hwe =NULL ; +if ((i =find_slot (mpp->paths, (void *)pp)) !=-1 )vector_del_slot (mpp->paths, i);@@ -1109,6 +1117,9 @@ ev_remove_path (struct path *pp, struct vectors* vecs, int need_do_map) */ } +if (mpp->hwe ==NULL ) +extract_hwe_from_path (mpp); +if (setup_map (mpp, params,PARAMS_SIZE , vecs)) { condlog(0, "%s: failed to setup map for"" removal of path %s",
mpp->alias,pp->dev);
Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Right, done.
The leftover from your previous v3 patchset is merged too. Thanks,
Christophe.
Quoted 62 lines · Martin Wilck
Christophe,
without this patch, current upstream multipath _crashes_ on path removal. Please apply it. If reviewers disagree with this fix, I can post updates later.
Martin
Quoted 45 lines · Martin Wilck
In my previous patch
f0462f0c8338, I overlooked that during path removal,
the path thatmpp->hwereferences may be removed and and thus mpp-Quoted 1 line
hwe
may become stale. Fix it.
Fixes f0462f0c8338 "libmultipath: use vector for for pp->hwe and mp-Quoted 1 line
hwe"
Signed-off-by Martin Wilck <[email protected]>--- multipathd/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)multipathd/main.c +4
-0@@ -1076,6 +1076,14 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) mpp->alias); goto fail; } + +/* +* Make sure mpp->hwe doesn't point to freed memory +* We call extract_hwe_from_path() below to restore
mpp->hwemultipathd/main.c +7
-0+*/ +if (mpp->hwe == pp->hwe) + mpp->hwe =NULL ; +if ((i =find_slot (mpp->paths, (void *)pp)) !=-1 )vector_del_slot (mpp->paths, i);@@ -1109,6 +1117,9 @@ ev_remove_path (struct path *pp, struct vectors* vecs, int need_do_map) */ } +if (mpp->hwe ==NULL ) +extract_hwe_from_path (mpp); +if (setup_map (mpp, params,PARAMS_SIZE , vecs)) { condlog(0, "%s: failed to setup map for"" removal of path %s", mpp->alias,Quoted 1 line
pp->dev);--
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg)
Hello Christophe,
Quoted 4 lines · Christophe Varoqui
Right, done.
The leftover from your previous v3 patchset is merged too. Thanks,
Christophe.
I think in that mail from July 2nd, you referred to the following patch set which had been acked by Ben on June 25th
(https://www.redhat.com/archives/dm-devel/2018-June/msg00367.html):
* [PATCH v3 00/10] libmpathpersist fixes and some more
* [PATCH v3 01/10] libmpathpersist: remove duplicate test in
* [PATCH v3 02/10] libmpathpersist: fix typo in
* [PATCH v3 03/10] libmpathpersist: fix stack overflow in
* [PATCH v3 04/10] libmultipath: add (get|put)_unaligned_be64
* [PATCH v3 05/10] multipath-tools/tests: add tests for
* [PATCH v3 06/10] libmpathpersist: fix byte swapping for big endian
* [PATCH v3 07/10] (lib)mpathpersist: use O_RDONLY file descriptors
* [PATCH v3 08/10] libmultipath: fix gcc 8.1 "truncated output"
* [PATCH v3 09/10] multipathd: fix buffer size in cli_getprkey()
* [PATCH v3 10/10] libmultipath: avoid error messages from RDAC check
I just double-checked, and it seems that out of these, only patch 9 and 10 got applied to your tree. Did you have an issue with the others, or was it just an oversight?
Regards
Martin
PS: I'll send a review or Ben's late big series very soon.
Quoted 66 lines · Martin Wilck
Quoted 64 lines
Christophe,
without this patch, current upstream multipath _crashes_ on path removal. Please apply it. If reviewers disagree with this fix, I can
post updates later.Martin
Quoted 3 lines · Martin Wilck
In my previous patch
f0462f0c8338, I overlooked that during path removal,
the path thatmpp->hwereferences may be removed and and thusmpp-
Quoted 4 lines
Quoted 1 line
hwe
may become stale. Fix it.
Fixes f0462f0c8338 "libmultipath: use vector for for pp->hwe andmp-
multipathd/main.c ev_remove_path (struct path *pp, struct
Quoted 28 lines
Quoted 1 line
hwe"
Signed-off-by Martin Wilck <[email protected]>--- multipathd/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)multipathd/main.c +4
-0@@ -1076,6 +1076,14 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) mpp->alias); goto fail; } + +/* +* Make sure mpp->hwe doesn't point to freed memory +* We call extract_hwe_from_path() below to restore
mpp->hwemultipathd/main.c +4
-0+*/ +if (mpp->hwe == pp->hwe) + mpp->hwe =NULL ; +if ((i =find_slot (mpp->paths, (void *)pp)) !=-1 )vector_del_slot (mpp->paths, i);@@ -1109,6 +1117,9 @@ ev_remove_path (struct path *pp, structvectors
Quoted 11 lines
multipathd/main.c +3
-0* vecs, int need_do_map) */ } +if (mpp->hwe ==NULL ) +extract_hwe_from_path (mpp); +if (setup_map (mpp, params,PARAMS_SIZE , vecs)) { condlog(0, "%s: failed to setup map for"" removal of path %s", mpp->alias,
pp->dev);--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 9 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel