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 3E622415F0C; Tue, 21 Jul 2026 22:54:29 +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=1784674470; cv=none; b=d0SI+VNo8v3HoBQ/CDqGTj0RWUO4YY7JDHgEY9bCkpPREIiWVWI4m1irTKRYuQW13RlaQlcuMjo5d9oOZZocEJDx9f2G5B6x6n59v/9McNhfkxeo68c91jMFRRASfMY5wjdRH+QJAzzx/UlbAlPOlUKA26aAOLmBG14zkwO6ZSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674470; c=relaxed/simple; bh=hYVPQmRT/vwJFkFf03KrH5BwtxivW26i62sV5M+yjfA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kNVsxk2ySSQudrhA1KY7D1hoSmETXnJzm4YNJnT3BoT2rGpc7geRoeuemiUknigNDyOu7Q60m+QHY4kjn6I+lPEMnsri7mLrWjyyhJW0zJIl0rWy3LHk3DpbPuRfjUNoWF2Dbb6vAOR2kQphf6VgKNrf50+rpFG0s5RrDUbKA0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KcIB7ufV; 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="KcIB7ufV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4FEA1F000E9; Tue, 21 Jul 2026 22:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674469; bh=PXwUPGvXw+bLgb0nWE6CLZbc2SuEh4UqYfl9muuVHmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KcIB7ufVQyqqzQgG4+XkgsGPlJtFiHRcJm7Ryw8IVre+xUUM/WS3C0xsXMa0TyveQ 9gGfj5ZSgsyNLhhzwbXXMOROaAKJgUWn9JQkngG2tLqPOhvJ7zfZ2UZEK5X2+7Orwu Dat4x30QR8PrDettY4zssp/8SiEhZuG1d5s+stXM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shuangpeng Bai , Paolo Abeni Subject: [PATCH 5.10 554/699] llc: fix SAP refcount leak in llc_ui_autobind() Date: Tue, 21 Jul 2026 17:25:13 +0200 Message-ID: <20260721152408.203080342@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuangpeng Bai commit 660667cd406648bbaffbd5c0d897c2263a852f11 upstream. llc_ui_autobind() opens a SAP after choosing a dynamic LSAP. llc_sap_open() returns a reference owned by the caller, and llc_sap_add_socket() takes a second reference for the socket's membership in the SAP hash tables. llc_ui_bind() drops the caller's reference after adding the socket, but llc_ui_autobind() keeps it. When the socket is closed, llc_sap_remove_socket() releases only the socket reference, leaving the SAP on llc_sap_list with sk_count == 0. This is user-visible because repeated autobind and close cycles can consume all dynamic SAP values and make later autobinds fail with -EUSERS. Drop the caller's reference after a successful autobind, matching llc_ui_bind()'s ownership model. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Shuangpeng Bai Link: https://patch.msgid.link/20260630194856.1036497-1-shuangpeng.kernel@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/llc/af_llc.c | 1 + 1 file changed, 1 insertion(+) --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -317,6 +317,7 @@ static int llc_ui_autobind(struct socket /* assign new connection to its SAP */ llc_sap_add_socket(sap, sk); sock_reset_flag(sk, SOCK_ZAPPED); + llc_sap_put(sap); rc = 0; out: dev_put(dev);