Re: [PATCH net 1/7] net: hns3: fix add VLAN fail issue

From: Jijie Shao
Date: Thu Nov 02 2023 - 08:29:41 EST



on 2023/11/2 18:31, Paolo Abeni wrote:
On Sat, 2023-10-28 at 10:59 +0800, Jijie Shao wrote:

/* when port base vlan enabled, we use port base vlan as the vlan
* filter entry. In this case, we don't update vlan filter table
@@ -10481,7 +10482,9 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
* and try to remove it from hw later, to be consistence
* with stack
*/
+ mutex_lock(&hdev->vport_lock);
set_bit(vlan_id, vport->vlan_del_fail_bmap);
+ mutex_unlock(&hdev->vport_lock);
It looks like that the 'hclge_rm_vport_vlan_table()' call a few lines
above will now happen with the vport_lock unlocked.

That looks racy and would deserve at least a comment explaining why
it's safe.

Thanks,

Paolo

Yeah, this is a problem that causes the function to be invoked when it is not locked. We'll get lock before the function be invoked in V2 Thanks, Jijie