提交 0d5e34c1 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

dm zoned: fix potential NULL dereference in dmz_do_reclaim()

[ Upstream commit e0702d90b79d430b0ccc276ead4f88440bb51352 ]

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: b234c6d7a703 ("dm zoned: improve error handling in reclaim")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NDmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 655bb2c4
...@@ -1579,7 +1579,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd) ...@@ -1579,7 +1579,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
struct dm_zone *zone; struct dm_zone *zone;
if (list_empty(&zmd->map_seq_list)) if (list_empty(&zmd->map_seq_list))
return NULL; return ERR_PTR(-EBUSY);
list_for_each_entry(zone, &zmd->map_seq_list, link) { list_for_each_entry(zone, &zmd->map_seq_list, link) {
if (!zone->bzone) if (!zone->bzone)
...@@ -1588,7 +1588,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd) ...@@ -1588,7 +1588,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)
return zone; return zone;
} }
return NULL; return ERR_PTR(-EBUSY);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册