Skip to content

Commit df60cee

Browse files
committed
Merge tag '6.7-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd
Pull smb server fixes from Steve French: - Memory leak fix - Fix possible deadlock in open - Multiple SMB3 leasing (caching) fixes including: - incorrect open count (found via xfstest generic/002 with leases) - lease breaking incorrect serialization - lease break error handling fix - fix sending async response when lease pending - Async command fix * tag '6.7-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd: ksmbd: don't update ->op_state as OPLOCK_STATE_NONE on error ksmbd: move setting SMB2_FLAGS_ASYNC_COMMAND and AsyncId ksmbd: release interim response after sending status pending response ksmbd: move oplock handling after unlock parent dir ksmbd: separately allocate ci per dentry ksmbd: fix possible deadlock in smb2_open ksmbd: prevent memory leak on error return
2 parents d095b18 + cd80ce7 commit df60cee

9 files changed

Lines changed: 162 additions & 141 deletions

File tree

fs/smb/server/ksmbd_work.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ void ksmbd_free_work_struct(struct ksmbd_work *work)
5656
kfree(work->tr_buf);
5757
kvfree(work->request_buf);
5858
kfree(work->iov);
59+
if (!list_empty(&work->interim_entry))
60+
list_del(&work->interim_entry);
61+
5962
if (work->async_id)
6063
ksmbd_release_id(&work->conn->async_ida, work->async_id);
6164
kmem_cache_free(work_cache, work);
@@ -106,7 +109,7 @@ static inline void __ksmbd_iov_pin(struct ksmbd_work *work, void *ib,
106109
static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len,
107110
void *aux_buf, unsigned int aux_size)
108111
{
109-
struct aux_read *ar;
112+
struct aux_read *ar = NULL;
110113
int need_iov_cnt = 1;
111114

112115
if (aux_size) {
@@ -123,8 +126,11 @@ static int __ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len,
123126
new = krealloc(work->iov,
124127
sizeof(struct kvec) * work->iov_alloc_cnt,
125128
GFP_KERNEL | __GFP_ZERO);
126-
if (!new)
129+
if (!new) {
130+
kfree(ar);
131+
work->iov_alloc_cnt -= 4;
127132
return -ENOMEM;
133+
}
128134
work->iov = new;
129135
}
130136

fs/smb/server/oplock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ static int smb2_lease_break_noti(struct oplock_info *opinfo)
833833
interim_entry);
834834
setup_async_work(in_work, NULL, NULL);
835835
smb2_send_interim_resp(in_work, STATUS_PENDING);
836-
list_del(&in_work->interim_entry);
836+
list_del_init(&in_work->interim_entry);
837+
release_async_work(in_work);
837838
}
838839
INIT_WORK(&work->work, __smb2_lease_break_noti);
839840
ksmbd_queue_work(work);

0 commit comments

Comments
 (0)