Skip to content

Commit c0f54ed

Browse files
wingmankwokdavem330
authored andcommitted
net: netcp: Fixes the use of spin_lock_bh in timer function
This patch fixes a bug in which the timer routine synchronized against the ethtool-triggered statistics updates with spin_lock_bh(). A timer function is itself a bottom-half, so this should be spin_lock(). Signed-off-by: WingMan Kwok <w-kwok2@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ea6f82f commit c0f54ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/ti/netcp_ethss.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,14 +2189,15 @@ static void netcp_ethss_timer(unsigned long arg)
21892189
netcp_ethss_update_link_state(gbe_dev, slave, NULL);
21902190
}
21912191

2192-
spin_lock_bh(&gbe_dev->hw_stats_lock);
2192+
/* A timer runs as a BH, no need to block them */
2193+
spin_lock(&gbe_dev->hw_stats_lock);
21932194

21942195
if (gbe_dev->ss_version == GBE_SS_VERSION_14)
21952196
gbe_update_stats_ver14(gbe_dev, NULL);
21962197
else
21972198
gbe_update_stats(gbe_dev, NULL);
21982199

2199-
spin_unlock_bh(&gbe_dev->hw_stats_lock);
2200+
spin_unlock(&gbe_dev->hw_stats_lock);
22002201

22012202
gbe_dev->timer.expires = jiffies + GBE_TIMER_INTERVAL;
22022203
add_timer(&gbe_dev->timer);

0 commit comments

Comments
 (0)