Skip to content

Commit 0480917

Browse files
committed
Merge tag 'v7.1-rc-part1-ksmbd-srv-fixes' of git://git.samba.org/ksmbd
Pull smb server updates from Steve French: - smbdirect double free fixes - Add some smbdirect logging - Minor cleanup in crypto, and smbdirect and in IPC handling - Minor cleanup to move header info to common FSCC code - Fix crypt message use after free - Fix memory leak in session setup - Fix for DACL parsing - Fix EA name length validation - Reconnect fix - Fix use after free in close * tag 'v7.1-rc-part1-ksmbd-srv-fixes' of git://git.samba.org/ksmbd: smb: smbdirect: add some logging to SMBDIRECT_CHECK_STATUS_{WARN,DISCONNECT}() smb: smbdirect: introduce smbdirect_socket.logging infrastructure smb: smbdirect: let smbdirect.h include #include <linux/types.h> smb: server: avoid double-free in smb_direct_free_sendmsg after smb_direct_flush_send_list() smb: client: avoid double-free in smbd_free_send_io() after smbd_send_batch_flush() ksmbd: fix use-after-free from async crypto on Qualcomm crypto engine ksmbd: fix mechToken leak when SPNEGO decode fails after token alloc ksmbd: require 3 sub-authorities before reading sub_auth[2] ksmbd: validate EaNameLength in smb2_get_ea() ksmbd: Remove unnecessary selection of CRYPTO_ECB ksmbd: validate owner of durable handle on reconnect ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger ksmbd: ipc: use kzalloc_flex and __counted_by smb: move filesystem_vol_info into common/fscc.h smb: move file_basic_info into common/fscc.h smb: move some definitions from common/smb2pdu.h into common/fscc.h
2 parents 4da0dd9 + 2de35d9 commit 0480917

23 files changed

Lines changed: 663 additions & 403 deletions

fs/smb/client/smb1pdu.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,15 +2061,6 @@ typedef struct {
20612061
__le32 EASize;
20622062
} __packed FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */
20632063

2064-
typedef struct {
2065-
__le64 CreationTime;
2066-
__le64 LastAccessTime;
2067-
__le64 LastWriteTime;
2068-
__le64 ChangeTime;
2069-
__le32 Attributes;
2070-
__u32 Pad;
2071-
} __packed FILE_BASIC_INFO; /* size info, level 0x101 */
2072-
20732064
struct file_allocation_info {
20742065
__le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
20752066
} __packed; /* size used on disk, for level 0x103 for set, 0x105 for query */

fs/smb/client/smb2pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,8 +6147,8 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
61476147
max_len = sizeof(struct smb3_fs_ss_info);
61486148
min_len = sizeof(struct smb3_fs_ss_info);
61496149
} else if (level == FS_VOLUME_INFORMATION) {
6150-
max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN;
6151-
min_len = sizeof(struct smb3_fs_vol_info);
6150+
max_len = sizeof(struct filesystem_vol_info) + MAX_VOL_LABEL_LEN;
6151+
min_len = sizeof(struct filesystem_vol_info);
61526152
} else {
61536153
cifs_dbg(FYI, "Invalid qfsinfo level %d\n", level);
61546154
return -EINVAL;
@@ -6203,9 +6203,9 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
62036203
tcon->perf_sector_size =
62046204
le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf);
62056205
} else if (level == FS_VOLUME_INFORMATION) {
6206-
struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *)
6206+
struct filesystem_vol_info *vol_info = (struct filesystem_vol_info *)
62076207
(offset + (char *)rsp);
6208-
tcon->vol_serial_number = vol_info->VolumeSerialNumber;
6208+
tcon->vol_serial_number = le32_to_cpu(vol_info->VolumeSerialNumber);
62096209
tcon->vol_create_time = vol_info->VolumeCreationTime;
62106210
}
62116211

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,17 +1551,25 @@ static int smbd_post_send_iter(struct smbdirect_socket *sc,
15511551

15521552
rc = smbd_post_send(sc, batch, request);
15531553
if (!rc) {
1554+
/*
1555+
* From here request is moved to batch
1556+
* and we should not free it explicitly.
1557+
*/
1558+
15541559
if (batch != &_batch)
15551560
return 0;
15561561

15571562
rc = smbd_send_batch_flush(sc, batch, true);
15581563
if (!rc)
15591564
return 0;
1565+
1566+
goto err_flush;
15601567
}
15611568

15621569
err_dma:
15631570
smbd_free_send_io(request);
15641571

1572+
err_flush:
15651573
err_alloc:
15661574
atomic_inc(&sc->send_io.credits.count);
15671575
wake_up(&sc->send_io.credits.wait_queue);

0 commit comments

Comments
 (0)