linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Xu Wang <vulab@iscas.ac.cn>, kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: Re: [PATCH] nvmem: core: Fix a potential use after free
Date: Sat, 28 Dec 2019 12:30:42 +0100	[thread overview]
Message-ID: <278a19c4-c794-8de7-7cb4-1e1da3b80e83@web.de> (raw)
In-Reply-To: <1577438434-9945-1-git-send-email-vulab@iscas.ac.cn>

> Free the nvmem structure only after we are done using it.

This information can be reasonable.


> This patch just moves the put_device() down a bit to avoid the
> use after free.

I suggest to reconsider such a change because a device reference count
should eventually be decremented before decrementing the reference count
for the module which is managed by this programming interface.
Are you also looking for better software documentation for such an use case?

Regards,
Markus

  reply	other threads:[~2019-12-28 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-27  9:20 [PATCH] nvmem: core: Fix a potential use after free Xu Wang
2019-12-28 11:30 ` Markus Elfring [this message]
2019-12-28 12:25 ` nvmem: core: Checking the decrementing of reference counters Markus Elfring
2020-01-06 12:35 ` [PATCH] nvmem: core: Fix a potential use after free Srinivas Kandagatla

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=278a19c4-c794-8de7-7cb4-1e1da3b80e83@web.de \
    --to=markus.elfring@web.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=vulab@iscas.ac.cn \
    /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).