mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Wen Yang <wenyang@linux.alibaba.com>, Benson Leung <bleung@chromium.org>
Cc: xlpang@linux.alibaba.com, Nick Crews <ncrews@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/chrome: wilco_ec: fix use after free issue
Date: Mon, 2 Dec 2019 12:16:21 +0100	[thread overview]
Message-ID: <5d19df91-ac9a-05a5-3636-c5f1594138a3@collabora.com> (raw)
In-Reply-To: <20191130130842.33763-1-wenyang@linux.alibaba.com>

Hi Wen,

On 30/11/19 14:08, Wen Yang wrote:
> This is caused by dereferencing 'dev_data' after put_device() in
> the telem_device_remove() function.
> This patch just moves the put_device() down a bit to avoid this
> issue.
> 
> Fixes: 1210d1e6bad1 ("platform/chrome: wilco_ec: Add telemetry char device interface")
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Nick Crews <ncrews@chromium.org>
> Cc: linux-kernel@vger.kernel.org
> ---

Queued for 5.5 as is a fix.

Thanks.
 Enric

>  drivers/platform/chrome/wilco_ec/telemetry.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c
> index b9d03c3..1176d54 100644
> --- a/drivers/platform/chrome/wilco_ec/telemetry.c
> +++ b/drivers/platform/chrome/wilco_ec/telemetry.c
> @@ -406,8 +406,8 @@ static int telem_device_remove(struct platform_device *pdev)
>  	struct telem_device_data *dev_data = platform_get_drvdata(pdev);
>  
>  	cdev_device_del(&dev_data->cdev, &dev_data->dev);
> -	put_device(&dev_data->dev);
>  	ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
> +	put_device(&dev_data->dev);
>  
>  	return 0;
>  }
> 

      reply	other threads:[~2019-12-02 11:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-30 13:08 Wen Yang
2019-12-02 11:16 ` Enric Balletbo i Serra [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=5d19df91-ac9a-05a5-3636-c5f1594138a3@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=bleung@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncrews@chromium.org \
    --cc=wenyang@linux.alibaba.com \
    --cc=xlpang@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®