Skip to content

Commit

Permalink
dm space map: always set ev if sm_ll_mutate() succeeds
Browse files Browse the repository at this point in the history
If no block was allocated or freed, sm_ll_mutate() wasn't setting
*ev, leaving the variable unitialized. sm_ll_insert(),
sm_disk_inc_block(), and sm_disk_new_block() all check ev to see
if there was an allocation event in sm_ll_mutate(), possibly
reading unitialized data.

If no allocation event occured, sm_ll_mutate() should set *ev
to SM_NONE.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Benjamin Marzinski authored and Mike Snitzer committed Dec 8, 2016
1 parent 0c79ce0 commit b446396
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/persistent-data/dm-space-map-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b,
ll->nr_allocated--;
le32_add_cpu(&ie_disk.nr_free, 1);
ie_disk.none_free_before = cpu_to_le32(min(le32_to_cpu(ie_disk.none_free_before), bit));
}
} else
*ev = SM_NONE;

return ll->save_ie(ll, index, &ie_disk);
}
Expand Down

0 comments on commit b446396

Please sign in to comment.