From: Talker Alex <alextalker@yandex.ru>
To: linux-nvme <linux-nvme@lists.infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] nvmet: fix null-pointer when removing a referral
Date: Thu, 12 Dec 2019 13:36:28 +0300 [thread overview]
Message-ID: <3861821576146988@sas8-ed615920eca2.qloud-c.yandex.net> (raw)
In-Reply-To: <20191212093341.GA20683@infradead.org>
nvmet_referral_release() was called when item->ci_parent
or item->ci_group were already set to NULL by configfs internals.
Signed-off-by: Aleksandr Diadiushkin <alextalker@ya.ru>
---
drivers/nvme/target/configfs.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 98613a45bd3b..20e4a660684f 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -970,23 +970,21 @@ static struct configfs_attribute *nvmet_referral_attrs[] = {
NULL,
};
-static void nvmet_referral_release(struct config_item *item)
+static void nvmet_referral_release(struct config_group *group,
+ struct config_item *item)
{
- struct nvmet_port *parent = to_nvmet_port(item->ci_parent->ci_parent);
+ struct nvmet_port *parent = to_nvmet_port(group->cg_item.ci_parent);
struct nvmet_port *port = to_nvmet_port(item);
nvmet_referral_disable(parent, port);
kfree(port);
-}
-static struct configfs_item_operations nvmet_referral_item_ops = {
- .release = nvmet_referral_release,
-};
+ config_item_put(item);
+}
static const struct config_item_type nvmet_referral_type = {
.ct_owner = THIS_MODULE,
.ct_attrs = nvmet_referral_attrs,
- .ct_item_ops = &nvmet_referral_item_ops,
};
static struct config_group *nvmet_referral_make(
@@ -1006,6 +1004,7 @@ static struct config_group *nvmet_referral_make(
static struct configfs_group_operations nvmet_referral_group_ops = {
.make_group = nvmet_referral_make,
+ .drop_item = nvmet_referral_release,
};
static const struct config_item_type nvmet_referrals_type = {
--
2.17.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-12-12 10:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 20:39 [PATCH] nvmet: fix null-pointer when removing a referral Talker Alex
2019-12-06 22:31 ` Sagi Grimberg
2019-12-07 10:21 ` Talker Alex
2019-12-12 9:33 ` Christoph Hellwig
2019-12-12 10:36 ` Talker Alex [this message]
2019-12-12 10:40 ` Talker Alex
2019-12-12 10:43 ` Christoph Hellwig
2020-01-16 14:15 ` Talker Alex
2020-01-16 16:08 ` Keith Busch
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=3861821576146988@sas8-ed615920eca2.qloud-c.yandex.net \
--to=alextalker@yandex.ru \
--cc=hch@infradead.org \
--cc=linux-nvme@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).