[Intel-wired-lan] [PATCH net v7] i40e: Fix crash when rebuild fails in i40e_xdp_setup
Kuruvinakunnel, George
george.kuruvinakunnel at intel.com
Thu Apr 6 14:03:28 UTC 2023
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of Kamil
> Maziarz
> Sent: Friday, March 31, 2023 5:20 PM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Maziarz, Kamil <kamil.maziarz at intel.com>; Sylwester Dziedziuch
> <sylwesterx.dziedziuch at intel.com>; Staikov, Andrii <andrii.staikov at intel.com>
> Subject: [Intel-wired-lan] [PATCH net v7] i40e: Fix crash when rebuild fails in
> i40e_xdp_setup
>
> From: Sylwester Dziedziuch <sylwesterx.dziedziuch at intel.com>
>
> When attaching XDP program on i40e driver there was a reset and rebuild of the
> interface to reconfigure the queues for XDP operation.
> If one of the steps of rebuild failed then the interface was left in incorrect state that
> could lead to a crash. If rebuild failed while getting capabilities from HW such
> crash occurs:
>
> capability discovery failed, err I40E_ERR_ADMIN_QUEUE_TIMEOUT aq_err OK
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 Call
> Trace:
> ? i40e_reconfig_rss_queues+0x120/0x120 [i40e]
> dev_xdp_install+0x70/0x100
> dev_xdp_attach+0x1d7/0x530
> dev_change_xdp_fd+0x1f4/0x230
> do_setlink+0x45f/0xf30
> ? irq_work_interrupt+0xa/0x20
> ? __nla_validate_parse+0x12d/0x1a0
> rtnl_setlink+0xb5/0x120
> rtnetlink_rcv_msg+0x2b1/0x360
> ? sock_has_perm+0x80/0xa0
> ? rtnl_calcit.isra.42+0x120/0x120
> netlink_rcv_skb+0x4c/0x120
> netlink_unicast+0x196/0x230
> netlink_sendmsg+0x204/0x3d0
> sock_sendmsg+0x4c/0x50
> __sys_sendto+0xee/0x160
> ? handle_mm_fault+0xc1/0x1e0
> ? syscall_trace_enter+0x1fb/0x2c0
> ? __sys_setsockopt+0xd6/0x1d0
> __x64_sys_sendto+0x24/0x30
> do_syscall_64+0x5b/0x1a0
> entry_SYSCALL_64_after_hwframe+0x65/0xca
> RIP: 0033:0x7f3535d99781
>
> Fix this by removing reset and rebuild from i40e_xdp_setup and replace it by
> interface down, reconfigure queues and interface up. This way if any step fails the
> interface will remain in a correct state.
>
> Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions")
> Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch at intel.com>
> Signed-off-by: Piotr Raczynski <piotr.raczynski at intel.com>
> Signed-off-by: Andrii Staikov <andrii.staikov at intel.com>
> Signed-off-by: Kamil Maziarz <kamil.maziarz at intel.com>
> ---
> v2: don't reinitialize rings while hotswapping program
> ---
> v3: error code 'ret' set to -EIO
> ---
> v4: fixed the subject
> ---
> v5: fixed bpf prog assign logic and added xdp_feature flags from another patch
> ---
> v6: added change notes between versions of the patch and changed author to
> proper one
> ---
> v7: squashed two if statements into one, changed return ret; to return 0;, fixed tx/rx
> resources unroll
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 158 +++++++++++++++-----
> 1 file changed, 117 insertions(+), 41 deletions(-)
>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel at intel.com>
More information about the Intel-wired-lan
mailing list