summaryrefslogtreecommitdiff
path: root/lib/nlattr.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2023-05-01 15:20:08 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-05-01 15:20:08 -0700
commit9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e (patch)
treed57f3a63479a07b4e0cece029886e76e04feb984 /lib/nlattr.c
parent5dc63e56a9cf8df0b59c234a505a1653f1bdf885 (diff)
parent53bea86b5712c7491bb3dae12e271666df0a308c (diff)
Merge branch 'next' into for-linus
Prepare input updates for 6.4 merge window.
Diffstat (limited to 'lib/nlattr.c')
-rw-r--r--lib/nlattr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 9055e8b4d144e..489e15bde5c1d 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/jiffies.h>
+#include <linux/nospec.h>
#include <linux/skbuff.h>
#include <linux/string.h>
#include <linux/types.h>
@@ -381,6 +382,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
if (type <= 0 || type > maxtype)
return 0;
+ type = array_index_nospec(type, maxtype + 1);
pt = &policy[type];
BUG_ON(pt->type > NLA_TYPE_MAX);
@@ -596,6 +598,7 @@ static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype,
}
continue;
}
+ type = array_index_nospec(type, maxtype + 1);
if (policy) {
int err = validate_nla(nla, maxtype, policy,
validate, extack, depth);