ibmvnic: remove excessive irqsave
authorJunlin Yang <yangjunlin@yulong.com>
Fri, 5 Mar 2021 08:48:39 +0000 (16:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Mar 2021 21:00:38 +0000 (13:00 -0800)
commit69cdb7947adb816fc9325b4ec02a6dddd5070b82
tree4d05951c9ca0c8ff7a6b0062fb20e7df42aaca60
parente233febda6ebab750e30662a7cc9b9efad127685
ibmvnic: remove excessive irqsave

ibmvnic_remove locks multiple spinlocks while disabling interrupts:
spin_lock_irqsave(&adapter->state_lock, flags);
spin_lock_irqsave(&adapter->rwi_lock, flags);

As reported by coccinelle, the second _irqsave() overwrites the value
saved in 'flags' by the first _irqsave(),   therefore when the second
_irqrestore() comes,the value in 'flags' is not valid,the value saved
by the first _irqsave() has been lost.
This likely leads to IRQs remaining disabled. So remove the second
_irqsave():
spin_lock_irqsave(&adapter->state_lock, flags);
spin_lock(&adapter->rwi_lock);

Generated by: ./scripts/coccinelle/locks/flags.cocci
./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:
ERROR: nested lock+irqsave that reuses flags from line 5404.

Fixes: 4a41c421f367 ("ibmvnic: serialize access to work queue on remove")
Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c