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 E7FA82D838E; Fri, 9 Oct 2026 14:48:28 +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=1791557309; cv=none; b=YGtcfhAhxkFzhs9Cgat2/KkXucNW+X8o4dXf7EnWUF5PyV2I5X5TFdbgVFpMd2MarPR6hqdTMyJ8f2Fii16j8suVtozt2KyXDX+JKinlyTNJKaA92bmpb+lm0S40eY1pEotI2QEP7/UNflSb5VE8KD2yt2yB0vQDYnxy6cGk8BU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557309; c=relaxed/simple; bh=3MYLUvO3OXkezZSw1j4fpVtDz9UzKfURRZ9y0uXxdys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DTjJ6mHgo8zxafg3RV6qRK9Q5DJuNK8SRibNWzwlZQv/PiioRcWQsPGdwIOJE7cazuK6E1d4XZ4qvrLINYNxHHY2dVjpj/spryXyiOXL2Sqy38bD89wudqmdZalvCjTsLfguzdDMWTom7eD6y4heFlg8OO3Oax6wacX0odwONzA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bZdQXyxO; 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="bZdQXyxO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 514101F000FF; Fri, 9 Oct 2026 14:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557308; bh=aRY0UOdUa65CfZdWogTIYO8YmX0Be1Thr6U783H7WkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bZdQXyxOlX4Ch6sbYr1adYfWc9b068x8P8z6wCwzmu1gLZsEWQCPrFJMHdV1FY0iN mjkZOfmAjGGSv/ol82/HFPpcBUKXEtEJSgeo6Ucex1ZvP9VXEykMjyOgaT1sd/VMtG kYVdRKsUTTfd+zc8mj75ArJ06DqHo2CVr7qm6++o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Johannes Berg Subject: [PATCH 7.2 335/428] wifi: mac80211: release mesh path quota on failed additions Date: Fri, 9 Oct 2026 16:11:12 +0200 Message-ID: <20261009140953.503294838@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@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 7.2-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;