Skip to content

Commit 609f79e

Browse files
ChenXiaoSongvijay-suman
authored andcommitted
smb/server: fix potential null-ptr-deref of lease_ctx_info in smb2_open()
commit 4e8771a 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 c8efcc7 ("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]> (cherry picked from commit 878f32878351104448b86ef5b85d1f8ed6f599fb) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent c14a602 commit 609f79e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/ksmbd/oplock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
14981498
* @open_req: buffer containing smb2 file open(create) request
14991499
* @is_dir: whether leasing file is directory
15001500
*
1501-
* Return: oplock state, -ENOENT if create lease context not found
1501+
* Return: allocated lease context object on success, otherwise NULL
15021502
*/
15031503
struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
15041504
{

fs/ksmbd/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3230,7 +3230,7 @@ int smb2_open(struct ksmbd_work *work)
32303230
goto err_out1;
32313231
}
32323232
} else {
3233-
if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE) {
3233+
if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE && lc) {
32343234
/*
32353235
* Compare parent lease using parent key. If there is no
32363236
* a lease that has same parent key, Send lease break

0 commit comments

Comments
 (0)