[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1548172644-30862-7-git-send-email-eranbe@mellanox.com>
Date: Tue, 22 Jan 2019 17:57:23 +0200
From: Eran Ben Elisha <eranbe@...lanox.com>
To: netdev@...r.kernel.org, Jiri Pirko <jiri@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Saeed Mahameed <saeedm@...lanox.com>
Cc: Moshe Shemesh <moshe@...lanox.com>,
Eran Ben Elisha <eranbe@...lanox.com>
Subject: [PATCH net-next 6/7] devlink: Fix use-after-free at reporter destroy
Fix a bug where reporter->devlink attribute was used after the reporter
was freed.
Fixes: 880ee82f0313 ("devlink: Add health reporter create/destroy functionality")
Signed-off-by: Eran Ben Elisha <eranbe@...lanox.com>
Reviewed-by: Moshe Shemesh <moshe@...lanox.com>
---
net/core/devlink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 379ebd3f9a59..3cb74694de86 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4150,12 +4150,14 @@ EXPORT_SYMBOL_GPL(devlink_health_reporter_create);
void
devlink_health_reporter_destroy(struct devlink_health_reporter *reporter)
{
- mutex_lock(&reporter->devlink->lock);
+ struct devlink *devlink = reporter->devlink;
+
+ mutex_lock(&devlink->lock);
list_del(&reporter->list);
if (reporter->dump_msg_ctx)
devlink_msg_ctx_free(reporter->dump_msg_ctx);
kfree(reporter);
- mutex_unlock(&reporter->devlink->lock);
+ mutex_unlock(&devlink->lock);
}
EXPORT_SYMBOL_GPL(devlink_health_reporter_destroy);
--
2.17.1
Powered by blists - more mailing lists