提交 ce03eeb1 编写于 作者: D Dan Carpenter 提交者: Xie XiuQi

6lowpan: Off by one handling ->nexthdr

mainline inclusion
from mainline-v5.2-rc1
commit f57c4bbf34439531adccd7d3a4ecc14f409c1399
category: bugfix
bugzilla: 18682
CVE: NA

-------------------------------------------------

NEXTHDR_MAX is 255.  What happens here is that we take a u8 value
"hdr->nexthdr" from the network and then look it up in
lowpan_nexthdr_nhcs[].  The problem is that if hdr->nexthdr is 0xff then
we read one element beyond the end of the array so the array needs to
be one element larger.

Fixes: 92aa7c65 ("6lowpan: add generic nhc layer interface")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NJukka Rissanen <jukka.rissanen@linux.intel.com>
Acked-by: NAlexander Aring <aring@mojatatu.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Reviewed-by: NWenan Mao <maowenan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5182eb99
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "nhc.h" #include "nhc.h"
static struct rb_root rb_root = RB_ROOT; static struct rb_root rb_root = RB_ROOT;
static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX]; static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
static DEFINE_SPINLOCK(lowpan_nhc_lock); static DEFINE_SPINLOCK(lowpan_nhc_lock);
static int lowpan_nhc_insert(struct lowpan_nhc *nhc) static int lowpan_nhc_insert(struct lowpan_nhc *nhc)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册