Skip to content

Commit e0702d9

Browse files
Dan Carpentersnitm
authored andcommitted
dm zoned: fix potential NULL dereference in dmz_do_reclaim()
This function is supposed to return error pointers so it matches the dmz_get_rnd_zone_for_reclaim() function. The current code could lead to a NULL dereference in dmz_do_reclaim() Fixes: b234c6d ("dm zoned: improve error handling in reclaim") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Dmitry Fomichev <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 08c04c8 commit e0702d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/dm-zoned-metadata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
15881588
struct dm_zone *zone;
15891589

15901590
if (list_empty(&zmd->map_seq_list))
1591-
return NULL;
1591+
return ERR_PTR(-EBUSY);
15921592

15931593
list_for_each_entry(zone, &zmd->map_seq_list, link) {
15941594
if (!zone->bzone)
@@ -1597,7 +1597,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
15971597
return zone;
15981598
}
15991599

1600-
return NULL;
1600+
return ERR_PTR(-EBUSY);
16011601
}
16021602

16031603
/*

0 commit comments

Comments
 (0)