]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smb/client: check if SMB1 DOS/SRV error mapping arrays are sorted
authorYouling Tang <tangyouling@kylinos.cn>
Thu, 2 Apr 2026 14:18:38 +0000 (14:18 +0000)
committerSteve French <stfrench@microsoft.com>
Mon, 6 Apr 2026 00:58:40 +0000 (19:58 -0500)
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>
fs/smb/client/smb1maperror.c

index 28e1c84fa83b7933da1287406cfd2899c38fa02c..bca9b60ac8368f0fc69f17eb4200ce3b0477a8a4 100644 (file)
@@ -219,6 +219,10 @@ static int __init __array ## _is_sorted(void)                              \
 
 /* ntstatus_to_dos_map_is_sorted */
 DEFINE_CHECK_SORT_FUNC(ntstatus_to_dos_map, ntstatus);
+/* mapping_table_ERRDOS_is_sorted */
+DEFINE_CHECK_SORT_FUNC(mapping_table_ERRDOS, smb_err);
+/* mapping_table_ERRSRV_is_sorted */
+DEFINE_CHECK_SORT_FUNC(mapping_table_ERRSRV, smb_err);
 
 int __init smb1_init_maperror(void)
 {
@@ -228,6 +232,14 @@ int __init smb1_init_maperror(void)
        if (rc)
                return rc;
 
+       rc = mapping_table_ERRDOS_is_sorted();
+       if (rc)
+               return rc;
+
+       rc = mapping_table_ERRSRV_is_sorted();
+       if (rc)
+               return rc;
+
        return rc;
 }