[dm-devel] [PATCH 4/6] libmultipath: ignore multipaths sections without wwid option

Benjamin Marzinski bmarzins at redhat.com
Mon Jan 4 19:24:05 UTC 2021


On Fri, Dec 18, 2020 at 11:30:41PM +0000, Martin Wilck wrote:
> On Fri, 2020-12-18 at 17:06 -0600, Benjamin Marzinski wrote:
> > "multipathd show config local" was crashing in find_mp_by_wwid() if
> > the multipath configuration included a multipaths section that did
> > not set a wwid option. There is no reason to keep a mpentry that
> > didn't set its wwid. Remove it in merge_mptable().
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> > ---
> >  libmultipath/config.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/libmultipath/config.c b/libmultipath/config.c
> > index 9f3cb38d..a643703e 100644
> > --- a/libmultipath/config.c
> > +++ b/libmultipath/config.c
> > @@ -509,6 +509,13 @@ void merge_mptable(vector mptable)
> >  	int i, j;
> >  
> >  	vector_foreach_slot(mptable, mp1, i) {
> > +		/* drop invalid multipath configs */
> > +		if (!mp1->wwid) {
> > +			condlog(0, "multipaths config section missing
> > wwid");
> > +			vector_del_slot(mptable, i--);
> > +			free_mpe(mp1);
> > +			continue;
> > +		}
> >  		j = i + 1;
> >  		vector_foreach_slot_after(mptable, mp2, j) {
> >  			if (strcmp(mp1->wwid, mp2->wwid))
> 
> Wouldn't you need to check mp2->wwid, too?

Oops. Yeah, strcmp() is undefined with NULL, so that needs a check.
BTW, I noticed that added this one to you upstream-queue branch, even
though you didn't ack it, while not adding patch 5/6 (multipathd: Fix
multipathd stopping on shutdown), even though you did ack it. Was this
intentional?

At any rate, since this is already in upstream-queue, I'll just post a
follow-up that checks mp2->wwid, before calling strcmp()

-Ben
 
> Martin
> 
> -- 
> Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
> SUSE  Software Solutions Germany GmbH
> HRB 36809, AG Nürnberg GF: Felix
> Imendörffer
> 




More information about the dm-devel mailing list