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 5FC2C21B191; Sat, 30 May 2026 18:21:57 +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=1780165318; cv=none; b=BPFAAxORymG++zSQt70xjZexsPz93qNRAhueT+tvo7ViHGj8PZJuoPK5kNlTd+YXK8oSaTVBIl+OYsvIai63JbSPxtuz6e+Ji1bNNnrwlfHjJWZwlkD4IbFacPz1P+3QkMBLhuquWMp1IqJhRUvVnUHnc2Dlu6en8RPlruu5tb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165318; c=relaxed/simple; bh=lxI7CoRkQo62UNSsW/qkvyoWp6+uI6ItuD6c06i+FEc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qh+ynRN16IrOEpfVwYk8f7p4gG14rxb9oqIU75r2EwlVUyBEoTTpIGLtJvjvgxqK1Qc7aZPbG7kXVCvsvlcdUh4oJ2WbOBxfk6cM6A6utf4tyaU1v1EVRyNvoKVqrz6XP4xOFGquwZgihQzZS5x3vnLzWCkZS+74ERLeZ2nAKCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=09pQXkg+; 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="09pQXkg+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5D2D1F00893; Sat, 30 May 2026 18:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780165317; bh=6KYmfIyG40u4lWDKa0D6cr7YYZIIUZb/MBE4SIwjY1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=09pQXkg+mDddRBaC+R9klli7ihZ8WBSHzOt0KGUcnCRYrfp+MEwptmSDlTNuzzJL/ PLUY6fZvv/nefl3aLcAIWhwarcIeu0Fryp5Deb+JRsY8jxqOp9fErgovUkCE2E1eZR XAHA7MIlBiX3Bq1ec7AKOg8fWycB4fC1iSFGISdg= 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 5.10 043/589] nfc: llcp: add missing return after LLCP_CLOSED checks Date: Sat, 30 May 2026 17:58:44 +0200 Message-ID: <20260530160225.721216792@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@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: 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 @@ -1098,6 +1098,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 */ @@ -1189,6 +1190,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) {