Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4be2b49e authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by David S. Miller
Browse files

myri10ge: fix sleeping with bh disabled



napi_disable() can not be called with bh disabled, move locking just
around myri10ge_ss_lock_napi() .

Patches fixes following bug:

[  114.278378] BUG: sleeping function called from invalid context at net/core/dev.c:4383
<snip>
[  114.313712] Call Trace:
[  114.314943]  [<ffffffff817010ce>] dump_stack+0x19/0x1b
[  114.317673]  [<ffffffff810ce7f3>] __might_sleep+0x173/0x230
[  114.320566]  [<ffffffff815b3117>] napi_disable+0x27/0x90
[  114.323254]  [<ffffffffa01e437f>] myri10ge_close+0xbf/0x3f0 [myri10ge]

Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarHyong-Youb Kim <hykim@myri.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent edb9a1b8
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev)


	del_timer_sync(&mgp->watchdog_timer);
	del_timer_sync(&mgp->watchdog_timer);
	mgp->running = MYRI10GE_ETH_STOPPING;
	mgp->running = MYRI10GE_ETH_STOPPING;
	local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
	for (i = 0; i < mgp->num_slices; i++) {
	for (i = 0; i < mgp->num_slices; i++) {
		napi_disable(&mgp->ss[i].napi);
		napi_disable(&mgp->ss[i].napi);
		local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
		/* Lock the slice to prevent the busy_poll handler from
		/* Lock the slice to prevent the busy_poll handler from
		 * accessing it.  Later when we bring the NIC up, myri10ge_open
		 * accessing it.  Later when we bring the NIC up, myri10ge_open
		 * resets the slice including this lock.
		 * resets the slice including this lock.
@@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev)
			pr_info("Slice %d locked\n", i);
			pr_info("Slice %d locked\n", i);
			mdelay(1);
			mdelay(1);
		}
		}
	}
		local_bh_enable();
		local_bh_enable();
	}
	netif_carrier_off(dev);
	netif_carrier_off(dev);


	netif_tx_stop_all_queues(dev);
	netif_tx_stop_all_queues(dev);