Commit 2948184a authored by jianqiang Li's avatar jianqiang Li Committed by mufengyan
Browse files

UNIC: Invoke the hns3_unic_set_default_cc in advance

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IATZWZ


CVE: NA

-----------------------------------------------------------

Because the sw_ctype field is defined in struct ublhdr,
you need to accessor set the field in the ubl header through
ublhdr* before removing sw_ctype from the memory. Otherwise,
out-of-bounds access may occur after sw_ctype is removed.
Therefore, the hns3_unic_set_default_cc function is called
earlier.

Fixes: eb44201e ("ubl: add CONFIG_UBL definition and UBL interface")
Signed-off-by: default avatarchuan Wu <wuchuan4@huawei.com>
Signed-off-by: default avatarjianqiang Li <lijianqiang16@huawei.com>
parent 6be8d57e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2618,10 +2618,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
	}
#ifdef CONFIG_HNS3_UBL
	if (hns3_ubl_supported(hns3_get_handle(netdev))) {
		hns3_unic_set_default_cc(skb);

		if (unlikely(!ubl_rmv_sw_ctype(skb)))
			goto out_err_tx_ok;

		hns3_unic_set_default_cc(skb);
	}
#endif
	if (test_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE,