aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2016-12-05 00:26:38 -0500
committerMike Snitzer <snitzer@redhat.com>2016-12-08 14:13:15 -0500
commitb446396b7482938c859bfaa42320026d158616ae (patch)
tree214d463d2ca567c8969a70b1255edc1c15b61947
parent0c79ce0b75304fbbe42282a7d40af4367e31efc6 (diff)
dm space map: always set ev if sm_ll_mutate() succeeds
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>
-rw-r--r--drivers/md/persistent-data/dm-space-map-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c
index 10978ba1d2c1..4c28608a0c94 100644
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -464,7 +464,8 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b,
464 ll->nr_allocated--; 464 ll->nr_allocated--;
465 le32_add_cpu(&ie_disk.nr_free, 1); 465 le32_add_cpu(&ie_disk.nr_free, 1);
466 ie_disk.none_free_before = cpu_to_le32(min(le32_to_cpu(ie_disk.none_free_before), bit)); 466 ie_disk.none_free_before = cpu_to_le32(min(le32_to_cpu(ie_disk.none_free_before), bit));
467 } 467 } else
468 *ev = SM_NONE;
468 469
469 return ll->save_ie(ll, index, &ie_disk); 470 return ll->save_ie(ll, index, &ie_disk);
470} 471}