From patchwork Thu Feb 1 11:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 18628 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 036D184261 for ; Thu, 1 Feb 2024 12:02:38 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1706785358; b=WTLigrC9IvFBSWhu3NRisVYb1ku9RXCwM2vb8afjNKHLoiA9USWwP0sKBU4RN8rq0Eboq v7rKBqscyfzdb+e7R4x9D3l6ZRjTJ2/PR4tmxjZA7ZdZHcEYgb5nTMcUUNT2AVt3hYltyaS 1RyC93iuIRCtCMnoBgmdbXrHAEghwB8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785358; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=O1H7X+oidt2pV6paErvMp7vsTUclC2MyD3Z8kBbr3gs=; b=1nZPxOIaq2u/7FKmRtO69kkFLODyRxTYd2tUOMdKjzPPYhrunv7M6/j4akZ69utOhuubH GjaVDbJcyCE9oKpIGfQCqP6oL9lHPXBX7rnIyIeahVJIxSTQq02jdVfQxVRmpJXn/Qqx20Z 81hjA2q5+P1Ha5oo741KWc0ubkULnU4= ARC-Authentication-Results: i=2; open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Authentication-Results: open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [IPv6:2a01:4f8:c17:e8c0::1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id CD95F80B42 for ; Thu, 1 Feb 2024 12:01:16 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O1H7X+oidt2pV6paErvMp7vsTUclC2MyD3Z8kBbr3gs=; b=KRC0s2vBPwcJfqEfFR8f6x4ePhXtzqQ+C7YrF2cgoPaI964IDNdLL84IUvmgxBzPkhbd09 vgA0aN0jXsbA298qZuGCptZnLolxEGjo+EFxVWLnQTEyWI1m1GqafO0agCHsmOgvD2C5BW Jccp2vpROjmuAivb6MvFyedwaQozw0I= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=none; spf=pass (diktynna.open-mesh.org: domain of sw@simonwunderlich.de designates 2a01:4f8:c17:e8c0::1 as permitted sender) smtp.mailfrom=sw@simonwunderlich.de; dmarc=pass (policy=none) header.from=simonwunderlich.de ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1706785276; a=rsa-sha256; cv=none; b=uJ4bECqMSOreeicR7pOfzByQwnPOO2XesaClLrXpkjvuco9J4A9NuVj4hLTEF2hNzP84T+ ZB64QGFIQNcFjR3kz7aNeuEnRIBGVqE5QV+2jAOrMMq5QRtA9oOlp4MdbNw6VhQJSWr+WW TvMplQ/b0x5qwgGjGP1DVFS8Qh3IPdA= Received: from kero.packetmixer.de (p200300c59712C7d8D89318FB9D63B559.dip0.t-ipconnect.de [IPv6:2003:c5:9712:c7d8:d893:18fb:9d63:b559]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.simonwunderlich.de (Postfix) with ESMTPSA id 7A811FA9A1; Thu, 1 Feb 2024 12:01:15 +0100 (CET) From: Simon Wunderlich To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, =?utf-8?q?Linus?= =?utf-8?q?_L=C3=BCssing?= , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 1/2] batman-adv: mcast: fix mcast packet type counter on timeouted nodes Date: Thu, 1 Feb 2024 12:01:09 +0100 Message-Id: <20240201110110.29129-2-sw@simonwunderlich.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201110110.29129-1-sw@simonwunderlich.de> References: <20240201110110.29129-1-sw@simonwunderlich.de> MIME-Version: 1.0 Message-ID-Hash: FZ7UU2F7AA5QRMQSZVMHOLLV3K625VJD X-Message-ID-Hash: FZ7UU2F7AA5QRMQSZVMHOLLV3K625VJD X-MailFrom: sw@simonwunderlich.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Linus Lüssing When a node which does not have the new batman-adv multicast packet type capability vanishes then the according, global counter erroneously would not be reduced in response on other nodes. Which in turn leads to the mesh never switching back to sending with the new multicast packet type. Fix this by reducing the according counter when such a node times out. Fixes: 90039133221e ("batman-adv: mcast: implement multicast packet generation") Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/multicast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index d982daea8329..b4f8b4af1722 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@ -2198,6 +2198,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig) BATADV_MCAST_WANT_NO_RTR4); batadv_mcast_want_rtr6_update(bat_priv, orig, BATADV_MCAST_WANT_NO_RTR6); + batadv_mcast_have_mc_ptype_update(bat_priv, orig, + BATADV_MCAST_HAVE_MC_PTYPE_CAPA); spin_unlock_bh(&orig->mcast_handler_lock); } From patchwork Thu Feb 1 11:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 18629 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 57B32841FF for ; Thu, 1 Feb 2024 12:03:20 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1706785400; b=gTeWB7KlqP85LAE86hxgSBOqmE6DyE52gloA9FUWYsLCBnra+3XAB2FXF+t00tMeKG1Ci eDYW29k9z/GJxnUzaQecgBDcCWAM2cJiGEssQpaGpJkw2Bu4iI0TfT4i3qAV2gVXhtBtb4c +JXdMWvAIxgh406osouy8wj0I6Bc0d8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785400; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=LpxrqSXgvA8rC9xiZHYB/eBo5c3KrDE+RHmhCsQBD8E=; b=dgvUx52giHzQsjwVbk57uBdtNl1z+xh/T4S+I2noZq5yN0S7kmEajJKiDHgS7M6riAEHE WbEqIlyOixX2WHheCoeJkW0jeMumSh4qdgS/lOvHpDbF2TwS8R/H14jFXIjzvDkIkwekb2Z n2JCWxjEz59hgW19MvmeybR7pqY3DW4= ARC-Authentication-Results: i=2; open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Authentication-Results: open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) by diktynna.open-mesh.org (Postfix) with ESMTPS id B701982C2B for ; Thu, 1 Feb 2024 12:01:17 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LpxrqSXgvA8rC9xiZHYB/eBo5c3KrDE+RHmhCsQBD8E=; b=1g6TdbxMMRFDO9ZXl9gEfWTAal2yH1jcNHBCFduGSozGycca6pR6ap42IN1hvwJcjGdn7e x3mVlq5Rz6c0Iwme/2KyNyz9NOyaWjDS5+SYcOISZ7y/ylgEh4mqmChRjjunA6lyhEvlAS cTInBdJmQsYqlQkY+C2rt1D1TNgZiy4= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=none; spf=pass (diktynna.open-mesh.org: domain of sw@simonwunderlich.de designates 23.88.38.48 as permitted sender) smtp.mailfrom=sw@simonwunderlich.de; dmarc=pass (policy=none) header.from=simonwunderlich.de ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1706785277; a=rsa-sha256; cv=none; b=Hf4IeIVySqxk77LcAYRfD5CRSd18x6XAyc5WHW6G6Nx/ifsAv8cLt0IQx4/CEsUBHNIrgb 2xmca7ZmnxzQ9QAlX6IygaHKeHRhbhsev00rrR6ZcXOxNbISUi/HkvyXeKeDMBKGFP+YaM 7k9Ghud1Qc80A4uAGnG8XofD17vP4bE= Received: from kero.packetmixer.de (p200300C59712C7d8D89318FB9d63b559.dip0.t-ipconnect.de [IPv6:2003:c5:9712:c7d8:d893:18fb:9d63:b559]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.simonwunderlich.de (Postfix) with ESMTPSA id E868FFA9A3; Thu, 1 Feb 2024 12:01:16 +0100 (CET) From: Simon Wunderlich To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, =?utf-8?q?Linus?= =?utf-8?q?_L=C3=BCssing?= , syzbot+ebe64cc5950868e77358@syzkaller.appspotmail.com, Sven Eckelmann , Simon Wunderlich Subject: [PATCH 2/2] batman-adv: mcast: fix memory leak on deleting a batman-adv interface Date: Thu, 1 Feb 2024 12:01:10 +0100 Message-Id: <20240201110110.29129-3-sw@simonwunderlich.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201110110.29129-1-sw@simonwunderlich.de> References: <20240201110110.29129-1-sw@simonwunderlich.de> MIME-Version: 1.0 Message-ID-Hash: 4U6CXUHPMYBZ3VRGARNAVURAKDHDMRXH X-Message-ID-Hash: 4U6CXUHPMYBZ3VRGARNAVURAKDHDMRXH X-MailFrom: sw@simonwunderlich.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Linus Lüssing The batman-adv multicast tracker TVLV handler is registered for the new batman-adv multicast packet type upon creating a batman-adv interface, but not unregistered again upon the interface's deletion, leading to a memory leak. Fix this memory leak by calling the according TVLV handler unregister routine for the multicast tracker TVLV upon batman-adv interface deletion. Fixes: 07afe1ba288c ("batman-adv: mcast: implement multicast packet reception and forwarding") Reported-and-tested-by: syzbot+ebe64cc5950868e77358@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/000000000000beadc4060f0cbc23@google.com/ Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/multicast.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index b4f8b4af1722..14088c4ff2f6 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@ -2175,6 +2175,7 @@ void batadv_mcast_free(struct batadv_priv *bat_priv) cancel_delayed_work_sync(&bat_priv->mcast.work); batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2); + batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1); batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2); /* safely calling outside of worker, as worker was canceled above */