All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eran Ben Elisha <eranbe@mellanox.com>
To: netdev@vger.kernel.org, Jiri Pirko <jiri@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	Saeed Mahameed <saeedm@mellanox.com>
Cc: Moshe Shemesh <moshe@mellanox.com>,
	Eran Ben Elisha <eranbe@mellanox.com>
Subject: [PATCH net-next 6/7] devlink: Fix use-after-free at reporter destroy
Date: Tue, 22 Jan 2019 17:57:23 +0200	[thread overview]
Message-ID: <1548172644-30862-7-git-send-email-eranbe@mellanox.com> (raw)
In-Reply-To: <1548172644-30862-1-git-send-email-eranbe@mellanox.com>

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@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.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


  parent reply	other threads:[~2019-01-22 15:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:57 [PATCH net-next 0/7] Devlink health updates Eran Ben Elisha
2019-01-22 15:57 ` [PATCH net-next 1/7] devlink: Add devlink msg API Eran Ben Elisha
2019-01-23 14:31   ` Jiri Pirko
2019-01-24  7:31     ` Eran Ben Elisha
2019-01-22 15:57 ` [PATCH net-next 2/7] net/mlx5e: Move driver to use " Eran Ben Elisha
2019-01-23 14:39   ` Jiri Pirko
2019-01-24  7:39     ` Eran Ben Elisha
2019-01-24  9:08       ` Jiri Pirko
2019-01-24  9:57         ` Eran Ben Elisha
2019-01-22 15:57 ` [PATCH net-next 3/7] devlink: move devlink health reporter " Eran Ben Elisha
2019-01-23 14:42   ` Jiri Pirko
2019-01-24  7:45     ` Eran Ben Elisha
2019-01-24  9:09       ` Jiri Pirko
2019-01-24  9:57         ` Eran Ben Elisha
2019-01-22 15:57 ` [PATCH net-next 4/7] devlink: Delete depracated health buffers API Eran Ben Elisha
2019-01-22 15:57 ` [PATCH net-next 5/7] devlink: Remove spaces around "=" in the logger print Eran Ben Elisha
2019-01-22 15:57 ` Eran Ben Elisha [this message]
2019-01-22 15:57 ` [PATCH net-next 7/7] net/mlx5e: Add RTNL lock to TX recover flow Eran Ben Elisha
2019-01-22 16:58 ` [PATCH net-next 0/7] Devlink health updates Jiri Pirko
2019-01-25  6:08   ` David Miller
2019-01-25  9:16     ` Eran Ben Elisha
2019-01-25  9:19       ` Jiri Pirko
2019-01-25 18:56       ` David Miller
2019-01-23 11:44 ` Jiri Pirko
2019-01-23 12:34   ` Eran Ben Elisha

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=1548172644-30862-7-git-send-email-eranbe@mellanox.com \
    --to=eranbe@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.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.