diff mbox series

[net-next] Revert "tipc: use consistent GFP flags"

Message ID 20211217030059.5947-1-hoang.h.le@dektech.com.au (mailing list archive)
State Accepted
Commit f845fe5819efc4111c456c102f15db6d9ed3406e
Delegated to: Netdev Maintainers
Headers show
Series [net-next] Revert "tipc: use consistent GFP flags" | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: tadeusz.struk@linaro.org; 1 maintainers not CCed: tadeusz.struk@linaro.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Hoang Huu Le Dec. 17, 2021, 3 a.m. UTC
This reverts commit 86c3a3e964d910a62eeb277d60b2a60ebefa9feb.

The tipc_aead_init() function can be calling from an interrupt routine.
This allocation might sleep with GFP_KERNEL flag, hence the following BUG
is reported.

[   17.657509] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:230
[   17.660916] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/3
[   17.664093] preempt_count: 302, expected: 0
[   17.665619] RCU nest depth: 2, expected: 0
[   17.667163] Preemption disabled at:
[   17.667165] [<0000000000000000>] 0x0
[   17.669753] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Tainted: G        W         5.16.0-rc4+ #1
[   17.673006] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[   17.675540] Call Trace:
[   17.676285]  <IRQ>
[   17.676913]  dump_stack_lvl+0x34/0x44
[   17.678033]  __might_resched.cold+0xd6/0x10f
[   17.679311]  kmem_cache_alloc_trace+0x14d/0x220
[   17.680663]  tipc_crypto_start+0x4a/0x2b0 [tipc]
[   17.682146]  ? kmem_cache_alloc_trace+0xd3/0x220
[   17.683545]  tipc_node_create+0x2f0/0x790 [tipc]
[   17.684956]  tipc_node_check_dest+0x72/0x680 [tipc]
[   17.686706]  ? ___cache_free+0x31/0x350
[   17.688008]  ? skb_release_data+0x128/0x140
[   17.689431]  tipc_disc_rcv+0x479/0x510 [tipc]
[   17.690904]  tipc_rcv+0x71c/0x730 [tipc]
[   17.692219]  ? __netif_receive_skb_core+0xb7/0xf60
[   17.693856]  tipc_l2_rcv_msg+0x5e/0x90 [tipc]
[   17.695333]  __netif_receive_skb_list_core+0x20b/0x260
[   17.697072]  netif_receive_skb_list_internal+0x1bf/0x2e0
[   17.698870]  ? dev_gro_receive+0x4c2/0x680
[   17.700255]  napi_complete_done+0x6f/0x180
[   17.701657]  virtnet_poll+0x29c/0x42e [virtio_net]
[   17.703262]  __napi_poll+0x2c/0x170
[   17.704429]  net_rx_action+0x22f/0x280
[   17.705706]  __do_softirq+0xfd/0x30a
[   17.706921]  common_interrupt+0xa4/0xc0
[   17.708206]  </IRQ>
[   17.708922]  <TASK>
[   17.709651]  asm_common_interrupt+0x1e/0x40
[   17.711078] RIP: 0010:default_idle+0x18/0x20

Fixes: 86c3a3e964d9 ("tipc: use consistent GFP flags")
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
---
 net/tipc/crypto.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 18, 2021, 3:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 17 Dec 2021 10:00:59 +0700 you wrote:
> This reverts commit 86c3a3e964d910a62eeb277d60b2a60ebefa9feb.
> 
> The tipc_aead_init() function can be calling from an interrupt routine.
> This allocation might sleep with GFP_KERNEL flag, hence the following BUG
> is reported.
> 
> [   17.657509] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:230
> [   17.660916] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/3
> [   17.664093] preempt_count: 302, expected: 0
> [   17.665619] RCU nest depth: 2, expected: 0
> [   17.667163] Preemption disabled at:
> [   17.667165] [<0000000000000000>] 0x0
> [   17.669753] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Tainted: G        W         5.16.0-rc4+ #1
> [   17.673006] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> [   17.675540] Call Trace:
> [   17.676285]  <IRQ>
> [   17.676913]  dump_stack_lvl+0x34/0x44
> [   17.678033]  __might_resched.cold+0xd6/0x10f
> [   17.679311]  kmem_cache_alloc_trace+0x14d/0x220
> [   17.680663]  tipc_crypto_start+0x4a/0x2b0 [tipc]
> [   17.682146]  ? kmem_cache_alloc_trace+0xd3/0x220
> [   17.683545]  tipc_node_create+0x2f0/0x790 [tipc]
> [   17.684956]  tipc_node_check_dest+0x72/0x680 [tipc]
> [   17.686706]  ? ___cache_free+0x31/0x350
> [   17.688008]  ? skb_release_data+0x128/0x140
> [   17.689431]  tipc_disc_rcv+0x479/0x510 [tipc]
> [   17.690904]  tipc_rcv+0x71c/0x730 [tipc]
> [   17.692219]  ? __netif_receive_skb_core+0xb7/0xf60
> [   17.693856]  tipc_l2_rcv_msg+0x5e/0x90 [tipc]
> [   17.695333]  __netif_receive_skb_list_core+0x20b/0x260
> [   17.697072]  netif_receive_skb_list_internal+0x1bf/0x2e0
> [   17.698870]  ? dev_gro_receive+0x4c2/0x680
> [   17.700255]  napi_complete_done+0x6f/0x180
> [   17.701657]  virtnet_poll+0x29c/0x42e [virtio_net]
> [   17.703262]  __napi_poll+0x2c/0x170
> [   17.704429]  net_rx_action+0x22f/0x280
> [   17.705706]  __do_softirq+0xfd/0x30a
> [   17.706921]  common_interrupt+0xa4/0xc0
> [   17.708206]  </IRQ>
> [   17.708922]  <TASK>
> [   17.709651]  asm_common_interrupt+0x1e/0x40
> [   17.711078] RIP: 0010:default_idle+0x18/0x20
> 
> [...]

Here is the summary with links:
  - [net-next] Revert "tipc: use consistent GFP flags"
    https://git.kernel.org/netdev/net/c/f845fe5819ef

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index 81116312b753..9325479295b8 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -524,7 +524,7 @@  static int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey,
 		return -EEXIST;
 
 	/* Allocate a new AEAD */
-	tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
+	tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
 	if (unlikely(!tmp))
 		return -ENOMEM;
 
@@ -1463,7 +1463,7 @@  int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,
 		return -EEXIST;
 
 	/* Allocate crypto */
-	c = kzalloc(sizeof(*c), GFP_KERNEL);
+	c = kzalloc(sizeof(*c), GFP_ATOMIC);
 	if (!c)
 		return -ENOMEM;
 
@@ -1477,7 +1477,7 @@  int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,
 	}
 
 	/* Allocate statistic structure */
-	c->stats = alloc_percpu(struct tipc_crypto_stats);
+	c->stats = alloc_percpu_gfp(struct tipc_crypto_stats, GFP_ATOMIC);
 	if (!c->stats) {
 		if (c->wq)
 			destroy_workqueue(c->wq);
@@ -2450,7 +2450,7 @@  static void tipc_crypto_work_tx(struct work_struct *work)
 	}
 
 	/* Lets duplicate it first */
-	skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_KERNEL);
+	skey = kmemdup(aead->key, tipc_aead_key_size(aead->key), GFP_ATOMIC);
 	rcu_read_unlock();
 
 	/* Now, generate new key, initiate & distribute it */