Skip to content

Commit 44e6ba4

Browse files
Govindarajulu VaradarajanZhengShunQian
authored andcommitted
enic: initialize enic->rfs_h.lock in enic_probe
[ Upstream commit 3256d29 ] lockdep spotted that we are using rfs_h.lock in enic_get_rxnfc() without initializing. rfs_h.lock is initialized in enic_open(). But ethtool_ops can be called when interface is down. Move enic_rfs_flw_tbl_init to enic_probe. INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 18 PID: 1189 Comm: ethtool Not tainted 4.17.0-rc7-devel+ hardkernel#27 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014 Call Trace: dump_stack+0x85/0xc0 register_lock_class+0x550/0x560 ? __handle_mm_fault+0xa8b/0x1100 __lock_acquire+0x81/0x670 lock_acquire+0xb9/0x1e0 ? enic_get_rxnfc+0x139/0x2b0 [enic] _raw_spin_lock_bh+0x38/0x80 ? enic_get_rxnfc+0x139/0x2b0 [enic] enic_get_rxnfc+0x139/0x2b0 [enic] ethtool_get_rxnfc+0x8d/0x1c0 dev_ethtool+0x16c8/0x2400 ? __mutex_lock+0x64d/0xa00 ? dev_load+0x6a/0x150 dev_ioctl+0x253/0x4b0 sock_do_ioctl+0x9a/0x130 sock_ioctl+0x1af/0x350 do_vfs_ioctl+0x8e/0x670 ? syscall_trace_enter+0x1e2/0x380 ksys_ioctl+0x60/0x90 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x5a/0x170 entry_SYSCALL_64_after_hwframe+0x49/0xbe Signed-off-by: Govindarajulu Varadarajan <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d343a0b commit 44e6ba4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/net/ethernet/cisco/enic/enic_clsf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void enic_rfs_flw_tbl_init(struct enic *enic)
7878
enic->rfs_h.max = enic->config.num_arfs;
7979
enic->rfs_h.free = enic->rfs_h.max;
8080
enic->rfs_h.toclean = 0;
81-
enic_rfs_timer_start(enic);
8281
}
8382

8483
void enic_rfs_flw_tbl_free(struct enic *enic)
@@ -87,7 +86,6 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
8786

8887
enic_rfs_timer_stop(enic);
8988
spin_lock_bh(&enic->rfs_h.lock);
90-
enic->rfs_h.free = 0;
9189
for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) {
9290
struct hlist_head *hhead;
9391
struct hlist_node *tmp;
@@ -98,6 +96,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
9896
enic_delfltr(enic, n->fltr_id);
9997
hlist_del(&n->node);
10098
kfree(n);
99+
enic->rfs_h.free++;
101100
}
102101
}
103102
spin_unlock_bh(&enic->rfs_h.lock);

drivers/net/ethernet/cisco/enic/enic_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ static int enic_open(struct net_device *netdev)
17601760
vnic_intr_unmask(&enic->intr[i]);
17611761

17621762
enic_notify_timer_start(enic);
1763-
enic_rfs_flw_tbl_init(enic);
1763+
enic_rfs_timer_start(enic);
17641764

17651765
return 0;
17661766

@@ -2694,6 +2694,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
26942694
enic->notify_timer.function = enic_notify_timer;
26952695
enic->notify_timer.data = (unsigned long)enic;
26962696

2697+
enic_rfs_flw_tbl_init(enic);
26972698
enic_set_rx_coal_setting(enic);
26982699
INIT_WORK(&enic->reset, enic_reset);
26992700
INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset);

0 commit comments

Comments
 (0)