Unverified Commit 0ffcd407 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3504 net: hns3: fix kernel crash when 1588 is received on HIP08 devices

Merge Pull Request from: @svishen 
 
This pull request fix kernel crash when 1588 is received on HIP08 devices

The HIP08 devices does not register the ptp devices, so the
hdev->ptp is NULL, but the hardware can receive 1588 messages,
and set the HNS3_RXD_TS_VLD_B bit, so, if match this case, the
access of hdev->ptp->flags will cause a kernel crash.

issue:
https://gitee.com/openeuler/kernel/issues/I8QB9J 
 
Link:https://gitee.com/openeuler/kernel/pulls/3504

 

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 00acfc98 e318095d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ void hclge_ptp_get_rx_hwts(struct hnae3_handle *handle, struct sk_buff *skb,
	u64 ns = nsec;
	u32 sec_h;

	if (!test_bit(HCLGE_PTP_FLAG_RX_EN, &hdev->ptp->flags))
	if (!hdev->ptp || !test_bit(HCLGE_PTP_FLAG_RX_EN, &hdev->ptp->flags))
		return;

	/* Since the BD does not have enough space for the higher 16 bits of