On 4/7/2023 2:09 PM, Tony Nguyen wrote: > From: Sylwester Dziedziuch <sylwesterx.dziedziuch@xxxxxxxxx> > > 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@xxxxxxxxx> > Signed-off-by: Piotr Raczynski <piotr.raczynski@xxxxxxxxx> > Signed-off-by: Andrii Staikov <andrii.staikov@xxxxxxxxx> > Signed-off-by: Kamil Maziarz <kamil.maziarz@xxxxxxxxx> > Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@xxxxxxxxx> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx> Big change, but I don't see anything obviously wrong. Reviewed-by: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>