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

Message ID 20071216034119.GA1491@gondor.apana.org.au
State New, archived
Headers show
Series
  • [PACKET] : Fix /proc/net/packet crash due to bogus private pointer
Related show

Commit Message

Herbert Xu Dec. 16, 2007, 3:41 a.m. UTC
On Sun, Dec 16, 2007 at 11:07:07AM +0800, Herbert Xu wrote:
>
> I suspect namespace borkage.  But just because you pin-pointed
> my patch I'll try to track it down :)

Surprise surprise.  The namespace seq patch missed two spots in
AF_PACKET.

[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.

This patch fixes them.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


Cheers,

Comments

Mariusz Kozlowski Dec. 16, 2007, 10:48 a.m. UTC | #1
Hello,

> Surprise surprise.  The namespace seq patch missed two spots in
> AF_PACKET.
> 
> [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.
> 
> This patch fixes them.

True :) It fixes both my x86 and sprac64. Thanks.

	Mariusz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
David Miller Dec. 16, 2007, 10:04 p.m. UTC | #2
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sun, 16 Dec 2007 11:41:20 +0800

> [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.
> 
> This patch fixes them.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied to net-2.6.25, thanks Herbert.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 485af56..43e49f4 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -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);
 }