linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: "Toke Høiland-Jørgensen" <toke@kernel.org>
Cc: Felix Fietkau <nbd@nbd.name>,  Rosen Penev <rosenp@gmail.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] net: ath9k: use devm for request_irq
Date: Thu, 08 Aug 2024 13:17:19 +0300	[thread overview]
Message-ID: <87zfpn2ua8.fsf@kernel.org> (raw)
In-Reply-To: <87plqjpds4.fsf@toke.dk> ("Toke Høiland-Jørgensen"'s message of "Thu, 08 Aug 2024 11:25:15 +0200")

Toke Høiland-Jørgensen <toke@kernel.org> writes:

> Felix Fietkau <nbd@nbd.name> writes:
>
>> On 07.08.24 22:07, Rosen Penev wrote:
>>> On Wed, Aug 7, 2024 at 1:05 PM Felix Fietkau <nbd@nbd.name> wrote:
>>>>
>>>> On 07.08.24 20:52, Rosen Penev wrote:
>>>> > On Wed, Aug 7, 2024 at 10:47 AM Felix Fietkau <nbd@nbd.name> wrote:
>>>> >>
>>>> >> On 31.07.24 23:02, Rosen Penev wrote:
>>>> >> > Avoids having to manually call free_irq. Simplifies code slightly.
>>>> >> >
>>>> >> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>>> >> > ---
>>>> >> >   drivers/net/wireless/ath/ath9k/ahb.c | 7 ++-----
>>>> >> >   drivers/net/wireless/ath/ath9k/pci.c | 9 +++------
>>>> >> >   2 files changed, 5 insertions(+), 11 deletions(-)
>>>> >> >
>>>> >> > diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
>>>> >> > index 1a6697b6e3b4..29f67ded8fe2 100644
>>>> >> > --- a/drivers/net/wireless/ath/ath9k/ahb.c
>>>> >> > +++ b/drivers/net/wireless/ath/ath9k/ahb.c
>>>> >> > @@ -118,7 +118,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
>>>> >> >       sc->mem = mem;
>>>> >> >       sc->irq = irq;
>>>> >> >
>>>> >> > -     ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc);
>>>> >> > +     ret = devm_request_irq(&pdev->dev, irq, ath_isr, IRQF_SHARED, "ath9k", sc);
>>>> >> Sorry for the late response, but I think this patch is wrong any may
>>>> >> need to be reverted. If there is an error during probe, and the IRQ
>>>> >> fires for some reason, there could be an use-after-free bug when the IRQ
>>>> >> handler accesses the data in sc.
>>>> >> The explicit freq_irq calls were preventing that from happening.
>>>> > How about keeping the devm variant and replacing free_irq with
>>>> > devm_free_irq in probe?
>>>>
>>>> If you do that, then using the devm variant is completely pointless.
>>>> I think a full revert is the best option.
>>> OTOH it still allows removing free_irq from _remove, but I see your point.
>>
>> No, because you'd have the same use-after-free bug there as well.
>
> Alright, let's revert. Kalle, can you just do the revert, or should I
> send a patch for it?

Thanks, the best is to send a patch.

But honestly more and more I'm starting to think that we should just
reject all these "drive-by cleanups". We have better things to do than
fixing unnecessary their bugs. Thoughts?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2024-08-08 10:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 21:02 [PATCH] net: ath9k: use devm for request_irq Rosen Penev
2024-08-01  8:10 ` Kalle Valo
2024-08-05 12:25 ` Toke Høiland-Jørgensen
2024-08-07  8:08 ` Kalle Valo
2024-08-07 17:47 ` Felix Fietkau
2024-08-07 18:52   ` Rosen Penev
2024-08-07 20:05     ` Felix Fietkau
2024-08-07 20:07       ` Rosen Penev
2024-08-07 20:20         ` Felix Fietkau
2024-08-08  9:25           ` Toke Høiland-Jørgensen
2024-08-08 10:17             ` Kalle Valo [this message]
2024-08-08 10:37               ` Toke Høiland-Jørgensen
2024-08-08 11:40                 ` Kalle Valo
2024-08-08 13:54                   ` Toke Høiland-Jørgensen

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=87zfpn2ua8.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=rosenp@gmail.com \
    --cc=toke@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;
as well as URLs for NNTP newsgroup(s).