Skip to content

Commit

Permalink
dm mpath: fix check for null mpio in end_io fn
Browse files Browse the repository at this point in the history
The mpio dereference should be moved below the BUG_ON NULL test
in multipath_end_io().

spatch with a semantic match was used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Wei Yongjun authored and Alasdair G Kergon committed Oct 12, 2012
1 parent ce40be7 commit a71a261
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,13 +1309,14 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
{
struct multipath *m = ti->private;
struct dm_mpath_io *mpio = map_context->ptr;
struct pgpath *pgpath = mpio->pgpath;
struct pgpath *pgpath;
struct path_selector *ps;
int r;

BUG_ON(!mpio);

r = do_end_io(m, clone, error, mpio);
pgpath = mpio->pgpath;
if (pgpath) {
ps = &pgpath->pg->ps;
if (ps->type->end_io)
Expand Down

0 comments on commit a71a261

Please sign in to comment.