Commit c92b8f62 authored by Hao Lan's avatar Hao Lan Committed by Jiantao Xiao
Browse files

net: hns3: fix getting supported parameter from driver in hclge_set_wol

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


CVE: NA

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

The driver should use the supported parameter got from firmware,
not from user,to validate the wol mode.

Fixes: c3c5f044 ("net: hns3: support wake on lan configuration and query")
Signed-off-by: default avatarHao Lan <lanhao@huawei.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent 20c27ab8
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -12199,12 +12199,10 @@ static int hclge_set_wol(struct hnae3_handle *handle,
	struct hclge_vport *vport = hclge_get_vport(handle);
	struct hclge_dev *hdev = vport->back;
	struct hclge_wol_info *wol_info = &hdev->hw.mac.wol;
	u32 wol_supported;
	u32 wol_mode;

	wol_supported = hclge_wol_mode_from_ethtool(wol->supported);
	wol_mode = hclge_wol_mode_from_ethtool(wol->wolopts);
	if (wol_mode & ~wol_supported)
	if (wol_mode & ~wol_info->wol_support_mode)
		return -EINVAL;

	wol_info->wol_current_mode = wol_mode;