Skip to content

Commit ab4ad35

Browse files
Marios Makassikissmfrench
authored andcommitted
smb: server: handle readdir_info_level_struct_sz() error
early exit in smb2_populate_readdir_entry() if the requested info_level is unknown. Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 254f496 commit ab4ad35

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

fs/smb/server/smb2pdu.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3946,7 +3946,13 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
39463946
goto free_conv_name;
39473947
}
39483948

3949-
struct_sz = readdir_info_level_struct_sz(info_level) + conv_len;
3949+
struct_sz = readdir_info_level_struct_sz(info_level);
3950+
if (struct_sz == -EOPNOTSUPP) {
3951+
rc = -EINVAL;
3952+
goto free_conv_name;
3953+
}
3954+
3955+
struct_sz += conv_len;
39503956
next_entry_offset = ALIGN(struct_sz, KSMBD_DIR_INFO_ALIGNMENT);
39513957
d_info->last_entry_off_align = next_entry_offset - struct_sz;
39523958

0 commit comments

Comments
 (0)