summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2016-05-02 11:19:15 -0700
committerJoe Stringer <joe@ovn.org>2016-05-02 17:06:37 -0700
commit4a7649a896812844f4dc9e098c04e4f3e5cad1ca (patch)
tree1add007fcec1d0d559b977619c9fa034c72f1ec5 /datapath
parent2e602ea3dafac3f7616dd504cbada1bc22ab4c74 (diff)
downloadopenvswitch-4a7649a896812844f4dc9e098c04e4f3e5cad1ca.tar.gz
compat: nf_defrag_ipv6: fix NULL deref panic.
Upstream commit: netfilter: ipv6: nf_defrag: fix NULL deref panic Valdis reports NULL deref in nf_ct_frag6_gather. Problem is bogus use of skb_queue_walk() -- we miss first skb in the list since we start with head->next instead of head. In case the element we're looking for was head->next we won't find a result and then trip over NULL iter. (defrag uses plain NULL-terminated list rather than one terminated by head-of-list-pointer, which is what skb_queue_walk expects). Fixes: 029f7f3b8701cc7a ("netfilter: ipv6: nf_defrag: avoid/free clone operations") Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Tested-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Upstream: e97ac12859db ("netfilter: ipv6: nf_defrag: fix NULL deref panic") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/nf_conntrack_reasm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c
index 31c47b487..5000351e9 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -365,11 +365,14 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *prev, struct net_devic
return false;
fp->next = prev->next;
- skb_queue_walk(head, iter) {
- if (iter->next != prev)
- continue;
- iter->next = fp;
- break;
+
+ iter = head;
+ while (iter) {
+ if (iter->next == prev) {
+ iter->next = fp;
+ break;
+ }
+ iter = iter->next;
}
skb_morph(prev, head);