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 ED7E8518145 for ; Tue, 29 Sep 2026 11:51:06 +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=1790682668; cv=none; b=iuA8sCWFjlEEpXRDN8I4LiwI+Pe4lxeqeus7kPYTezdzGzFC/QYfOlkHxIHwsHpnFsbMpd+1dsCWsGoODKVx+YIcZ9Up3U35wl+hUKv0Y0dh477ZASd5/65wr8VdFgyn7j2ojULoqLeDN99LOsC8fV3wHgLRcxQK3PWabdwQsAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790682668; c=relaxed/simple; bh=exwC11mtqtOanG5iElExuAMoJ5GmvF2ETFmwzdm0fQo=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=cEfonvDFRgabr+Se1Vq84jp5oRKOgWexTdxUGM9rbBg3r5+b1p7JPrFahrtZdcyaWa8Pi4k1k6pIalgNTMg+4A/uBZ+QQrjshFBu8wectCv/y89XzP/N8+IqxVB/uekLduVIcnzWpm6mhQYKwEahEIhmpbEq0x6Ga3r/xCazTQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LBmeFyQt; 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="LBmeFyQt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5552F1F000FF; Tue, 29 Sep 2026 11:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790682666; bh=NvypzhvvnEwMmtDbkx5cuhxNw5488QE5dTbjDxMKrwg=; h=Subject:To:Cc:From:Date; b=LBmeFyQtAwRUEiYJonbbJaI72EpqVMQWhLuYITZ/512NqgzN+OxdX0lzcrVV0xUtH 35DUP4xV1YemVvDiLG7X3yPQZLKwKyKd3htCKCD0iWhVjpDt+jmMtIu9Ddq9EkJL+/ jreKahAWvJZl5kRJCAPvc5m+LkVFNZ25Y+lihBdA= Subject: FAILED: patch "[PATCH] smb: client: close handle after create-context parsing" failed to apply to 6.6-stable tree To: zihanx@nebusec.ai,pc@manguebit.org,root@tr0jan.top,sorenson@redhat.com,vega@nebusec.ai Cc: From: Date: Tue, 29 Sep 2026 13:50:45 +0200 Message-ID: <2026092945-chowder-rearview-c340@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 6.6-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-6.6.y git checkout FETCH_HEAD git cherry-pick -x 566820af017e81497fb5e9d3ad6e7ffe2828bc8b # git commit -s git send-email --to '' --in-reply-to '2026092945-chowder-rearview-c340@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 566820af017e81497fb5e9d3ad6e7ffe2828bc8b Mon Sep 17 00:00:00 2001 From: Zihan Xi Date: Wed, 16 Sep 2026 15:29:26 +0000 Subject: [PATCH] smb: client: close handle after create-context parsing failure SMB2_open() accounts a successful CREATE response as a remote open before parsing its create contexts. If smb2_parse_contexts() rejects malformed context data, SMB2_open() returns without closing the handle, leaving the server-side handle open and num_remote_opens elevated. Close the handle after a post-CREATE context parsing failure so the error path releases the remote resource and balances the open count. Fixes: af1689a9b770 ("smb: client: fix potential OOBs in smb2_parse_contexts()") Cc: stable@vger.kernel.org Reported-by: Vega Assisted-by: LLM Co-developed-by: Luxing Yin Signed-off-by: Luxing Yin Signed-off-by: Zihan Xi Tested-by: Frank Sorenson Signed-off-by: Paulo Alcantara diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 538d708b0404..3d7ead36d1a0 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -3416,6 +3416,9 @@ replay_again: rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch, oparms->fid->lease_key, oplock, file_info, posix); + if (rc) + SMB2_close(xid, tcon, oparms->fid->persistent_fid, + oparms->fid->volatile_fid); trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid, oparms->create_options, oparms->desired_access,