From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>,
Dmitry Fomichev <dmitry.fomichev@wdc.com>
Cc: dm-devel@redhat.com, kernel-janitors@vger.kernel.org,
Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH] dm zoned: Potential NULL dereference in dmz_do_reclaim()
Date: Mon, 19 Aug 2019 12:58:14 +0300 [thread overview]
Message-ID: <20190819095814.GA19905@mwanda> (raw)
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 <dan.carpenter@oracle.com>
---
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 2a5bc51fd6d5..595a73110e17 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -1588,7 +1588,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)
@@ -1597,7 +1597,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
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>,
Dmitry Fomichev <dmitry.fomichev@wdc.com>
Cc: dm-devel@redhat.com, kernel-janitors@vger.kernel.org,
Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH] dm zoned: Potential NULL dereference in dmz_do_reclaim()
Date: Mon, 19 Aug 2019 09:58:14 +0000 [thread overview]
Message-ID: <20190819095814.GA19905@mwanda> (raw)
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 <dan.carpenter@oracle.com>
---
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 2a5bc51fd6d5..595a73110e17 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -1588,7 +1588,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)
@@ -1597,7 +1597,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
next reply other threads:[~2019-08-19 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 9:58 Dan Carpenter [this message]
2019-08-19 9:58 ` [PATCH] dm zoned: Potential NULL dereference in dmz_do_reclaim() Dan Carpenter
2019-08-19 16:11 ` Dmitry Fomichev
2019-08-19 16:11 ` Dmitry Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190819095814.GA19905@mwanda \
--to=dan.carpenter@oracle.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=dmitry.fomichev@wdc.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.