Skip to content

Commit 8c028dd

Browse files
tangyoulingsmfrench
authored andcommitted
smb/client: check if SMB1 DOS/SRV error mapping arrays are sorted
Although the arrays are sorted at build time, verify the ordering again when cifs.ko is loaded to avoid potential regressions introduced by future script changes. Signed-off-by: Youling Tang <tangyouling@kylinos.cn> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 95e6b73 commit 8c028dd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

fs/smb/client/smb1maperror.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ static int __init __array ## _is_sorted(void) \
219219

220220
/* ntstatus_to_dos_map_is_sorted */
221221
DEFINE_CHECK_SORT_FUNC(ntstatus_to_dos_map, ntstatus);
222+
/* mapping_table_ERRDOS_is_sorted */
223+
DEFINE_CHECK_SORT_FUNC(mapping_table_ERRDOS, smb_err);
224+
/* mapping_table_ERRSRV_is_sorted */
225+
DEFINE_CHECK_SORT_FUNC(mapping_table_ERRSRV, smb_err);
222226

223227
int __init smb1_init_maperror(void)
224228
{
@@ -228,6 +232,14 @@ int __init smb1_init_maperror(void)
228232
if (rc)
229233
return rc;
230234

235+
rc = mapping_table_ERRDOS_is_sorted();
236+
if (rc)
237+
return rc;
238+
239+
rc = mapping_table_ERRSRV_is_sorted();
240+
if (rc)
241+
return rc;
242+
231243
return rc;
232244
}
233245

0 commit comments

Comments
 (0)