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 594E9330675; Mon, 20 Apr 2026 15:54:21 +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=1776700461; cv=none; b=hk2IrUGMpjqwFACsJrJg55P6CR/vOUoedZNIiUsa6CD/qjIGBGVdXxRr6j8Xh7sVtDetRymg/skHPNO8Bi2f2uNuR1oLQavfj+AlsSuajAzMno+Tb+wEYSP+dTP1A3LOilIwPb1CqcP7wdX6+xEo6mZRgMJgiMaOZppcvgWCgco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700461; c=relaxed/simple; bh=wPgZ2ttpk+iKS4VVc8ezm8wm+po4uIJbiLokhqu//pk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WGoH74kSutaAU/8a3Y7R7+0fpryGq3kD2lKaJr29epLdm6qAbcKXM1ealQP+DiMbTHYwdGfyE4a9IM1Sw190w6eancAN29CIfuNSNBb6movH1tApGWp8I9hFXkUfBGQZw8iaTNNvXsxnlf73GNQsYYiQk00NQMgz7g3hJ2EdkpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Kde5TszD; 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="Kde5TszD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A39D9C19425; Mon, 20 Apr 2026 15:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776700461; bh=wPgZ2ttpk+iKS4VVc8ezm8wm+po4uIJbiLokhqu//pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kde5TszDqK1GhSya5CzRaSOVs7VWN6LKmiFDv/kvcE4tBdurlK4lRQItVuI7x2eDm HeqqUsEq9SG76koK1S0eF1dvNzyespHCPBYnJKMfHhHSg678zzIQd0Ip4CpK3OvROe jzyfgBOz9Z1r7N3b43cJ48FCdP8fbAPIidhw0X1w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Junxi Qian , Eric Dumazet , Jakub Kicinski Subject: [PATCH 6.19 140/220] nfc: llcp: add missing return after LLCP_CLOSED checks Date: Mon, 20 Apr 2026 17:41:21 +0200 Message-ID: <20260420153939.064590552@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153934.013228280@linuxfoundation.org> References: <20260420153934.013228280@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Junxi Qian commit 2b5dd4632966c39da6ba74dbc8689b309065e82c upstream. In nfc_llcp_recv_hdlc() and nfc_llcp_recv_disc(), when the socket state is LLCP_CLOSED, the code correctly calls release_sock() and nfc_llcp_sock_put() but fails to return. Execution falls through to the remainder of the function, which calls release_sock() and nfc_llcp_sock_put() again. This results in a double release_sock() and a refcount underflow via double nfc_llcp_sock_put(), leading to a use-after-free. Add the missing return statements after the LLCP_CLOSED branches in both functions to prevent the fall-through. Fixes: d646960f7986 ("NFC: Initial LLCP support") Signed-off-by: Junxi Qian Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20260408081006.3723-1-qjx1298677004@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/nfc/llcp_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/nfc/llcp_core.c +++ b/net/nfc/llcp_core.c @@ -1091,6 +1091,7 @@ static void nfc_llcp_recv_hdlc(struct nf if (sk->sk_state == LLCP_CLOSED) { release_sock(sk); nfc_llcp_sock_put(llcp_sock); + return; } /* Pass the payload upstream */ @@ -1182,6 +1183,7 @@ static void nfc_llcp_recv_disc(struct nf if (sk->sk_state == LLCP_CLOSED) { release_sock(sk); nfc_llcp_sock_put(llcp_sock); + return; } if (sk->sk_state == LLCP_CONNECTED) {