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>
This commit is contained in:
Marios Makassikis 2026-04-22 12:49:00 +02:00 committed by Steve French
parent 254f49634e
commit ab4ad35e58

View File

@ -3946,7 +3946,13 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
goto free_conv_name;
}
struct_sz = readdir_info_level_struct_sz(info_level) + conv_len;
struct_sz = readdir_info_level_struct_sz(info_level);
if (struct_sz == -EOPNOTSUPP) {
rc = -EINVAL;
goto free_conv_name;
}
struct_sz += conv_len;
next_entry_offset = ALIGN(struct_sz, KSMBD_DIR_INFO_ALIGNMENT);
d_info->last_entry_off_align = next_entry_offset - struct_sz;