mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Namjae Jeon <linkinjeon@kernel.org>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>,
	brauner@kernel.org, dchinner@redhat.com, ddiss@suse.de,
	set_pte_at@outlook.com, cc85nod@gmail.com
Subject: [PATCH AUTOSEL 5.15 06/13] ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack()
Date: Mon, 18 Dec 2023 07:45:39 -0500	[thread overview]
Message-ID: <20231218124557.1380724-6-sashal@kernel.org> (raw)
In-Reply-To: <20231218124557.1380724-1-sashal@kernel.org>

From: Namjae Jeon <linkinjeon@kernel.org>

[ Upstream commit 658609d9a618d8881bf549b5893c0ba8fcff4526 ]

opinfo_put() could be called twice on error of smb21_lease_break_ack().
It will cause UAF issue if opinfo is referenced on other places.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ksmbd/smb2pdu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 656c627d1bdf7..e750f942d2d47 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -8200,6 +8200,11 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
 			    le32_to_cpu(req->LeaseState));
 	}
 
+	if (ret < 0) {
+		rsp->hdr.Status = err;
+		goto err_out;
+	}
+
 	lease_state = lease->state;
 	opinfo->op_state = OPLOCK_STATE_NONE;
 	wake_up_interruptible_all(&opinfo->oplock_q);
@@ -8207,11 +8212,6 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
 	wake_up_interruptible_all(&opinfo->oplock_brk);
 	opinfo_put(opinfo);
 
-	if (ret < 0) {
-		rsp->hdr.Status = err;
-		goto err_out;
-	}
-
 	rsp->StructureSize = cpu_to_le16(36);
 	rsp->Reserved = 0;
 	rsp->Flags = 0;
-- 
2.43.0


  parent reply	other threads:[~2023-12-18 12:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 12:45 [PATCH AUTOSEL 5.15 01/13] clk: rockchip: rk3128: Fix HCLK_OTG gate register Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 02/13] jbd2: correct the printing of write_flags in jbd2_write_superblock() Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 03/13] drm/crtc: Fix uninit-value bug in drm_mode_setcrtc Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 04/13] neighbour: Don't let neigh_forced_gc() disable preemption for long Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 05/13] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events Sasha Levin
2023-12-18 12:45 ` Sasha Levin [this message]
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 07/13] jbd2: fix soft lockup in journal_finish_inode_data_buffers() Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 08/13] tracing: Have large events show up as '[LINE TOO BIG]' instead of nothing Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 09/13] tracing: Add size check when printing trace_marker output Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 10/13] stmmac: dwmac-loongson: drop useless check for compatible fallback Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 11/13] MIPS: dts: loongson: drop incorrect dwmac fallback compatible Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 12/13] tracing: Fix uaf issue when open the hist or hist_debug file Sasha Levin
2023-12-18 12:45 ` [PATCH AUTOSEL 5.15 13/13] ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231218124557.1380724-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cc85nod@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=ddiss@suse.de \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=set_pte_at@outlook.com \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®