Skip to content

Fix segfault on access to mpp->hwe

[email protected] dm-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4master - libmultipath: fix use after free when iscsi logs inlibmultipath/structs_vec.c+2 -00 replies
2/4libmultipath: warn if freeing path that holds mpp->hwelibmultipath/structs_vec.c+4 -10 replies
3/4libmultipath: warn about NULL value of mpp->hwelibmultipath/propsel.c+3 -10 replies
4/4libmultipath: fix mpp->hwe handling in sync_paths()libmultipath/structs_vec.c+4 -00 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBenjamin Marzinski
SeriesR-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] Fix segfault on access to mpp->hwe

From: Martin Wilck <[email protected]>

This is in response to Lixiaokeng's post
"master - libmultipath: fix use after free when iscsi logs in".

On top of Lixiaokeng's patch, I've added some log messages and a fix for mpp->hwe handling in sync_paths().

The question remains how we handle maps without paths. I believe we're good here, please review my assessment.

mpp->hwe is only accessed in propsel.c, via the mp_set_hwe() macro. Patch 3 of my series adds an error message if this happens while mpp->hwe is NULL. IMO it shouldn't happen because we don't check map properties for empty maps. Normally this is done when a map is created, and we don't create maps without paths.

The case where a map looses all paths during its normal lifetime and can't be removed (e.g. because it's busy) is already covered by the current code AFAICT. When a new path is re-added, we'll call adopt_paths and verify_paths(), which will make sure that mpp->hwe is set again to the pp->hwe member of the newly added path.

Reviews and comments welcome.

Regards
Martin

Martin Wilck (3):
libmultipath: warn if freeing path that holds mpp->hwe
libmultipath: warn about NULL value of mpp->hwe
libmultipath: fix mpp->hwe handling in sync_paths()

lixiaokeng (1):
master - libmultipath: fix use after free when iscsi logs in

 libmultipath/propsel.c     | 4 +++-
 libmultipath/structs_vec.c | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
2.26.2