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 ECE864E56C9 for ; Thu, 3 Sep 2026 15:40:26 +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=1788450028; cv=none; b=CkgMgzR26TbIV5JokHCPFBOSu6bHTZ9i2aMSzHb7JBX+/cmGi9CvGRfosA9YUdGt43gyNkfxaYNOsFo8Y3V3yAfhaFsjVtA+LRnTDxdq5PuHBPPryRaJGWY4QmP+UOyEiAxy0HS8DObFDbWsMPmPWASQefHl1nXtedTfsAA18oM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788450028; c=relaxed/simple; bh=Vadlayd8t+w/tpAePwXsP0sdBs3Qf+2+LFNVcBk0fBk=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=apiO8kSI3Rl9UiC8arpahMckMR47o9pHNRr0i1070058xbm1PrSy7AgZvPured7qDyjoOihi4eN6AmRuxsbj1ExuPXkKkg2NTs6QVIxFZc7kY+6O27auaXj76BSTmQ9MjlTxUUGAm8KS9OVPBqFibko/WzL2cFI23+Zc49y8WqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eaSa0+Kb; 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="eaSa0+Kb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49BCD1F00A3A; Thu, 3 Sep 2026 15:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788450026; bh=nfhTIQL1xbQzBto7wcmpSO5b3zO7ifT8G8sbLPwUTgY=; h=Subject:To:Cc:From:Date; b=eaSa0+KbVlrixn7GsdvAR59UXDTVb/lyoM7gBjQH2AeBiB/lPjg6EaPWngXFLfboE kXRfsiTFX9Byz9On+lUjyta0XoSRUKbXh0qmn7MNVb79K6GX26iU1/45vbqFzVq00R 4Z2nfgnVGgx3kFPNwHO7OA0CJbHvq39J35C18Cog= Subject: FAILED: patch "[PATCH] net/smc: fix use-after-free in smc_rx_pipe_buf_release()" failed to apply to 5.10-stable tree To: hidayath@linux.ibm.com,horms@kernel.org,kuba@kernel.org,mjambigi@linux.ibm.com Cc: From: Date: Thu, 03 Sep 2026 17:18:45 +0200 Message-ID: <2026090345-helmet-chooser-2b86@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x c924884743e948e25625b7fbf3ee2a9325a204a7 # git commit -s git send-email --to '' --in-reply-to '2026090345-helmet-chooser-2b86@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From c924884743e948e25625b7fbf3ee2a9325a204a7 Mon Sep 17 00:00:00 2001 From: Hidayath Khan Date: Thu, 20 Aug 2026 09:46:42 +0200 Subject: [PATCH] net/smc: fix use-after-free in smc_rx_pipe_buf_release() smc_rx_splice() hands RMB pages to a pipe and takes a socket reference per entry so the smc_sock stays alive until the reader finishes. The connection does not: a concurrent close runs smc_conn_free(), which releases the receive buffer back to the link group pool. smc_rx_pipe_buf_release() tests sk_state before taking the socket lock. The state can change between the test and the lock, and smc_rx_update_cons() then dereferences conn->rmb_desc and walks conn->lgr, which smc_conn_free() has already released. On the is_reg_err path smcr_buf_unuse() frees the descriptor outright, so this is a use-after-free. Take the socket lock first and test conn->freed instead. smc_conn_free() sets that flag before releasing anything, and every caller holds the socket lock. The two paths exclude each other: either the pipe release runs first with everything valid, or it sees the flag and skips the update. Fixes: 9014db202cb7 ("smc: add support for splice()") Cc: stable@vger.kernel.org Reviewed-by: Mahanta Jambigi Signed-off-by: Hidayath Khan Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260820074642.966856-3-hidayath@linux.ibm.com Signed-off-by: Jakub Kicinski diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c index 5c9e4d8b57de..197fddc6271f 100644 --- a/net/smc/smc_rx.c +++ b/net/smc/smc_rx.c @@ -115,16 +115,15 @@ static void smc_rx_pipe_buf_release(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { struct smc_spd_priv *priv = (struct smc_spd_priv *)buf->private; + struct smc_connection *conn = &priv->smc->conn; struct smc_sock *smc = priv->smc; - struct smc_connection *conn; struct sock *sk = &smc->sk; - if (sk->sk_state == SMC_CLOSED || - sk->sk_state == SMC_PEERFINCLOSEWAIT || - sk->sk_state == SMC_APPFINCLOSEWAIT) - goto out; - conn = &smc->conn; lock_sock(sk); + if (conn->freed) { + release_sock(sk); + goto out; + } smc_rx_update_cons(smc, priv->len); release_sock(sk); if (atomic_sub_and_test(priv->len, &conn->splice_pending))