All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcmgenet: add WOL IRQ check
@ 2022-01-13 19:46 Sergey Shtylyov
  2022-01-13 21:00 ` Andrew Lunn
  2022-01-14 11:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2022-01-13 19:46 UTC (permalink / raw)
  To: Doug Berger, Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: bcm-kernel-feedback-list

The driver neglects to check the result of platform_get_irq_optional()'s
call and blithely passes the negative error codes to devm_request_irq()
(which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
Stop calling devm_request_irq() with the invalid IRQ #s.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against DaveM's 'net.git' repo.

 drivers/net/ethernet/broadcom/genet/bcmgenet.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: net/drivers/net/ethernet/broadcom/genet/bcmgenet.c
===================================================================
--- net.orig/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ net/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -4020,10 +4020,12 @@ static int bcmgenet_probe(struct platfor
 
 	/* Request the WOL interrupt and advertise suspend if available */
 	priv->wol_irq_disabled = true;
-	err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0,
-			       dev->name, priv);
-	if (!err)
-		device_set_wakeup_capable(&pdev->dev, 1);
+	if (priv->wol_irq > 0) {
+		err = devm_request_irq(&pdev->dev, priv->wol_irq,
+				       bcmgenet_wol_isr, 0, dev->name, priv);
+		if (!err)
+			device_set_wakeup_capable(&pdev->dev, 1);
+	}
 
 	/* Set the needed headroom to account for any possible
 	 * features enabling/disabling at runtime

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 19:46 [PATCH] bcmgenet: add WOL IRQ check Sergey Shtylyov
@ 2022-01-13 21:00 ` Andrew Lunn
  2022-01-13 21:37   ` Florian Fainelli
  2022-01-14 11:03   ` Sergey Shtylyov
  2022-01-14 11:30 ` patchwork-bot+netdevbpf
  1 sibling, 2 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-01-13 21:00 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: Doug Berger, Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev, bcm-kernel-feedback-list

On Thu, Jan 13, 2022 at 10:46:07PM +0300, Sergey Shtylyov wrote:
> The driver neglects to check the result of platform_get_irq_optional()'s
> call and blithely passes the negative error codes to devm_request_irq()
> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
> Stop calling devm_request_irq() with the invalid IRQ #s.
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> This patch is against DaveM's 'net.git' repo.

Since this is for net, it needs a Fixes: tag.

Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt")

       Andrew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 21:00 ` Andrew Lunn
@ 2022-01-13 21:37   ` Florian Fainelli
  2022-01-13 21:47     ` Florian Fainelli
  2022-01-14 10:58     ` Sergey Shtylyov
  2022-01-14 11:03   ` Sergey Shtylyov
  1 sibling, 2 replies; 7+ messages in thread
From: Florian Fainelli @ 2022-01-13 21:37 UTC (permalink / raw)
  To: Andrew Lunn, Sergey Shtylyov
  Cc: Doug Berger, David S. Miller, Jakub Kicinski, netdev,
	bcm-kernel-feedback-list



On 1/13/2022 1:00 PM, Andrew Lunn wrote:
> On Thu, Jan 13, 2022 at 10:46:07PM +0300, Sergey Shtylyov wrote:
>> The driver neglects to check the result of platform_get_irq_optional()'s
>> call and blithely passes the negative error codes to devm_request_irq()
>> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
>> Stop calling devm_request_irq() with the invalid IRQ #s.
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>
>> ---
>> This patch is against DaveM's 'net.git' repo.
> 
> Since this is for net, it needs a Fixes: tag.
> 
> Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt")

I don't have strong objections whether we want to consider this a bug 
fix or not, but since the code only acts upon devm_request_irq() 
returning 0 meaning success, this seems more like an improvement rather 
than fixing an actual issue.
-- 
Florian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 21:37   ` Florian Fainelli
@ 2022-01-13 21:47     ` Florian Fainelli
  2022-01-14 10:58     ` Sergey Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2022-01-13 21:47 UTC (permalink / raw)
  To: Andrew Lunn, Sergey Shtylyov
  Cc: Doug Berger, David S. Miller, Jakub Kicinski, netdev,
	bcm-kernel-feedback-list



On 1/13/2022 1:37 PM, Florian Fainelli wrote:
> 
> 
> On 1/13/2022 1:00 PM, Andrew Lunn wrote:
>> On Thu, Jan 13, 2022 at 10:46:07PM +0300, Sergey Shtylyov wrote:
>>> The driver neglects to check the result of platform_get_irq_optional()'s
>>> call and blithely passes the negative error codes to devm_request_irq()
>>> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
>>> Stop calling devm_request_irq() with the invalid IRQ #s.
>>>
>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>>
>>> ---
>>> This patch is against DaveM's 'net.git' repo.
>>
>> Since this is for net, it needs a Fixes: tag.
>>
>> Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt")
> 
> I don't have strong objections whether we want to consider this a bug 
> fix or not, but since the code only acts upon devm_request_irq() 
> returning 0 meaning success, this seems more like an improvement rather 
> than fixing an actual issue.

If you do repost, please subject your patch with "net: bcmgenet" for 
consistency with previous commits done to that file, and feel free to add:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 21:37   ` Florian Fainelli
  2022-01-13 21:47     ` Florian Fainelli
@ 2022-01-14 10:58     ` Sergey Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2022-01-14 10:58 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn
  Cc: Doug Berger, David S. Miller, Jakub Kicinski, netdev,
	bcm-kernel-feedback-list

Hello!

On 1/14/22 12:37 AM, Florian Fainelli wrote:

>>> The driver neglects to check the result of platform_get_irq_optional()'s
>>> call and blithely passes the negative error codes to devm_request_irq()
>>> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
>>> Stop calling devm_request_irq() with the invalid IRQ #s.
>>>
>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>>
>>> ---
>>> This patch is against DaveM's 'net.git' repo.
>>
>> Since this is for net, it needs a Fixes: tag.
>>
>> Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt")
> 
> I don't have strong objections whether we want to consider this a bug fix or not,

   Formally, it's a fix -- as you shouldn't call devm_request_irq() with "negative" IRQ #s.

> but since the code only acts upon devm_request_irq() returning 0 meaning success, this seems more like an improvement rather than fixing an actual issue.

   More like a cleanup (no, not improvement).

MBR, Sergey

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 21:00 ` Andrew Lunn
  2022-01-13 21:37   ` Florian Fainelli
@ 2022-01-14 11:03   ` Sergey Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2022-01-14 11:03 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Doug Berger, Florian Fainelli, David S. Miller, Jakub Kicinski,
	netdev, bcm-kernel-feedback-list

Hello!

On 1/14/22 12:00 AM, Andrew Lunn wrote:

>> The driver neglects to check the result of platform_get_irq_optional()'s
>> call and blithely passes the negative error codes to devm_request_irq()
>> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
>> Stop calling devm_request_irq() with the invalid IRQ #s.
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>
>> ---
>> This patch is against DaveM's 'net.git' repo.
> 
> Since this is for net, it needs a Fixes: tag.
> 
> Fixes: 8562056f267d ("net: bcmgenet: request Wake-on-LAN interrupt")

   Indeed, I completely forgot about it. Thanks! :-)

>        Andrew

MBR, Sergey

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] bcmgenet: add WOL IRQ check
  2022-01-13 19:46 [PATCH] bcmgenet: add WOL IRQ check Sergey Shtylyov
  2022-01-13 21:00 ` Andrew Lunn
@ 2022-01-14 11:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-14 11:30 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: opendmb, f.fainelli, davem, kuba, netdev, bcm-kernel-feedback-list

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 13 Jan 2022 22:46:07 +0300 you wrote:
> The driver neglects to check the result of platform_get_irq_optional()'s
> call and blithely passes the negative error codes to devm_request_irq()
> (which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
> Stop calling devm_request_irq() with the invalid IRQ #s.
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> [...]

Here is the summary with links:
  - bcmgenet: add WOL IRQ check
    https://git.kernel.org/netdev/net/c/9deb48b53e7f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-14 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 19:46 [PATCH] bcmgenet: add WOL IRQ check Sergey Shtylyov
2022-01-13 21:00 ` Andrew Lunn
2022-01-13 21:37   ` Florian Fainelli
2022-01-13 21:47     ` Florian Fainelli
2022-01-14 10:58     ` Sergey Shtylyov
2022-01-14 11:03   ` Sergey Shtylyov
2022-01-14 11:30 ` patchwork-bot+netdevbpf

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.