Skip to content

Commit e3a97ab

Browse files
committed
Merge tag 'v6.19-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd
Pull smb server fixes from Steve French: - Fix memory leak - Fix two refcount leaks - Fix error path in create_smb2_pipe * tag 'v6.19-rc3-smb3-server-fixes' of git://git.samba.org/ksmbd: smb/server: fix refcount leak in smb2_open() smb/server: fix refcount leak in parse_durable_handle_context() smb/server: call ksmbd_session_rpc_close() on error path in create_smb2_pipe() ksmbd: Fix memory leak in get_file_all_info()
2 parents 047b4e7 + f416c55 commit e3a97ab

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

fs/smb/server/smb2pdu.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)
22812281
{
22822282
struct smb2_create_rsp *rsp;
22832283
struct smb2_create_req *req;
2284-
int id;
2284+
int id = -1;
22852285
int err;
22862286
char *name;
22872287

@@ -2338,6 +2338,9 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)
23382338
break;
23392339
}
23402340

2341+
if (id >= 0)
2342+
ksmbd_session_rpc_close(work->sess, id);
2343+
23412344
if (!IS_ERR(name))
23422345
kfree(name);
23432346

@@ -2809,6 +2812,7 @@ static int parse_durable_handle_context(struct ksmbd_work *work,
28092812
SMB2_CLIENT_GUID_SIZE)) {
28102813
if (!(req->hdr.Flags & SMB2_FLAGS_REPLAY_OPERATION)) {
28112814
err = -ENOEXEC;
2815+
ksmbd_put_durable_fd(dh_info->fp);
28122816
goto out;
28132817
}
28142818

@@ -3006,10 +3010,10 @@ int smb2_open(struct ksmbd_work *work)
30063010
file_info = FILE_OPENED;
30073011

30083012
rc = ksmbd_vfs_getattr(&fp->filp->f_path, &stat);
3013+
ksmbd_put_durable_fd(fp);
30093014
if (rc)
30103015
goto err_out2;
30113016

3012-
ksmbd_put_durable_fd(fp);
30133017
goto reconnected_fp;
30143018
}
30153019
} else if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
@@ -4923,8 +4927,10 @@ static int get_file_all_info(struct ksmbd_work *work,
49234927

49244928
ret = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
49254929
AT_STATX_SYNC_AS_STAT);
4926-
if (ret)
4930+
if (ret) {
4931+
kfree(filename);
49274932
return ret;
4933+
}
49284934

49294935
ksmbd_debug(SMB, "filename = %s\n", filename);
49304936
delete_pending = ksmbd_inode_pending_delete(fp);

0 commit comments

Comments
 (0)