[PATCH net-next 2/2] veth: fix double napi enable

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

 



While investigating a related issue I stumbled upon another
oops, reproducible as the follow:

ip link add type veth
ip link set dev veth0 xdp object <obj>
ip link set dev veth0 up
ip link set dev veth1 up

The first link up command will enable the napi instances on
veth1 and the second link up common will try again the same
operation, causing the oops.

This change addresses the issue explicitly checking the peer
is up before enabling its napi instances.

Fixes: 2e0de6366ac1 ("veth: Avoid drop packets when xdp_redirect performs")
Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
---
 drivers/net/veth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 1384134f7100..d541183e0c66 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1343,7 +1343,8 @@ static int veth_open(struct net_device *dev)
 		if (err)
 			return err;
 		/* refer to the logic in veth_xdp_set() */
-		if (!rtnl_dereference(peer_rq->napi)) {
+		if (!rtnl_dereference(peer_rq->napi) &&
+		    (peer->flags & IFF_UP)) {
 			err = veth_napi_enable(peer);
 			if (err)
 				return err;
-- 
2.38.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux