From: Eran Ben Elisha <eranbe@mellanox.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Jiri Pirko <jiri@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH net-next] devlink: Use after free in devlink_health_reporter_destroy()
Date: Wed, 23 Jan 2019 09:52:14 +0000 [thread overview]
Message-ID: <ec2f175e-06ac-e823-6db3-571fcd32385f@mellanox.com> (raw)
In-Reply-To: <20190123094434.GB26018@kadam>
On 1/23/2019 11:44 AM, Dan Carpenter wrote:
> This calls kfree(reporter); before dereferencing reporter on the next
> line when it does mutex_unlock(&reporter->devlink->lock);
>
> Fixes: 880ee82f0313 ("devlink: Add health reporter create/destroy functionality")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Hi, thanks for the fix.
It is identical to one I posted yesterday.
https://patchwork.ozlabs.org/patch/1029358/
> ---
> 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 60248a53c0ad..deccce13285a 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -4223,14 +4223,16 @@ 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);
> devlink_health_buffers_destroy(reporter->dump_buffers_array,
> DEVLINK_HEALTH_SIZE_TO_BUFFERS(reporter->ops->dump_size));
> devlink_health_buffers_destroy(reporter->diagnose_buffers_array,
> DEVLINK_HEALTH_SIZE_TO_BUFFERS(reporter->ops->diagnose_size));
> kfree(reporter);
> - mutex_unlock(&reporter->devlink->lock);
> + mutex_unlock(&devlink->lock);
> }
> EXPORT_SYMBOL_GPL(devlink_health_reporter_destroy);
>
>
prev parent reply other threads:[~2019-01-23 9:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 9:44 [PATCH net-next] devlink: Use after free in devlink_health_reporter_destroy() Dan Carpenter
2019-01-23 9:52 ` Eran Ben Elisha [this message]
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=ec2f175e-06ac-e823-6db3-571fcd32385f@mellanox.com \
--to=eranbe@mellanox.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.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