Skip to content

Commit f8d384a

Browse files
Yinjun Zhangdavem330
authored andcommitted
nfp: fix NULL pointer access when scheduling dim work
Each rx/tx ring has a related dim work, when rx/tx ring number is decreased by `ethtool -L`, the corresponding rx_ring or tx_ring is assigned NULL, while its related work is not destroyed. When scheduled, the work will access NULL pointer. Fixes: 9d32e4e ("nfp: add support for coalesce adaptive feature") Signed-off-by: Yinjun Zhang <[email protected]> Signed-off-by: Louis Peens <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e300a85 commit f8d384a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)
20672067
if (napi_complete_done(napi, pkts_polled))
20682068
nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
20692069

2070-
if (r_vec->nfp_net->rx_coalesce_adapt_on) {
2070+
if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) {
20712071
struct dim_sample dim_sample = {};
20722072
unsigned int start;
20732073
u64 pkts, bytes;
@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)
20822082
net_dim(&r_vec->rx_dim, dim_sample);
20832083
}
20842084

2085-
if (r_vec->nfp_net->tx_coalesce_adapt_on) {
2085+
if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) {
20862086
struct dim_sample dim_sample = {};
20872087
unsigned int start;
20882088
u64 pkts, bytes;

0 commit comments

Comments
 (0)