Ignat Korchagin
99ba0ea616
sfc: adjust efx->xdp_tx_queue_count with the real number of initialized queues
efx->xdp_tx_queue_count is initially initialized to num_possible_cpus() and is
later used to allocate and traverse efx->xdp_tx_queues lookup array. However,
we may end up not initializing all the array slots with real queues during
probing. This results, for example, in a NULL pointer dereference, when running
"# ethtool -S <iface>", similar to below
[2570283.664955][T4126959] BUG: kernel NULL pointer dereference, address: 00000000000000f8
[2570283.681283][T4126959] #PF: supervisor read access in kernel mode
[2570283.695678][T4126959] #PF: error_code(0x0000) - not-present page
[2570283.710013][T4126959] PGD 0 P4D 0
[2570283.721649][T4126959] Oops: 0000 [#1] SMP PTI
[2570283.734108][T4126959] CPU: 23 PID: 4126959 Comm: ethtool Tainted: G O 5.10.20-cloudflare-2021.3.1 #1
[2570283.752641][T4126959] Hardware name: <redacted>
[2570283.781408][T4126959] RIP: 0010:efx_ethtool_get_stats+0x2ca/0x330 [sfc]
[2570283.796073][T4126959] Code: 00 85 c0 74 39 48 8b 95 a8 0f 00 00 48 85 d2 74 2d 31 c0 eb 07 48 8b 95 a8 0f 00 00 48 63 c8 49 83 c4 08 83 c0 01 48 8b 14 ca <48> 8b 92 f8 00 00 00 49 89 54 24 f8 39 85 a0 0f 00 00 77 d7 48 8b
[2570283.831259][T4126959] RSP: 0018:ffffb79a77657ce8 EFLAGS: 00010202
[2570283.845121][T4126959] RAX: 0000000000000019 RBX: ffffb799cd0c9280 RCX: 0000000000000018
[2570283.860872][T4126959] RDX: 0000000000000000 RSI: ffff96dd970ce000 RDI: 0000000000000005
[2570283.876525][T4126959] RBP: ffff96dd86f0a000 R08: ffff96dd970ce480 R09: 000000000000005f
[2570283.892014][T4126959] R10: ffffb799cd0c9fff R11: ffffb799cd0c9000 R12: ffffb799cd0c94f8
[2570283.907406][T4126959] R13: ffffffffc11b1090 R14: ffff96dd970ce000 R15: ffffffffc11cd66c
[2570283.922705][T4126959] FS: 00007fa7723f8740(0000) GS:ffff96f51fac0000(0000) knlGS:0000000000000000
[2570283.938848][T4126959] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[2570283.952524][T4126959] CR2: 00000000000000f8 CR3: 0000001a73e6e006 CR4: 00000000007706e0
[2570283.967529][T4126959] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[2570283.982400][T4126959] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[2570283.997308][T4126959] PKRU: 55555554
[2570284.007649][T4126959] Call Trace:
[2570284.017598][T4126959] dev_ethtool+0x1832/0x2830
Fix this by adjusting efx->xdp_tx_queue_count after probing to reflect the true
value of initialized slots in efx->xdp_tx_queues.
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Fixes: e26ca4b535 ("sfc: reduce the number of requested xdp ev queues")
Cc: <stable@vger.kernel.org> # 5.12.x
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-04-27 15:38:29 -07:00
..
2021-02-24 10:25:37 -08:00
2021-04-07 19:02:43 +02:00
2021-02-02 14:26:02 +01:00
2021-01-31 08:05:46 -07:00
2021-04-23 14:10:43 -07:00
2021-03-16 16:32:40 +01:00
2021-04-05 09:14:18 +02:00
2021-04-18 09:36:56 +03:00
2021-04-02 16:13:13 -07:00
2021-04-09 20:48:35 -07:00
2021-04-09 14:54:23 -07:00
2021-04-06 11:46:39 +02:00
2021-04-07 16:01:25 -07:00
2021-02-22 14:11:36 -08:00
2021-03-06 16:48:09 +00:00
2021-03-26 17:43:48 +01:00
2021-03-02 22:41:23 +11:00
2021-04-16 18:21:56 -07:00
2021-03-22 09:20:06 -07:00
2021-02-15 17:02:04 +01:00
2021-04-12 22:08:39 +05:30
2021-02-24 21:05:28 +05:30
2021-02-15 10:06:58 +01:00
2021-03-15 11:09:38 +09:00
2021-04-04 14:05:45 -07:00
2021-04-09 14:54:23 -07:00
2021-04-15 10:48:51 -07:00
2021-04-12 08:00:33 -04:00
2021-03-16 15:41:20 +01:00
2021-02-26 09:41:00 -08:00
2021-02-22 10:05:12 -08:00
2021-02-09 11:36:50 -06:00
2021-02-22 14:27:07 -08:00
2021-04-06 22:32:33 +02:00
2021-02-22 09:52:55 -08:00
2021-02-28 15:48:25 -08:00
2021-03-15 16:34:39 +01:00
2021-04-09 20:48:35 -07:00
2021-04-15 10:23:44 -07:00
2021-03-18 23:46:21 +02:00
2021-03-18 11:31:12 +01:00
2021-02-09 09:48:23 +01:00
2021-03-09 08:45:17 +00:00
2021-03-30 13:34:42 -07:00
2021-04-09 14:54:23 -07:00
2021-02-14 21:27:24 -07:00
2021-04-09 14:54:23 -07:00
2021-04-14 14:28:29 -04:00
2021-03-17 13:16:18 -07:00
2021-02-24 10:25:37 -08:00
2021-03-23 09:14:12 +00:00
2021-03-23 15:15:15 +01:00
2021-03-09 10:00:52 +01:00
2021-04-13 14:01:34 -07:00
2021-04-27 15:38:29 -07:00
2021-04-13 14:50:57 -07:00
2021-02-23 14:12:53 -06:00
2021-04-09 21:56:01 -07:00
2021-03-18 05:39:18 +01:00
2021-02-05 11:25:52 +01:00
2021-04-13 14:35:02 -07:00
2021-03-12 09:26:52 +05:30
2021-03-17 13:16:18 -07:00
2021-04-09 18:07:21 -07:00
2021-02-26 13:54:43 -08:00
2021-03-12 11:30:31 +00:00
2021-04-06 16:32:17 -07:00
2021-03-30 00:46:49 +02:00
2021-04-06 22:10:21 +02:00
2021-01-28 01:31:42 +01:00
2021-03-01 17:43:29 +01:00
2021-03-25 15:31:22 -07:00
2021-02-25 12:23:49 -08:00
2021-04-07 11:52:26 +02:00
2021-03-15 15:42:12 +00:00
2021-03-17 14:15:07 -05:00
2021-02-26 10:28:35 -08:00
2021-02-27 08:07:12 -08:00
2021-03-26 15:14:56 -07:00
2021-03-17 13:16:18 -07:00
2021-04-17 11:08:07 -07:00
2021-03-17 13:16:18 -07:00
2021-04-07 09:26:50 -07:00
2021-03-02 15:33:00 +01:00
2021-03-11 13:32:32 +00:00
2021-02-12 12:26:46 +01:00
2021-04-13 14:35:02 -07:00
2021-04-05 23:09:37 -04:00
2021-03-17 13:16:18 -07:00
2021-03-17 09:55:58 +01:00
2021-03-30 13:38:10 +03:00
2021-04-03 10:00:53 -07:00
2021-02-09 12:25:32 +01:00
2021-04-05 09:05:42 +02:00
2021-04-09 12:08:28 -04:00
2021-04-13 08:29:16 -06:00
2021-03-18 11:20:35 -07:00
2021-04-03 10:42:20 -07:00
2021-03-10 16:59:50 +01:00
2021-03-18 11:20:35 -07:00
2021-02-09 12:15:07 +01:00
2021-04-09 14:54:23 -07:00
2021-04-09 09:58:42 -07:00
2021-02-16 20:36:38 -08:00
2021-02-24 10:35:29 -08:00