Commit f0e656e4 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Christoph Hellwig

nvmet: fix NULL dereference when removing a referral

When item release is called, the parent is already null.  We need the
parent to pass to nvmet_referral_disable so hook it up to
->disconnect_notify.
Reported-by: default avatarTony Asleson <tasleson@redhat.com>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 74e4d20e
...@@ -1098,12 +1098,19 @@ static struct configfs_attribute *nvmet_referral_attrs[] = { ...@@ -1098,12 +1098,19 @@ static struct configfs_attribute *nvmet_referral_attrs[] = {
NULL, NULL,
}; };
static void nvmet_referral_release(struct config_item *item) static void nvmet_referral_notify(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(item->ci_parent->ci_parent);
struct nvmet_port *port = to_nvmet_port(item); struct nvmet_port *port = to_nvmet_port(item);
nvmet_referral_disable(parent, port); nvmet_referral_disable(parent, port);
}
static void nvmet_referral_release(struct config_item *item)
{
struct nvmet_port *port = to_nvmet_port(item);
kfree(port); kfree(port);
} }
...@@ -1134,6 +1141,7 @@ static struct config_group *nvmet_referral_make( ...@@ -1134,6 +1141,7 @@ static struct config_group *nvmet_referral_make(
static struct configfs_group_operations nvmet_referral_group_ops = { static struct configfs_group_operations nvmet_referral_group_ops = {
.make_group = nvmet_referral_make, .make_group = nvmet_referral_make,
.disconnect_notify = nvmet_referral_notify,
}; };
static const struct config_item_type nvmet_referrals_type = { static const struct config_item_type nvmet_referrals_type = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment