summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@kylinos.cn>2026-04-02 17:18:38 +0300
committerSteve French <stfrench@microsoft.com>2026-04-06 03:58:40 +0300
commit8c028dd086ade4dd9fed8a4198f25531dcd11dcb (patch)
treec67349c826329f95c715f4f4e2c4ac640c0eb4f5 /fs
parent95e6b7340957f8b51e6abb97c666eadd37f1f69f (diff)
downloadlinux-8c028dd086ade4dd9fed8a4198f25531dcd11dcb.tar.xz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/client/smb1maperror.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
index 28e1c84fa83b..bca9b60ac836 100644
--- a/fs/smb/client/smb1maperror.c
+++ b/fs/smb/client/smb1maperror.c
@@ -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;
}