From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9C4474FC8E9; Tue, 13 Oct 2026 12:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895253; cv=none; b=myRS9Z0SoiWdvHoa13hlOWMceAfndJRVZ9KcrDEHFLNaB99+W0m1ELBg42aYtbfEL1F7Zl4fOPQtR8v3/t0lpgFKHu4X0DLixgRLR3BgnxbIJPjW5pLRwKfQncV4SlGYoliXgnJlPn6CHkX9x4RSgsjSvwc+xXNl9BT1/dZ7Sj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895253; c=relaxed/simple; bh=ejJOCnlu6yRYsPSNLOxTtui/aIfs2xt5jyLpH6rs+Sw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GYkcuyem2znuDSegVUkz5KPQ0S3v0uL1AXL0I6US0x8y2PVOf9FDj0k4bKxR2DSquYTZX+32IXq+QAg5XR9oTX3hPe1kwkxBmTt+XhxJeCOXUea5OM8fXTS24TokJ/rz1EUxxnFgSwe/jUVQwEPviv+pgf3z9MB0Jsp3eE9YXVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V3HsCc6d; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V3HsCc6d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE34C1F00893; Tue, 13 Oct 2026 12:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895252; bh=uiaCPLWbN6wgR8WGIaetx/NpuK8P2FQuvHmAOZtSJzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=V3HsCc6dOS4VTAWjB3AAeQ6onb0UBOeAksiJmzqe2ucXpoxdXc/n5F8Pn12H7GWkJ Evm1afbWlYqgF81iiQmg0R+81+MDXvDKebvLKoxz344dvka2NfQ2ntHZFOAN0Fvlah lQtsM3yhpWhJ2XPny7BbLNfjiDe0Swi5i58Siw3c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Johannes Berg Subject: [PATCH 6.12 211/497] wifi: mac80211: release mesh path quota on failed additions Date: Tue, 13 Oct 2026 13:36:18 +0200 Message-ID: <20261013112912.901445401@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Li commit 7325a44474f20c1393a1c114c6811abce6ddfaf4 upstream. Repeated failed or duplicate mesh path additions can exhaust MESH_MAX_MPATHS while the path table holds fewer paths, which stops new paths to reachable destinations from being created. mesh_path_add() reserves a slot before allocating and inserting a path. If allocation fails, the function returns without releasing the slot. If the rhashtable insertion reports an error or an existing destination, the function discards its candidate but retains the reservation. No new path is installed in any of these cases. Release the reservation whenever the candidate is not installed. Fixes: ae76eef027f7 ("mac80211: return new mpath from mesh_path_add()") Fixes: 60854fd94573 ("mac80211: mesh: convert path table to rhashtable") Cc: stable@vger.kernel.org Assisted-by: LLM sparse kasan Signed-off-by: Zhao Li Link: https://patch.msgid.link/20260916113649.28315-2-enderaoelyther@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/mesh_pathtbl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -694,8 +694,10 @@ struct mesh_path *mesh_path_add(struct i return ERR_PTR(-ENOSPC); new_mpath = mesh_path_new(sdata, dst, GFP_ATOMIC); - if (!new_mpath) + if (!new_mpath) { + atomic_dec(&sdata->u.mesh.mpaths); return ERR_PTR(-ENOMEM); + } tbl = &sdata->u.mesh.mesh_paths; spin_lock_bh(&tbl->walk_lock); @@ -708,6 +710,7 @@ struct mesh_path *mesh_path_add(struct i if (mpath) { kfree(new_mpath); + atomic_dec(&sdata->u.mesh.mpaths); if (IS_ERR(mpath)) return mpath;