Patch "net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN" has been added to the 4.19-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

    net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN

to the 4.19-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:
     net-bridge-br_fdb_external_learn_add-always-set-ext_.patch
and it can be found in the queue-4.19 subdirectory.

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



commit c7736c920541cfb90a21bc42e5132084d924b90d
Author: Jonas Gorski <jonas.gorski@xxxxxxxx>
Date:   Tue Sep 3 10:19:57 2024 +0200

    net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN
    
    [ Upstream commit bee2ef946d3184e99077be526567d791c473036f ]
    
    When userspace wants to take over a fdb entry by setting it as
    EXTERN_LEARNED, we set both flags BR_FDB_ADDED_BY_EXT_LEARN and
    BR_FDB_ADDED_BY_USER in br_fdb_external_learn_add().
    
    If the bridge updates the entry later because its port changed, we clear
    the BR_FDB_ADDED_BY_EXT_LEARN flag, but leave the BR_FDB_ADDED_BY_USER
    flag set.
    
    If userspace then wants to take over the entry again,
    br_fdb_external_learn_add() sees that BR_FDB_ADDED_BY_USER and skips
    setting the BR_FDB_ADDED_BY_EXT_LEARN flags, thus silently ignores the
    update.
    
    Fix this by always allowing to set BR_FDB_ADDED_BY_EXT_LEARN regardless
    if this was a user fdb entry or not.
    
    Fixes: 710ae7287737 ("net: bridge: Mark FDB entries that were added by user as such")
    Signed-off-by: Jonas Gorski <jonas.gorski@xxxxxxxx>
    Acked-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>
    Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>
    Link: https://patch.msgid.link/20240903081958.29951-1-jonas.gorski@xxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index d898e3814f91..a6e4901909e3 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1116,12 +1116,10 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
 			modified = true;
 		}
 
-		if (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) {
+		if (test_and_set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) {
 			/* Refresh entry */
 			fdb->used = jiffies;
-		} else if (!test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags)) {
-			/* Take over SW learned entry */
-			set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags);
+		} else {
 			modified = true;
 		}
 




[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