Patch "netdevsim: fix backwards compatibility in nsim_get_iflink()" has been added to the 6.9-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    netdevsim: fix backwards compatibility in nsim_get_iflink()

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netdevsim-fix-backwards-compatibility-in-nsim_get_if.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit acbabb076235e40aa7b36542eb70c41f05393c2e
Author: David Wei <dw@xxxxxxxxxxx>
Date:   Thu Jun 6 07:59:08 2024 -0700

    netdevsim: fix backwards compatibility in nsim_get_iflink()
    
    [ Upstream commit 5add2f7288468f35a374620dabf126c13baaea9c ]
    
    The default ndo_get_iflink() implementation returns the current ifindex
    of the netdev. But the overridden nsim_get_iflink() returns 0 if the
    current nsim is not linked, breaking backwards compatibility for
    userspace that depend on this behaviour.
    
    Fix the problem by returning the current ifindex if not linked to a
    peer.
    
    Fixes: 8debcf5832c3 ("netdevsim: add ndo_get_iflink() implementation")
    Reported-by: Yu Watanabe <watanabe.yu@xxxxxxxxx>
    Suggested-by: Yu Watanabe <watanabe.yu@xxxxxxxxx>
    Signed-off-by: David Wei <dw@xxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 8330bc0bcb7e5..d405809030aab 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -292,7 +292,8 @@ static int nsim_get_iflink(const struct net_device *dev)
 
 	rcu_read_lock();
 	peer = rcu_dereference(nsim->peer);
-	iflink = peer ? READ_ONCE(peer->netdev->ifindex) : 0;
+	iflink = peer ? READ_ONCE(peer->netdev->ifindex) :
+			READ_ONCE(dev->ifindex);
 	rcu_read_unlock();
 
 	return iflink;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux