diff mbox series

ksmbd: fix possible null-deref in smb_lazy_parent_lease_break_close

Message ID 20240313141138.3058492-1-mmakassikis@freebox.fr
State New
Headers show
Series ksmbd: fix possible null-deref in smb_lazy_parent_lease_break_close | expand

Commit Message

Marios Makassikis March 13, 2024, 2:11 p.m. UTC
rcu_dereference can return NULL, so make sure we check against that.

Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
---
 fs/smb/server/oplock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Namjae Jeon March 14, 2024, 2:46 a.m. UTC | #1
2024년 3월 13일 (수) 오후 11:12, Marios Makassikis <mmakassikis@freebox.fr>님이 작성:
>
> rcu_dereference can return NULL, so make sure we check against that.
>
> Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Applied it to #ksmbd-for-next-next.
Thanks for your patch!
diff mbox series

Patch

diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
index 53dfaac425c6..7daa7909801f 100644
--- a/fs/smb/server/oplock.c
+++ b/fs/smb/server/oplock.c
@@ -1142,7 +1142,7 @@  void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
 	opinfo = rcu_dereference(fp->f_opinfo);
 	rcu_read_unlock();
 
-	if (!opinfo->is_lease || opinfo->o_lease->version != 2)
+	if (!opinfo || !opinfo->is_lease || opinfo->o_lease->version != 2)
 		return;
 
 	p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);