Re: [PATCH] can: dev: can_restart(): post buffer from the right context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/5/20 10:51 PM, Alejandro wrote:
> From: Alejandro Concepcion Rodriguez<alejandro@xxxxxxxx>
> 
> netif_rx() is meant to be called from interrupt contexts. can_restart()
> may be called by can_restart_work(), which is called from a worqueue, so
> it may run in process context. Use netif_rx_any_context() which invokes
> the correct code path depending on context.
> 
> Co-developed-by: Loris Fauster<loris.fauster@xxxxxxxxxxxxx>
> Signed-off-by: Loris Fauster<loris.fauster@xxxxxxxxxxxxx>
> Signed-off-by: Alejandro Concepcion Rodriguez<alejandro@xxxxxxxx>

I think we either call can_restart() from a netlink callback via
can_restart_now() or via the can_restart_work(). So we should always use
netif_rx_ni(skb), right?

> ---
>   drivers/net/can/dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index b70ded3760f2..83114f8e8c24 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -584,7 +584,7 @@ static void can_restart(struct net_device *dev)
>   
>   	cf->can_id |= CAN_ERR_RESTARTED;
>   
> -	netif_rx(skb);
> +	netif_rx_any_context(skb);
>   
>   	stats->rx_packets++;
>   	stats->rx_bytes += cf->can_dlc;
> 

Marc

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

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux