提交 3580a7f5 编写于 作者: L liweihang 提交者: Xie XiuQi

net: hns3: add a check to pointer in error_detected and slot_reset

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

If we add a VF without loading hclgevf.ko and then there is a RAS error
occurs, PCIe AER will call error_detected and slot_reset of all functions,
and will get a NULL pointer when we check ad_dev->ops->handle_hw_ras_error.
This will cause a call trace and failures on handling of follow-up RAS
errors.
This patch check ae_dev and ad_dev->ops at first to solve above issues.

Feature or Bugfix: Bugfix
Signed-off-by: Nliweihang <liweihang@huawei.com>
Reviewed-by: Nlipeng <lipeng321@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 18dddc5e
...@@ -1957,9 +1957,9 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev, ...@@ -1957,9 +1957,9 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
if (state == pci_channel_io_perm_failure) if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
if (!ae_dev) { if (!ae_dev || !ae_dev->ops) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Can't recover - error happened during device init\n"); "Can't recover - error happened before device initialized\n");
return PCI_ERS_RESULT_NONE; return PCI_ERS_RESULT_NONE;
} }
...@@ -1977,6 +1977,9 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev) ...@@ -1977,6 +1977,9 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
enum hnae3_reset_type reset_type; enum hnae3_reset_type reset_type;
if (!ae_dev || !ae_dev->ops)
return PCI_ERS_RESULT_NONE;
/* request the reset */ /* request the reset */
if (ae_dev->ops->reset_event) { if (ae_dev->ops->reset_event) {
if (!ae_dev->override_pci_need_reset) { if (!ae_dev->override_pci_need_reset) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册