summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-02-03 00:03:26 -0800
committerBen Hutchings <ben@decadent.org.uk>2017-03-16 02:27:09 +0000
commitbc9e2ad4628d13aca2ed28ac1fa77c4c41594ff0 (patch)
treeba7579cf40a1989cdf8e4476e89d2ac496a9fdd4 /include
parentbe16e27dacfae7a6e710ade86f69daf6a270af52 (diff)
downloadlinux-stable-bc9e2ad4628d13aca2ed28ac1fa77c4c41594ff0.tar.gz
linux-stable-bc9e2ad4628d13aca2ed28ac1fa77c4c41594ff0.tar.bz2
linux-stable-bc9e2ad4628d13aca2ed28ac1fa77c4c41594ff0.zip
netlabel: out of bound access in cipso_v4_validate()
commit d71b7896886345c53ef1d84bda2bc758554f5d61 upstream. syzkaller found another out of bound access in ip_options_compile(), or more exactly in cipso_v4_validate() Fixes: 20e2a8648596 ("cipso: handle CIPSO options correctly when NetLabel is disabled") Fixes: 446fda4f2682 ("[NetLabel]: CIPSOv4 engine") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Cc: Paul Moore <paul@paul-moore.com> Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/net/cipso_ipv4.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a6fd939f202d..c8b8852ce9b8 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -302,6 +302,10 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
}
for (opt_iter = 6; opt_iter < opt_len;) {
+ if (opt_iter + 1 == opt_len) {
+ err_offset = opt_iter;
+ goto out;
+ }
tag_len = opt[opt_iter + 1];
if ((tag_len == 0) || (tag_len > (opt_len - opt_iter))) {
err_offset = opt_iter + 1;