netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: flexcan: free error skb if enqueueing failed
@ 2019-07-15 18:53 Martin Hundebøll
  2019-08-01  7:59 ` Martin Hundebøll
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Hundebøll @ 2019-07-15 18:53 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, linux-can
  Cc: Martin Hundebøll, David S . Miller, netdev, Sean Nyekjaer

If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
consumed, so the caller must do so.

Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's irq_offload_fifo")
Signed-off-by: Martin Hundebøll <martin@geanix.com>
---
 drivers/net/can/flexcan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 1c66fb2ad76b..21f39e805d42 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -688,7 +688,8 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr)
 	if (tx_errors)
 		dev->stats.tx_errors++;
 
-	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
+	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
+		kfree_skb(skb);
 }
 
 static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
@@ -732,7 +733,8 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
 	if (unlikely(new_state == CAN_STATE_BUS_OFF))
 		can_bus_off(dev);
 
-	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
+	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
+		kfree_skb(skb);
 }
 
 static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)
-- 
2.22.0


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

* Re: [PATCH] can: flexcan: free error skb if enqueueing failed
  2019-07-15 18:53 [PATCH] can: flexcan: free error skb if enqueueing failed Martin Hundebøll
@ 2019-08-01  7:59 ` Martin Hundebøll
  2019-09-13  9:44   ` Sean Nyekjaer
  2019-08-20  9:49 ` Sean Nyekjaer
  2019-10-10  8:08 ` Marc Kleine-Budde
  2 siblings, 1 reply; 6+ messages in thread
From: Martin Hundebøll @ 2019-08-01  7:59 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, linux-can
  Cc: David S . Miller, netdev, Sean Nyekjaer

On 15/07/2019 20.53, Martin Hundebøll wrote:
> If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
> consumed, so the caller must do so.
> 
> Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's irq_offload_fifo")
> Signed-off-by: Martin Hundebøll <martin@geanix.com>

Ping.

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

* Re: [PATCH] can: flexcan: free error skb if enqueueing failed
  2019-07-15 18:53 [PATCH] can: flexcan: free error skb if enqueueing failed Martin Hundebøll
  2019-08-01  7:59 ` Martin Hundebøll
@ 2019-08-20  9:49 ` Sean Nyekjaer
  2019-08-20 10:12   ` Joakim Zhang
  2019-10-10  8:08 ` Marc Kleine-Budde
  2 siblings, 1 reply; 6+ messages in thread
From: Sean Nyekjaer @ 2019-08-20  9:49 UTC (permalink / raw)
  To: Martin Hundebøll, Wolfgang Grandegger, Marc Kleine-Budde, linux-can
  Cc: David S . Miller, netdev, Joakim Zhang

CC'ing Joakim Zhang

On 15/07/2019 20.53, Martin Hundebøll wrote:
> If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
> consumed, so the caller must do so.
> 
> Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's irq_offload_fifo")
> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> ---
>   drivers/net/can/flexcan.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index 1c66fb2ad76b..21f39e805d42 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -688,7 +688,8 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr)
>   	if (tx_errors)
>   		dev->stats.tx_errors++;
>   
> -	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
> +	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
> +		kfree_skb(skb);
>   }
>   
>   static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
> @@ -732,7 +733,8 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
>   	if (unlikely(new_state == CAN_STATE_BUS_OFF))
>   		can_bus_off(dev);
>   
> -	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
> +	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
> +		kfree_skb(skb);
>   }
>   
>   static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)
> 

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

* RE: [PATCH] can: flexcan: free error skb if enqueueing failed
  2019-08-20  9:49 ` Sean Nyekjaer
@ 2019-08-20 10:12   ` Joakim Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Joakim Zhang @ 2019-08-20 10:12 UTC (permalink / raw)
  To: Sean Nyekjaer, Martin Hundebøll, Wolfgang Grandegger,
	Marc Kleine-Budde, linux-can
  Cc: David S . Miller, netdev


> -----Original Message-----
> From: Sean Nyekjaer <sean@geanix.com>
> Sent: 2019年8月20日 17:50
> To: Martin Hundebøll <martin@geanix.com>; Wolfgang Grandegger
> <wg@grandegger.com>; Marc Kleine-Budde <mkl@pengutronix.de>;
> linux-can@vger.kernel.org
> Cc: David S . Miller <davem@davemloft.net>; netdev@vger.kernel.org; Joakim
> Zhang <qiangqing.zhang@nxp.com>
> Subject: Re: [PATCH] can: flexcan: free error skb if enqueueing failed
> 
> CC'ing Joakim Zhang

Looks good, so add my tag:
Acked-by: Joakim Zhang <qiangqing.zhang@nxp.com>

Best Regards,
Joakim Zhang
> On 15/07/2019 20.53, Martin Hundebøll wrote:
> > If the call to can_rx_offload_queue_sorted() fails, the passed skb
> > isn't consumed, so the caller must do so.
> >
> > Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's
> > irq_offload_fifo")
> > Signed-off-by: Martin Hundebøll <martin@geanix.com>
> > ---
> >   drivers/net/can/flexcan.c | 6 ++++--
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> > index 1c66fb2ad76b..21f39e805d42 100644
> > --- a/drivers/net/can/flexcan.c
> > +++ b/drivers/net/can/flexcan.c
> > @@ -688,7 +688,8 @@ static void flexcan_irq_bus_err(struct net_device
> *dev, u32 reg_esr)
> >   	if (tx_errors)
> >   		dev->stats.tx_errors++;
> >
> > -	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
> > +	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
> > +		kfree_skb(skb);
> >   }
> >
> >   static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
> > @@ -732,7 +733,8 @@ static void flexcan_irq_state(struct net_device *dev,
> u32 reg_esr)
> >   	if (unlikely(new_state == CAN_STATE_BUS_OFF))
> >   		can_bus_off(dev);
> >
> > -	can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
> > +	if (can_rx_offload_queue_sorted(&priv->offload, skb, timestamp))
> > +		kfree_skb(skb);
> >   }
> >
> >   static inline struct flexcan_priv *rx_offload_to_priv(struct
> > can_rx_offload *offload)
> >

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

* Re: [PATCH] can: flexcan: free error skb if enqueueing failed
  2019-08-01  7:59 ` Martin Hundebøll
@ 2019-09-13  9:44   ` Sean Nyekjaer
  0 siblings, 0 replies; 6+ messages in thread
From: Sean Nyekjaer @ 2019-09-13  9:44 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can
  Cc: Martin Hundebøll, Wolfgang Grandegger, David S . Miller, netdev



On 01/08/2019 09.59, Martin Hundebøll wrote:
> On 15/07/2019 20.53, Martin Hundebøll wrote:
>> If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
>> consumed, so the caller must do so.
>>
>> Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's 
>> irq_offload_fifo")
>> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> 
> Ping.

Hi Marc

Any problems with this? Besides time ;-)

We really need this to be back ported to 4.19, soon...

/Sean

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

* Re: [PATCH] can: flexcan: free error skb if enqueueing failed
  2019-07-15 18:53 [PATCH] can: flexcan: free error skb if enqueueing failed Martin Hundebøll
  2019-08-01  7:59 ` Martin Hundebøll
  2019-08-20  9:49 ` Sean Nyekjaer
@ 2019-10-10  8:08 ` Marc Kleine-Budde
  2 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2019-10-10  8:08 UTC (permalink / raw)
  To: Martin Hundebøll, Wolfgang Grandegger, linux-can
  Cc: David S . Miller, netdev, Sean Nyekjaer


[-- Attachment #1.1: Type: text/plain, Size: 676 bytes --]

On 7/15/19 8:53 PM, Martin Hundebøll wrote:
> If the call to can_rx_offload_queue_sorted() fails, the passed skb isn't
> consumed, so the caller must do so.
> 
> Fixes: 30164759db1b ("can: flexcan: make use of rx-offload's irq_offload_fifo")
> Signed-off-by: Martin Hundebøll <martin@geanix.com>

I've fixed the problem by adding the kfree_skb() to
can_rx_offload_queue_sorted().

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-10-10  8:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 18:53 [PATCH] can: flexcan: free error skb if enqueueing failed Martin Hundebøll
2019-08-01  7:59 ` Martin Hundebøll
2019-09-13  9:44   ` Sean Nyekjaer
2019-08-20  9:49 ` Sean Nyekjaer
2019-08-20 10:12   ` Joakim Zhang
2019-10-10  8:08 ` Marc Kleine-Budde

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).