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 7E8722F25E4; Sat, 30 May 2026 16:28:05 +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=1780158486; cv=none; b=pJoX91oBILoeuXltEwFqa3UJlLNNgkNe7hyU1Oepn/axHQVwfEWlDwbimgPmp0Lk6luNyqUZOkHnGOQyB+ZpcvMBZfpzxKo18OfvKa6/EVX2aaA7dDc6UpW2DFBw3E16JxuOFTjRSGHCEuXwneq6ivvjtY8eHjdKb+SsXkaa5t4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780158486; c=relaxed/simple; bh=Dh6T5WauCBnX+qGQmLetYs1CIUnLW61n3noDeBPJW/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ARMneLU68RjrC4sI7YpfI6Rbj0bWAWsVu02cINp4se7++yJzA3MWaTYEP3BR3YDhdwdo+0ME8vqwJtrH0fKyyRZevaQ0gQ8cOQTm6+yd979X07uU4d9LSzE2wA3CV6NUfogTQ5iAsqjPF0OsI3uZVAo1w3Xjk2y0BoQLCZjBf3s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=d5SDGoD0; 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="d5SDGoD0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C97A1F00893; Sat, 30 May 2026 16:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780158485; bh=ENcdAn1Sml6T/miJKRtkTuFuQpv9YYTgOrUC4cNx6Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=d5SDGoD0HcEm831LkUI2GdsC1w3+hKquceGQYQ6p4TTgpsxrp4hRtLQzwmVS9vVk1 1FOCUoJOBshy5TLDix4n0rT214CiXkrGNltRA8rl7SAKNnp+x8OsM88I3ke99dlGVy Wx4eqklKTfzWE34J8kaeYD64HfkyiqcBIaXRECjQ= 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.1 056/969] nfc: llcp: add missing return after LLCP_CLOSED checks Date: Sat, 30 May 2026 17:53:00 +0200 Message-ID: <20260530160301.937897320@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@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.1-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 @@ -1089,6 +1089,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 */ @@ -1180,6 +1181,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) {