linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-spi@vger.kernel.org, broonie@kernel.org
Subject: Re: [PATCH -next 3/6] spi: omap-uwire: Switch to use devm_spi_alloc_master()
Date: Fri, 23 Sep 2022 07:06:44 +0200	[thread overview]
Message-ID: <20220923050644.GA15095@wunner.de> (raw)
In-Reply-To: <20220920134819.2981033-4-yangyingliang@huawei.com>

On Tue, Sep 20, 2022 at 09:48:16PM +0800, Yang Yingliang wrote:
> @@ -476,7 +474,6 @@ static int uwire_probe(struct platform_device *pdev)
>  	if (IS_ERR(uwire->ck)) {
>  		status = PTR_ERR(uwire->ck);
>  		dev_dbg(&pdev->dev, "no functional clock?\n");
> -		spi_master_put(master);
>  		return status;
>  	}
>  	clk_prepare_enable(uwire->ck);

Change this hunk to return PTR_ERR(uwire->ck) directly without
assigning to status first.

> @@ -518,6 +515,7 @@ static int uwire_remove(struct platform_device *pdev)
>  
>  	spi_bitbang_stop(&uwire->bitbang);
>  	uwire_off(uwire);
> +	spi_master_put(uwire->bitbang.master);
>  	return 0;
>  }
>  

No, drop this hunk, it results in a use-after-free.

Thanks,

Lukas

  reply	other threads:[~2022-09-23  5:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 13:48 [PATCH -next 0/6] spi: Switch to use devm_spi_alloc_master() in some drivers Yang Yingliang
2022-09-20 13:48 ` [PATCH -next 1/6] spi: oc-tiny: Switch to use devm_spi_alloc_master() Yang Yingliang
2022-09-23  4:55   ` Lukas Wunner
2022-09-20 13:48 ` [PATCH -next 2/6] spi: ath79: " Yang Yingliang
2022-09-23  5:00   ` Lukas Wunner
2022-09-20 13:48 ` [PATCH -next 3/6] spi: omap-uwire: " Yang Yingliang
2022-09-23  5:06   ` Lukas Wunner [this message]
2022-09-20 13:48 ` [PATCH -next 4/6] spi: ppc4xx: " Yang Yingliang
2022-09-20 13:48 ` [PATCH -next 5/6] spi: sh-sci: " Yang Yingliang
2022-09-20 13:48 ` [PATCH -next 6/6] spi: altera: " Yang Yingliang
2022-09-20 18:33 ` [PATCH -next 0/6] spi: Switch to use devm_spi_alloc_master() in some drivers Mark Brown
2022-09-21  2:02   ` Yang Yingliang
2022-09-21 12:37     ` Mark Brown
2022-09-21 13:19       ` Yang Yingliang
2022-09-23  5:39         ` Lukas Wunner
2022-09-23  4:42       ` Lukas Wunner
2022-09-23 10:12         ` Mark Brown
2022-09-23 14:48           ` Yang Yingliang
2022-09-23  5:33 ` Lukas Wunner

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=20220923050644.GA15095@wunner.de \
    --to=lukas@wunner.de \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=yangyingliang@huawei.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;
as well as URLs for NNTP newsgroup(s).