Commit 7554d787 authored by Chenghai Huang's avatar Chenghai Huang Committed by JangShui Yang
Browse files

crypto: hisilicon/qm - adjust the internal processing sequence of the vf enable and disable

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


CVE: NA

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

When the virtual function is enabled, the value of vfs_num must
be assigned after the VF configuration is complete. Otherwise,
the device may be accessed before the virtual configuration is
complete, causing an error.

When the QM is disabled, clear vfs_num and execute
qm_pm_put_sync before hisi_qm_sriov_disable is return.
Otherwise, if qm_clear_vft_config fails, users may access the
device when the PCI virtualization is disabled, resulting in an
error.

Fixes: 263c9959 ("crypto: hisilicon - add queue management driver for HiSilicon QM module")
Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: default avatarJiangShui Yang <yangjiangshui@h-partners.com>
parent f523e60d
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -3953,7 +3953,6 @@ EXPORT_SYMBOL_GPL(hisi_qm_sriov_enable);
int hisi_qm_sriov_disable(struct pci_dev *pdev, bool is_frozen)
{
	struct hisi_qm *qm = pci_get_drvdata(pdev);
	int ret;

	if (pci_vfs_assigned(pdev)) {
		pci_err(pdev, "Failed to disable VFs as VFs are assigned!\n");
@@ -3968,13 +3967,9 @@ int hisi_qm_sriov_disable(struct pci_dev *pdev, bool is_frozen)

	pci_disable_sriov(pdev);

	ret = qm_clear_vft_config(qm);
	if (ret)
		return ret;

	qm_pm_put_sync(qm);

	return 0;
	return qm_clear_vft_config(qm);
}
EXPORT_SYMBOL_GPL(hisi_qm_sriov_disable);