]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iavf: don't clear a lock we don't hold
authorNicholas Nunley <nicholas.d.nunley@intel.com>
Fri, 4 Jun 2021 16:48:55 +0000 (09:48 -0700)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:34:09 +0000 (07:34 +0100)
BugLink: https://bugs.launchpad.net/bugs/1952579
[ Upstream commit 2135a8d5c8186bc92901dc00f179ffd50e54c2ac ]

In iavf_configure_clsflower() the function will bail out if it is unable
to obtain the crit_section lock in a reasonable time. However, it will
clear the lock when exiting, so fix this.

Fixes: 640a8af5841f ("i40evf: Reorder configure_clsflower to avoid deadlock on error")
Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/net/ethernet/intel/iavf/iavf_main.c

index 5664a1905e8bb668f86b96987318d30285b85686..f64ccf6286ec1302c749def6456b8a27833741ae 100644 (file)
@@ -3041,8 +3041,10 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,
                return -ENOMEM;
 
        while (!mutex_trylock(&adapter->crit_lock)) {
-               if (--count == 0)
-                       goto err;
+               if (--count == 0) {
+                       kfree(filter);
+                       return err;
+               }
                udelay(1);
        }