[PACKET]: Fix /proc/net/packet crash due to bogus private pointer
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 16 Dec 2007 22:04:02 +0000 (14:04 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:58:19 +0000 (14:58 -0800)
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: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c

index 485af56..43e49f4 100644 (file)
@@ -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)
 {
-       struct net *net = seq->private;
+       struct net *net = seq_file_net(seq);
        ++*pos;
        return  (v == SEQ_START_TOKEN)
                ? sk_head(&net->packet.sklist)
@@ -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)
 {
-       struct net *net = seq->private;
+       struct net *net = seq_file_net(seq);
        read_unlock(&net->packet.sklist_lock);
 }