Skip to contentSkip to conversation

ethertap oops

2.6.0-test8/9 Andi Kleen 4 participants 6 messages Oct 26, 2003 – Oct 27, 2003 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 1 line · Simon Roscic

EIP is at ethertap_rx+0x131/0x2a0 [ethertap]

Does this patch fix it?

-Andi

drivers/net/ethertap.c renamed from drivers/net/ethertap.c-o +4 -3
diff -u linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o linux-2.6.0test7mm1-averell/drivers/net/ethertap.c
@@ -302,11 +302,12 @@
 
 static void ethertap_rx(struct sock *sk, int len)
 {
-	struct net_device *dev = tap_map[sk->sk_protocol];
+	unsigned unit = sk->sk_protocol - NETLINK_TAPBASE; 
+	struct net_device *dev;
 	struct sk_buff *skb;
 
-	if (dev==NULL) {
-		printk(KERN_CRIT "ethertap: bad unit!\n");
+	if (unit >= max_taps || (dev = tap_map[unit]) == NULL) { 
+		printk(KERN_CRIT "ethertap: bad unit %u!\n", unit);
 		skb_queue_purge(&sk->sk_receive_queue);
 		return;
 	}
net/netlink/af_netlink.c renamed from net/netlink/af_netlink.c-o +1 -0
diff -u linux-2.6.0test7mm1-averell/net/netlink/af_netlink.c-o linux-2.6.0test7mm1-averell/net/netlink/af_netlink.c
@@ -777,6 +777,7 @@
 	if (input)
 		nlk_sk(sk)->data_ready = input;
 
+	sk->sk_protocol = unit;
 	netlink_insert(sk, 0);
 	return sk;
 }
#2 lore raw

drivers/net/ethertap.c

Quoted 3 lines · On Sun, 26 Oct 2003 23:45:52 +0100 Andi Kleen <[email protected]> wrote:

diff -u linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o linux-2.6.0test7mm1-averell/drivers/net/ethertap.c

drivers/net/ethertap.c renamed from drivers/net/ethertap.c-o +0 -0

This part looks good, applied.

net/netlink/af_netlink.c line 783

Quoted 11 lines

diff -u linux-2.6.0test7mm1-averell/net/netlink/af_netlink.c-o linux-2.6.0test7mm1-averell/net/netlink/af_netlink.c

net/netlink/af_netlink.c renamed from net/netlink/af_netlink.c-o +1 -0
@@ -777,6 +777,7 @@
 	if (input)
 		nlk_sk(sk)->data_ready = input;
 
+	sk->sk_protocol = unit;
 	netlink_insert(sk, 0);
 	return sk;
 }

This part is not needed, netlink_create() does this for us :-)

Thanks Andi.

#3 lore raw
Quoted 8 lines · David S. Miller

drivers/net/ethertap.c

Quoted 3 lines · On Sun, 26 Oct 2003 23:45:52 +0100 Andi Kleen <[email protected]> wrote:

diff -u linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o linux-2.6.0test7mm1-averell/drivers/net/ethertap.c

drivers/net/ethertap.c renamed from drivers/net/ethertap.c-o +0 -0

This part looks good, applied.

I don't know if it actually fixed the bug, I did not test it (sorry, should have stated that in the original mail) But at least it should printk now instead of crashing.

-Andi

#4 lore raw
Quoted 3 lines · On Mon, 27 Oct 2003 13:26:35 +0100 Andi Kleen <[email protected]> wrote:

I don't know if it actually fixed the bug, I did not test it (sorry, should have stated that in the original mail) But at least it should printk now instead of crashing.

Ok, it's still an improvement over the blind dereferencing it does not.

#5 lore raw
In reply to Andi Kleen
Quoted 11 lines · Andi Kleen
Quoted 10 lines · David S. Miller

On Sun, 26 Oct 2003 23:45:52 +0100

Quoted 6 lines · Andi Kleen

diff -u linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o linux-2.6.0test7mm1-averell/drivers/net/ethertap.c ---
linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o 2003-09-11
04:12:33.000000000 +0200 +++
linux-2.6.0test7mm1-averell/drivers/net/ethertap.c 2003-10-26
23:41:17.000000000 +0100

Quoted 7 lines
Quoted 1 line

This part looks good, applied.

I don't know if it actually fixed the bug, I did not test it (sorry, should have stated that in the original mail) But at least it should printk now instead of crashing.

-Andi

Hi Andi,

Your patch fixed the bug! Thanks a lot!
I applyed the first hunk as David wrote above.

bye,
simon.

#6 lore raw
In reply to David S. Miller
Quoted 8 lines · David S. Miller

drivers/net/ethertap.c

Quoted 3 lines · On Sun, 26 Oct 2003 23:45:52 +0100 Andi Kleen <[email protected]> wrote:

diff -u linux-2.6.0test7mm1-averell/drivers/net/ethertap.c-o linux-2.6.0test7mm1-averell/drivers/net/ethertap.c

drivers/net/ethertap.c renamed from drivers/net/ethertap.c-o +0 -0

This part looks good, applied.

I don't know if it actually fixed the bug, I did not test it (sorry, should have stated that in the original mail) But at least it should printk now instead of crashing.

-Andi