tun.c patch to fix "smp_processor_id() in preemptible code"

From: Alain Schroeder
Date: Fri Oct 15 2004 - 16:48:46 EST


I was getting these traces on a SMP host:

dsor-vm2 kernel: using smp_processor_id() in preemptible code: linux/480
dsor-vm2 kernel: [smp_processor_id+108/132] smp_processor_id+0x6c/0x84
kernel: [pg0+945156838/1070318592] tun_chr_writev+0x14e/0x174 [tun]
kernel: [pg0+945156917/1070318592] tun_chr_write+0x29/0x30 [tun]
kernel: [vfs_write+189/236] vfs_write+0xbd/0xec
kernel: [sys_write+64/108] sys_write+0x40/0x6c
kernel: [syscall_call+7/11] syscall_call+0x7/0xb

The (very) little attached patch fixes this.

Bye,
Alain

PS: I am not subscribed to the lkml.

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there." -- Indira Gandhi
--- linux-2.6.8-rc2/drivers/net/tun.c Wed Jun 16 05:19:22 2004
+++ linux-2.6.9-rc4-mm1-skas/drivers/net/tun.c Fri Oct 15 21:16:18 2004
@@ -207,7 +207,9 @@
if (tun->flags & TUN_NOCHECKSUM)
skb->ip_summed = CHECKSUM_UNNECESSARY;

+ preempt_disable();
netif_rx_ni(skb);
+ preempt_enable();

tun->stats.rx_packets++;
tun->stats.rx_bytes += len;