提交 1bf40954 编写于 作者: H Herbert Xu 提交者: David S. Miller

[PACKET]: Fix /proc/net/packet crash due to bogus private pointer

The seq_open_net patch changed the meaning of seq->private.
Unfortunately it missed two spots in AF_PACKET, which still
used the old way of dereferencing seq->private, thus causing
weird and wonderful crashes when reading /proc/net/packet.
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2d4d2980
...@@ -1878,7 +1878,7 @@ static void *packet_seq_start(struct seq_file *seq, loff_t *pos) ...@@ -1878,7 +1878,7 @@ static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
struct net *net = seq->private; struct net *net = seq_file_net(seq);
++*pos; ++*pos;
return (v == SEQ_START_TOKEN) return (v == SEQ_START_TOKEN)
? sk_head(&net->packet.sklist) ? sk_head(&net->packet.sklist)
...@@ -1887,7 +1887,7 @@ static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1887,7 +1887,7 @@ static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos)
static void packet_seq_stop(struct seq_file *seq, void *v) static void packet_seq_stop(struct seq_file *seq, void *v)
{ {
struct net *net = seq->private; struct net *net = seq_file_net(seq);
read_unlock(&net->packet.sklist_lock); read_unlock(&net->packet.sklist_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册