浏览代码

[IPV6]: fix lockup via /proc/net/ip6_flowlabel

There's a bug in the seqfile handling for /proc/net/ip6_flowlabel, where,
after finding a flowlabel, the code will loop forever not finding any
further flowlabels, first traversing the rest of the hash bucket then just
looping.

This patch fixes the problem by breaking after the hash bucket has been
traversed.

Note that this bug can cause lockups and oopses, and is trivially invoked
by an unpriveleged user.

Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
James Morris 18 年之前
父节点
当前提交
bcd620757d
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      net/ipv6/ip6_flowlabel.c

+ 2 - 0
net/ipv6/ip6_flowlabel.c

@@ -587,6 +587,8 @@ static struct ip6_flowlabel *ip6fl_get_next(struct seq_file *seq, struct ip6_flo
 	while (!fl) {
 	while (!fl) {
 		if (++state->bucket <= FL_HASH_MASK)
 		if (++state->bucket <= FL_HASH_MASK)
 			fl = fl_ht[state->bucket];
 			fl = fl_ht[state->bucket];
+		else
+			break;
 	}
 	}
 	return fl;
 	return fl;
 }
 }