Commit 64ff58fa authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: fix use-after-free issue for hclge_add_fd_entry_common()

When new rule state is TO_ADD or ACTIVE, and there is already a
rule with same location in the fd_rule_list, the new rule will
be freed after modifying the old rule. It may cause user-after-free
issue when access rule again in hclge_add_fd_entry_common().

Fixes: fc4243b8 ("net: hns3: refactor flow director configuration")
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 989f7178
...@@ -6440,8 +6440,8 @@ static int hclge_add_fd_entry_common(struct hclge_dev *hdev, ...@@ -6440,8 +6440,8 @@ static int hclge_add_fd_entry_common(struct hclge_dev *hdev,
goto out; goto out;
rule->state = HCLGE_FD_ACTIVE; rule->state = HCLGE_FD_ACTIVE;
hclge_update_fd_list(hdev, rule->state, rule->location, rule);
hdev->fd_active_type = rule->rule_type; hdev->fd_active_type = rule->rule_type;
hclge_update_fd_list(hdev, rule->state, rule->location, rule);
out: out:
spin_unlock_bh(&hdev->fd_rule_lock); spin_unlock_bh(&hdev->fd_rule_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment