Skip to content

Commit ec28c35

Browse files
ChenXiaoSonggregkh
authored andcommitted
smb/server: fix potential null-ptr-deref of lease_ctx_info in smb2_open()
commit 4e8771a3666c8f216eefd6bd2fd50121c6c437db upstream. null-ptr-deref will occur when (req_op_level == SMB2_OPLOCK_LEVEL_LEASE) and parse_lease_state() return NULL. Fix this by check if 'lease_ctx_info' is NULL. Additionally, remove the redundant parentheses in parse_durable_handle_context(). Signed-off-by: ChenXiaoSong <[email protected]> Signed-off-by: Steve French <[email protected]> [ Drop the parentheses clean-up since the parentheses was introduced by c8efcc786146 ("ksmbd: add support for durable handles v1/v2") in v6.9 Minor context change fixed ] Signed-off-by: Jianqi Ren <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f27602b commit ec28c35

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/smb/server/oplock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
15151515
* @open_req: buffer containing smb2 file open(create) request
15161516
* @is_dir: whether leasing file is directory
15171517
*
1518-
* Return: oplock state, -ENOENT if create lease context not found
1518+
* Return: allocated lease context object on success, otherwise NULL
15191519
*/
15201520
struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
15211521
{

fs/smb/server/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3243,7 +3243,7 @@ int smb2_open(struct ksmbd_work *work)
32433243
goto err_out1;
32443244
}
32453245
} else {
3246-
if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE) {
3246+
if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE && lc) {
32473247
/*
32483248
* Compare parent lease using parent key. If there is no
32493249
* a lease that has same parent key, Send lease break

0 commit comments

Comments
 (0)