From: Sasha Levin Date: Mon, 26 Aug 2019 19:26:35 +0000 (-0400) Subject: fixes for 4.19 X-Git-Tag: v4.14.141~19^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0992ab3c53ca66d4140904549e427a31659a6ea1;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/dm-zoned-fix-potential-null-dereference-in-dmz_do_re.patch b/queue-4.19/dm-zoned-fix-potential-null-dereference-in-dmz_do_re.patch new file mode 100644 index 00000000000..5705cd830c5 --- /dev/null +++ b/queue-4.19/dm-zoned-fix-potential-null-dereference-in-dmz_do_re.patch @@ -0,0 +1,45 @@ +From 55db3f41dbb503481d78a11df445fb0790ffabb6 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 19 Aug 2019 12:58:14 +0300 +Subject: 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: Dan Carpenter +Reviewed-by: Dmitry Fomichev +Signed-off-by: Mike Snitzer +Signed-off-by: Sasha Levin +--- + drivers/md/dm-zoned-metadata.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c +index 00e7a343eacf1..7e8d7fc99410d 100644 +--- a/drivers/md/dm-zoned-metadata.c ++++ b/drivers/md/dm-zoned-metadata.c +@@ -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); + } + + /* +-- +2.20.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 69bb0ea98ec..b5844f9362e 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -92,3 +92,4 @@ xfs-add-helper-function-xfs_attr_try_sf_addname.patch xfs-add-attibute-set-and-helper-functions.patch xfs-add-attibute-remove-and-helper-functions.patch xfs-always-rejoin-held-resources-during-defer-roll.patch +dm-zoned-fix-potential-null-dereference-in-dmz_do_re.patch