]> git.droids-corp.org - dpdk.git/commit
net/enic: fix crash caused by changing MTU
authorHyong Youb Kim <hyonkim@cisco.com>
Tue, 26 Oct 2021 00:02:56 +0000 (17:02 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 3 Nov 2021 18:41:15 +0000 (19:41 +0100)
commitbcd68b68415172815e55fc67cf3947c0433baf74
tree43a460dd75b8f7c014c3c3131975838e2629dd75
parent8a8dc9b815a73433a7cfdc6e72d8106544c686aa
net/enic: fix crash caused by changing MTU

Changing MTU after the device start causes a segfault in the Rx
handler. The MTU handler (enic_set_mtu) performs the following steps.
1. Stop NIC Rx
2. Change Rx handler '(struct rte_eth_dev)->rx_pkt_burst' to
   the dummy handler and sleep a while to quiesce
3. Re-allocate/initialize Rx structures
4. Change Rx handler back to the real handler
   (e.g. enic_noscatter_recv_pkts)

enic_set_mtu does not update the recently introduced fast-path pointer
'(struct rte_eth_fp_ops)->rx_pkt_burst'. Since rte_eth_rx_burst only
uses the fast-path pointer, it keeps invoking the real Rx handler, not
the dummy one set by (2). And, (3) causes a segfault in the real Rx
handler (e.g. dereferencing freed structures).

Fix the segfault by updating the fast-path pointer as well.

Fixes: c87d435a4d79 ("ethdev: copy fast-path API into separate structure")
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
drivers/net/enic/enic_main.c