netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead
@ 2021-06-05 15:31 Xianting Tian
  2021-06-06  4:48 ` Leon Romanovsky
  2021-06-07 20:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Xianting Tian @ 2021-06-05 15:31 UTC (permalink / raw)
  To: mst, jasowang, davem, kuba, linux-kernel
  Cc: virtualization, netdev, Xianting Tian

From: Xianting Tian <xianting.tian@linux.alibaba.com>

We should not directly BUG() when there is hdr error, it is
better to output a print when such error happens. Currently,
the caller of xmit_skb() already did it.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9b6a4a8..7f11ea4 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1623,7 +1623,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
 	if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
 				    virtio_is_little_endian(vi->vdev), false,
 				    0))
-		BUG();
+		return -EPROTO;
 
 	if (vi->mergeable_rx_bufs)
 		hdr->num_buffers = 0;
-- 
1.8.3.1


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

* Re: [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead
  2021-06-05 15:31 [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Xianting Tian
@ 2021-06-06  4:48 ` Leon Romanovsky
  2021-06-07 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-06-06  4:48 UTC (permalink / raw)
  To: Xianting Tian
  Cc: mst, jasowang, davem, kuba, linux-kernel, virtualization, netdev,
	Xianting Tian

On Sat, Jun 05, 2021 at 11:31:00AM -0400, Xianting Tian wrote:
> From: Xianting Tian <xianting.tian@linux.alibaba.com>
> 
> We should not directly BUG() when there is hdr error, it is
> better to output a print when such error happens. Currently,
> the caller of xmit_skb() already did it.
> 
> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
> ---
>  drivers/net/virtio_net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 9b6a4a8..7f11ea4 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1623,7 +1623,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
>  	if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
>  				    virtio_is_little_endian(vi->vdev), false,
>  				    0))
> -		BUG();
> +		return -EPROTO;

Yeah, as we discussed, BUG*() macros in non-core code that checks
in-kernel API better to be deleted.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead
  2021-06-05 15:31 [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Xianting Tian
  2021-06-06  4:48 ` Leon Romanovsky
@ 2021-06-07 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-07 20:10 UTC (permalink / raw)
  To: Xianting Tian
  Cc: mst, jasowang, davem, kuba, linux-kernel, virtualization, netdev,
	xianting.tian

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sat,  5 Jun 2021 11:31:00 -0400 you wrote:
> From: Xianting Tian <xianting.tian@linux.alibaba.com>
> 
> We should not directly BUG() when there is hdr error, it is
> better to output a print when such error happens. Currently,
> the caller of xmit_skb() already did it.
> 
> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
> 
> [...]

Here is the summary with links:
  - [v2] virtio_net: Remove BUG() to avoid machine dead
    https://git.kernel.org/netdev/net-next/c/85eb1389458d

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] 3+ messages in thread

end of thread, other threads:[~2021-06-07 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 15:31 [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Xianting Tian
2021-06-06  4:48 ` Leon Romanovsky
2021-06-07 20:10 ` patchwork-bot+netdevbpf

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