linux/include
Patrick McHardy 4498121ca3 [NET]: Handle disabled preemption in gfp_any()
ctnetlink uses netlink_unicast from an atomic_notifier_chain
(which is called within a RCU read side critical section)
without holding further locks. netlink_unicast calls netlink_trim
with the result of gfp_any() for the gfp flags, which are passed
down to pskb_expand_header. gfp_any() only checks for softirq
context and returns GFP_KERNEL, resulting in this warning:

BUG: sleeping function called from invalid context at mm/slab.c:3032
in_atomic():1, irqs_disabled():0
no locks held by rmmod/7010.

Call Trace:
 [<ffffffff8109467f>] debug_show_held_locks+0x9/0xb
 [<ffffffff8100b0b4>] __might_sleep+0xd9/0xdb
 [<ffffffff810b5082>] __kmalloc+0x68/0x110
 [<ffffffff811ba8f2>] pskb_expand_head+0x4d/0x13b
 [<ffffffff81053147>] netlink_broadcast+0xa5/0x2e0
 [<ffffffff881cd1d7>] :nfnetlink:nfnetlink_send+0x83/0x8a
 [<ffffffff8834f6a6>] :nf_conntrack_netlink:ctnetlink_conntrack_event+0x94c/0x96a
 [<ffffffff810624d6>] notifier_call_chain+0x29/0x3e
 [<ffffffff8106251d>] atomic_notifier_call_chain+0x32/0x60
 [<ffffffff881d266d>] :nf_conntrack:destroy_conntrack+0xa5/0x1d3
 [<ffffffff881d194e>] :nf_conntrack:nf_ct_cleanup+0x8c/0x12c
 [<ffffffff881d4614>] :nf_conntrack:kill_l3proto+0x0/0x13
 [<ffffffff881d482a>] :nf_conntrack:nf_conntrack_l3proto_unregister+0x90/0x94
 [<ffffffff883551b3>] :nf_conntrack_ipv4:nf_conntrack_l3proto_ipv4_fini+0x2b/0x5d
 [<ffffffff8109d44f>] sys_delete_module+0x1b5/0x1e6
 [<ffffffff8105f245>] trace_hardirqs_on_thunk+0x35/0x37
 [<ffffffff8105911e>] system_call+0x7e/0x83

Since netlink_unicast is supposed to be callable from within RCU
read side critical sections, make gfp_any() check for in_atomic()
instead of in_softirq().

Additionally nfnetlink_send needs to use gfp_any() as well for the
call to netlink_broadcast).

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-02-28 09:42:13 -08:00
..
acpi Pull bugzilla-7887 into release branch 2007-02-16 22:11:57 -05:00
asm-alpha [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-arm Merge master.kernel.org:/home/rmk/linux-2.6-arm 2007-02-26 13:19:17 -08:00
asm-arm26 Storage class should be before const qualifier 2007-02-17 20:11:19 +01:00
asm-avr32 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2007-02-19 13:18:39 -08:00
asm-cris [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-frv [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-generic [PATCH] i386: paravirt CPU hypercall batching mode 2007-02-13 13:26:21 +01:00
asm-h8300 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-i386 Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq 2007-02-26 14:17:50 -08:00
asm-ia64 Storage class should be before const qualifier 2007-02-17 20:11:19 +01:00
asm-m32r [PATCH] fix sparse warnings from {asm,net}/checksum.h 2007-02-11 10:51:31 -08:00
asm-m68k [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-m68knommu [PATCH] m68knommu: removed include of system.h from bitops 2007-02-09 10:45:33 -08:00
asm-mips [MIPS] Remove unreferenced _IOC_SLMASK macro in ioctl.h. 2007-02-26 23:06:06 +00:00
asm-parisc Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6 2007-02-26 12:48:06 -08:00
asm-powerpc [POWERPC] QE: clean up ucc_slow.c and ucc_fast.c 2007-02-17 16:12:54 -06:00
asm-ppc [POWERPC] ppc: Add support for AMCC Taishan 440GX eval board 2007-02-13 15:35:52 +11:00
asm-s390 [S390] add atomic64_xchg to s390 2007-02-21 10:55:59 +01:00
asm-sh sh: rts7751r2d board updates. 2007-02-15 18:20:52 +09:00
asm-sh64 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-sparc [PATCH] add missing io...._rep() on sparc32 2007-02-11 11:18:07 -08:00
asm-sparc64 [SPARC64]: Increase command line size to 2048 like other arches. 2007-02-12 15:15:47 -08:00
asm-um [PATCH] uml: x86_64 ptrace fixes 2007-02-11 10:51:24 -08:00
asm-v850 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-x86_64 Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq 2007-02-26 14:17:50 -08:00
asm-xtensa [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
crypto [CRYPTO] api: Allow multiple frontends per backend 2007-02-07 09:21:01 +11:00
keys
linux [NET]: Revert socket.h/stat.h ifdef hacks. 2007-02-28 09:41:59 -08:00
math-emu
media V4L/DVB (5200): V4l_printk_ioctl_arg() is no longer used. 2007-02-21 13:35:18 -02:00
mtd [MTD] remove unused ecctype,eccsize fields from struct mtd_info 2007-02-09 15:27:12 +00:00
net [NET]: Handle disabled preemption in gfp_any() 2007-02-28 09:42:13 -08:00
pcmcia serial: Add PCMCIA IDs for Quatech DSP-100 dual RS232 adapter. 2007-02-16 15:19:16 -08:00
rdma RDMA/cma: Add multicast communication support 2007-02-16 14:29:07 -08:00
rxrpc
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2007-02-19 13:32:28 -08:00
sound [ALSA] version 1.0.14rc2 2007-02-14 08:42:20 +01:00
video [PATCH] Video: fb, add true ref_count atomicity 2007-02-12 09:48:42 -08:00
Kbuild