[dm-devel] [PATCH v4 3/6] multipathd: fix ev_remove_path return code handling

Benjamin Marzinski bmarzins at redhat.com
Tue May 18 22:38:26 UTC 2021


On Mon, May 17, 2021 at 07:33:34PM +0000, Martin Wilck wrote:
> On Mon, 2021-05-17 at 20:51 +0200, Martin Wilck wrote:
> > On Mon, 2021-05-17 at 11:29 -0500, Benjamin Marzinski wrote:
> > > When ev_remove_path() returned success, callers assumed that the
> > > path
> > > (and possibly the map) had been removed.  When ev_remove_path()
> > > returned
> > > failure, callers assumed that the path had not been removed.
> > > However,
> > > the path could be removed on both success or failure. This could
> > > cause
> > > callers to dereference the path after it was removed.
> > > 
> > > To deal with this, make ev_remove_path() return a different
> > > symbolic
> > > value for each outcome, and make the callers react appropriately
> > > for
> > > the different values. Found by coverity.
> > > 
> > > Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>+
> > 
> > Reviewed-by: Martin Wilck <mwilck at suse.com>
> > 
> 
> It just occured to me that we should probably not have set changed the
> return code of cli_del_path() because of a strdup() failure for the
> reply string. (It was my suggestion, I know).

If we're at a point where we get an error on that strdup(), things are
probably going badly in general. But yeah, I agree that success makes
more sense than failure here.

-Ben
 
> Anyway, I've pushed this to "queue" already.
> We can change this in a follow-up patch.
> 
> Regards
> Martin




More information about the dm-devel mailing list