From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Frederic Sowa Subject: Re: [PATCH v2] net: ipv6: fib: don't sleep inside atomic lock Date: Fri, 22 Aug 2014 00:12:14 +0200 Message-ID: <1408659134.14700.1.camel@localhost> References: <20140821143103.GA25021@kalium.Speedport_W723_V_Typ_A_1_01_001> <1408642668-5808-1-git-send-email-bebl@mageta.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Benjamin Block Return-path: In-Reply-To: <1408642668-5808-1-git-send-email-bebl@mageta.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Do, 2014-08-21 at 19:37 +0200, Benjamin Block wrote: > The function fib6_commit_metrics() allocates a piece of memory in mode > GFP_KERNEL while holding an atomic lock from higher up in the stack, in > the function __ip6_ins_rt(). This produces the following BUG: > > > BUG: sleeping function called from invalid context at mm/slub.c:1250 > > in_atomic(): 1, irqs_disabled(): 0, pid: 2909, name: dhcpcd > > 2 locks held by dhcpcd/2909: > > #0: (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x17/0x20 > > #1: (&tb->tb6_lock){++--+.}, at: [] ip6_route_add+0x65a/0x800 > > CPU: 1 PID: 2909 Comm: dhcpcd Not tainted 3.17.0-rc1 #1 > > Hardware name: ASUS All Series/Q87T, BIOS 0216 10/16/2013 > > 0000000000000008 ffff8800c8f13858 ffffffff81af135a 0000000000000000 > > ffff880212202430 ffff8800c8f13878 ffffffff810f8d3a ffff880212202c98 > > 0000000000000010 ffff8800c8f138c8 ffffffff8121ad0e 0000000000000001 > > Call Trace: > > [] dump_stack+0x4e/0x68 > > [] __might_sleep+0x10a/0x120 > > [] kmem_cache_alloc_trace+0x4e/0x190 > > [] ? fib6_commit_metrics+0x66/0x110 > > [] fib6_commit_metrics+0x66/0x110 > > [] fib6_add+0x883/0xa80 > > [] ? ip6_route_add+0x65a/0x800 > > [] ip6_route_add+0x675/0x800 > > [] ? ip6_route_add+0x6a/0x800 > > [] inet6_rtm_newroute+0x5c/0x80 > > [] rtnetlink_rcv_msg+0x211/0x260 > > [] ? rtnl_lock+0x17/0x20 > > [] ? lock_release_holdtime+0x28/0x180 > > [] ? rtnl_lock+0x17/0x20 > > [] ? __rtnl_unlock+0x20/0x20 > > [] netlink_rcv_skb+0x6e/0xd0 > > [] rtnetlink_rcv+0x25/0x40 > > [] netlink_unicast+0xd9/0x180 > > [] netlink_sendmsg+0x700/0x770 > > [] ? local_clock+0x25/0x30 > > [] sock_sendmsg+0x6c/0x90 > > [] ? might_fault+0xa3/0xb0 > > [] ? verify_iovec+0x7d/0xf0 > > [] ___sys_sendmsg+0x37e/0x3b0 > > [] ? trace_hardirqs_on_caller+0x185/0x220 > > [] ? mutex_unlock+0xe/0x10 > > [] ? netlink_insert+0xbc/0xe0 > > [] ? netlink_autobind.isra.30+0x125/0x150 > > [] ? netlink_autobind.isra.30+0x60/0x150 > > [] ? netlink_bind+0x159/0x230 > > [] ? might_fault+0x5a/0xb0 > > [] ? SYSC_bind+0x7e/0xd0 > > [] __sys_sendmsg+0x4d/0x80 > > [] SyS_sendmsg+0x12/0x20 > > [] system_call_fastpath+0x16/0x1b > > Fixing this by replacing the mode GFP_KERNEL with GFP_ATOMIC. > > Signed-off-by: Benjamin Block Acked-by: Hannes Frederic Sowa Thanks, Hannes