Commit f8d384a6 authored by Yinjun Zhang's avatar Yinjun Zhang Committed by David S. Miller

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: 9d32e4e7 ("nfp: add support for coalesce adaptive feature")
Signed-off-by: default avatarYinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e300a85d
...@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) ...@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)
if (napi_complete_done(napi, pkts_polled)) if (napi_complete_done(napi, pkts_polled))
nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
if (r_vec->nfp_net->rx_coalesce_adapt_on) { if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) {
struct dim_sample dim_sample = {}; struct dim_sample dim_sample = {};
unsigned int start; unsigned int start;
u64 pkts, bytes; u64 pkts, bytes;
...@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) ...@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)
net_dim(&r_vec->rx_dim, dim_sample); net_dim(&r_vec->rx_dim, dim_sample);
} }
if (r_vec->nfp_net->tx_coalesce_adapt_on) { if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) {
struct dim_sample dim_sample = {}; struct dim_sample dim_sample = {};
unsigned int start; unsigned int start;
u64 pkts, bytes; u64 pkts, bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment