Skip to content

Commit fb24c6d

Browse files
Govindarajulu Varadarajangregkh
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+ #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 9418ea8 commit fb24c6d

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
@@ -79,7 +79,6 @@ void enic_rfs_flw_tbl_init(struct enic *enic)
7979
enic->rfs_h.max = enic->config.num_arfs;
8080
enic->rfs_h.free = enic->rfs_h.max;
8181
enic->rfs_h.toclean = 0;
82-
enic_rfs_timer_start(enic);
8382
}
8483

8584
void enic_rfs_flw_tbl_free(struct enic *enic)
@@ -88,7 +87,6 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
8887

8988
enic_rfs_timer_stop(enic);
9089
spin_lock_bh(&enic->rfs_h.lock);
91-
enic->rfs_h.free = 0;
9290
for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) {
9391
struct hlist_head *hhead;
9492
struct hlist_node *tmp;
@@ -99,6 +97,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic)
9997
enic_delfltr(enic, n->fltr_id);
10098
hlist_del(&n->node);
10199
kfree(n);
100+
enic->rfs_h.free++;
102101
}
103102
}
104103
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
@@ -1930,7 +1930,7 @@ static int enic_open(struct net_device *netdev)
19301930
vnic_intr_unmask(&enic->intr[i]);
19311931

19321932
enic_notify_timer_start(enic);
1933-
enic_rfs_flw_tbl_init(enic);
1933+
enic_rfs_timer_start(enic);
19341934

19351935
return 0;
19361936

@@ -2854,6 +2854,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
28542854
enic->notify_timer.function = enic_notify_timer;
28552855
enic->notify_timer.data = (unsigned long)enic;
28562856

2857+
enic_rfs_flw_tbl_init(enic);
28572858
enic_set_rx_coal_setting(enic);
28582859
INIT_WORK(&enic->reset, enic_reset);
28592860
INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset);

0 commit comments

Comments
 (0)