All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
Date: Tue, 2 Nov 2021 14:55:49 +0100	[thread overview]
Message-ID: <YYFDZb35RK+lWdgi@kroah.com> (raw)
In-Reply-To: <46d41d2b-4701-fb7f-9a0b-f4a35e59c3d3@omp.ru>

On Mon, Nov 01, 2021 at 11:39:13PM +0300, Sergey Shtylyov wrote:
> Hello!
> 
> On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
> 
> >> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> >> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> >> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
> >>
> >> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> >> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> >> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> >> ---
> >> Changes in version 2:
> >> - added Alan's ACK.
> >>
> >>  drivers/usb/host/ehci-exynos.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> >> index 1a9b7572e17f..ff4e1261801a 100644
> >> --- a/drivers/usb/host/ehci-exynos.c
> >> +++ b/drivers/usb/host/ehci-exynos.c
> >> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> >>  		err = irq;
> >>  		goto fail_io;
> >>  	}
> >> +	if (!irq) {
> >> +		err = -EINVAL;
> >> +		goto fail_io;
> >> +	}
> > 
> > This is a huge sign that the api being used here is broken.
> 
>    And you're telling me that after I've wasted  time on v2? :-( Well, at least the series had
> couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
> in v1).

I thought about it some more and noticed it on your v2 submission.

> > Please fix the root cause here, if returning a 0 is an error, then have
> > the function you called to get this irq return an error.
> 
>    Well, technically not, although that doesn't match the kernel-doc for the function now.
> I only don't understand why returning IRQ0 hasn't been replaced still...

Then please work on that.

> > Otherwise you
> > will have to fix ALL callers, and people will always get it wrong.
> > Fix the root cause here, don't paper it over.
> 
>    As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
> and is even called by arch/{aplha|mips|x86}...

If it is valid, then why can it not be a valid irq for all of these
drivers that you are changing here?  What is preventing them from
running on the platforms where 0 is a valid irq value?

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0
Date: Tue, 2 Nov 2021 14:55:49 +0100	[thread overview]
Message-ID: <YYFDZb35RK+lWdgi@kroah.com> (raw)
In-Reply-To: <46d41d2b-4701-fb7f-9a0b-f4a35e59c3d3@omp.ru>

On Mon, Nov 01, 2021 at 11:39:13PM +0300, Sergey Shtylyov wrote:
> Hello!
> 
> On 10/30/21 11:54 AM, Greg Kroah-Hartman wrote:
> 
> >> If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
> >> the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
> >> at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...
> >>
> >> Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
> >> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> >> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> >> ---
> >> Changes in version 2:
> >> - added Alan's ACK.
> >>
> >>  drivers/usb/host/ehci-exynos.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
> >> index 1a9b7572e17f..ff4e1261801a 100644
> >> --- a/drivers/usb/host/ehci-exynos.c
> >> +++ b/drivers/usb/host/ehci-exynos.c
> >> @@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
> >>  		err = irq;
> >>  		goto fail_io;
> >>  	}
> >> +	if (!irq) {
> >> +		err = -EINVAL;
> >> +		goto fail_io;
> >> +	}
> > 
> > This is a huge sign that the api being used here is broken.
> 
>    And you're telling me that after I've wasted  time on v2? :-( Well, at least the series had
> couple blunders, so it couldn't merged for 5.16-rc1 anyway (not sure why these weren't detected
> in v1).

I thought about it some more and noticed it on your v2 submission.

> > Please fix the root cause here, if returning a 0 is an error, then have
> > the function you called to get this irq return an error.
> 
>    Well, technically not, although that doesn't match the kernel-doc for the function now.
> I only don't understand why returning IRQ0 hasn't been replaced still...

Then please work on that.

> > Otherwise you
> > will have to fix ALL callers, and people will always get it wrong.
> > Fix the root cause here, don't paper it over.
> 
>    As I have already told you, I won't have to do it as filtering out is only needed iff 0 is
> used as an indication for something special. IRQ0 is still perfectly valid for request_irq()
> and is even called by arch/{aplha|mips|x86}...

If it is valid, then why can it not be a valid irq for all of these
drivers that you are changing here?  What is preventing them from
running on the platforms where 0 is a valid irq value?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-02 13:55 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 17:39 [PATCH v2 00/22] Explicitly deny IRQ0 in the USB host drivers Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0 Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-30  8:54   ` Greg Kroah-Hartman
2021-10-30  8:54     ` Greg Kroah-Hartman
2021-11-01 20:39     ` Sergey Shtylyov
2021-11-01 20:39       ` Sergey Shtylyov
2021-11-02 13:55       ` Greg Kroah-Hartman [this message]
2021-11-02 13:55         ` Greg Kroah-Hartman
2021-11-02 20:45         ` Sergey Shtylyov
2021-11-02 20:45           ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 02/22] usb: host: ehci-mv: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 03/22] usb: host: ehci-npcm7xx: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 04/22] usb: host: ehci-omap: " Sergey Shtylyov
2021-10-30 19:49   ` kernel test robot
2021-10-30 19:49     ` kernel test robot
2021-10-26 17:39 ` [PATCH v2 05/22] usb: host: ehci-platform: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 06/22] usb: host: ehci-spear: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 07/22] usb: host: ehci-st: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-27  6:08   ` Patrice CHOTARD
2021-10-27  6:08     ` Patrice CHOTARD
2021-10-26 17:39 ` [PATCH v2 08/22] usb: host: ohci-at91: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 09/22] usb: host: ohci-da8xx: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 10/22] usb: host: ohci-exynos: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 11/22] usb: host: ohci-nxp: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 18:25   ` Vladimir Zapolskiy
2021-10-26 18:25     ` Vladimir Zapolskiy
2021-10-26 17:39 ` [PATCH v2 12/22] usb: host: ohci-omap: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 13/22] usb: host: ohci-platform: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 14/22] usb: host: ohci-pxa27x: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 15/22] usb: host: ohci-sm501: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 16/22] usb: host: ohci-spear: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 17/22] usb: host: ohci-st: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-27  6:08   ` Patrice CHOTARD
2021-10-27  6:08     ` Patrice CHOTARD
2021-10-26 17:39 ` [PATCH v2 18/22] usb: host: ohci-tmio: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 19/22] usb: host: xhci-histb: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 20/22] usb: host: xhci-mtk: " Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-26 17:39   ` Sergey Shtylyov
2021-10-27  8:54   ` Chunfeng Yun
2021-10-27  8:54     ` Chunfeng Yun
2021-10-27  8:54     ` Chunfeng Yun
2021-10-27  9:18   ` Chunfeng Yun
2021-10-27  9:18     ` Chunfeng Yun
2021-10-27  9:18     ` Chunfeng Yun
2021-10-27  9:25     ` Sergey Shtylyov
2021-10-27  9:25       ` Sergey Shtylyov
2021-10-27  9:25       ` Sergey Shtylyov
2021-10-27  9:35       ` Chunfeng Yun
2021-10-27  9:35         ` Chunfeng Yun
2021-10-27  9:35         ` Chunfeng Yun
2021-10-26 17:39 ` [PATCH v2 21/22] usb: host: xhci-plat: " Sergey Shtylyov
2021-10-26 17:39 ` [PATCH v2 22/22] usb: host: xhci-tegra: " Sergey Shtylyov
2021-10-30 22:08   ` kernel test robot
2021-10-30 22:08     ` kernel test robot

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=YYFDZb35RK+lWdgi@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=s.shtylyov@omp.ru \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.