mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 10:12:16 +09:00
dm zoned: fix potential NULL dereference in dmz_do_reclaim()
[ Upstream commite0702d90b7] 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:b234c6d7a7("dm zoned: improve error handling in reclaim") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
044d098441
commit
3d15608759
@@ -1579,7 +1579,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
|
||||
struct dm_zone *zone;
|
||||
|
||||
if (list_empty(&zmd->map_seq_list))
|
||||
return NULL;
|
||||
return ERR_PTR(-EBUSY);
|
||||
|
||||
list_for_each_entry(zone, &zmd->map_seq_list, link) {
|
||||
if (!zone->bzone)
|
||||
@@ -1588,7 +1588,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
|
||||
return zone;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return ERR_PTR(-EBUSY);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user