From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 532D7188CDC; Tue, 10 Sep 2024 09:38:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961089; cv=none; b=jgkpdfFJV0J3U/OM4Xj1Ueb129q+4deOjrTWZQhrM5IK2C0CDoQ8x8GQE2bm4nYzUK1ymBStW4uQ63X8K9Prhwed+7JyPhYLHH1Mwiiy5IL1Z2LvBovO26I9vB6sjTB4d0UoG0kVFNw0kGB6+scQQVWSiGM4AZ94l1kwLT3oyh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961089; c=relaxed/simple; bh=lTx73lCS79Xjo09Xp4ZDnt5Zv6V/Rnu98oe02emVgy0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F3ruGJ6Qr+zITpOyHhUUn390xLfK7TAF7oQttXV/pizBHxMbFD7R6we86xC5Az0oITkthf5igfuZ6VdvcyBYm08ltNfKQm9InM1OsK84nwL/pqzR3iCbQO7i9zRb83OaGkAyiujZg9Pyh/pHRncP35x6jVSUMSchKryFXt46DC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BE+W/Frp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BE+W/Frp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE58EC4CEC3; Tue, 10 Sep 2024 09:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725961089; bh=lTx73lCS79Xjo09Xp4ZDnt5Zv6V/Rnu98oe02emVgy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BE+W/Frpu1AYSmsvQetmr3Doz/Tcqz6Uy1AN4vBQvdQdHqFOk5f+7YYXs742U3brv EGrB8VtAweh4df/PlmCMTdPHZwtp5V691hrPTfo+zlqbJkaR1VS90RRgumLbtA6nqe NCzm6viCqQ9/woft69koZloNdATI2k++xeh5F5ik= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jonas Gorski , Nikolay Aleksandrov , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 50/96] net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN Date: Tue, 10 Sep 2024 11:31:52 +0200 Message-ID: <20240910092543.721220384@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092541.383432924@linuxfoundation.org> References: <20240910092541.383432924@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jonas Gorski [ 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 Acked-by: Nikolay Aleksandrov Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20240903081958.29951-1-jonas.gorski@bisdn.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/bridge/br_fdb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; } -- 2.43.0