]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 29 Nov 2021 15:16:52 +0000 (15:16 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 30 Nov 2021 04:20:34 +0000 (20:20 -0800)
Add the missing mutex_unlock before return from function
ocelot_hwstamp_set() in the ocelot_setup_ptp_traps() error
handling case.

Fixes: 53d36c1d30aa ("net: mscc: ocelot: set up traps for PTP packets")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20211129151652.1165433-1-weiyongjun1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot.c

index 409cde1e59c6f2caeb34848ca405cc873007c7ed..1e4ad953cffbc5fc066954c75f6b2bf9469142e9 100644 (file)
@@ -1563,8 +1563,10 @@ int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr)
        }
 
        err = ocelot_setup_ptp_traps(ocelot, port, l2, l4);
-       if (err)
+       if (err) {
+               mutex_unlock(&ocelot->ptp_lock);
                return err;
+       }
 
        if (l2 && l4)
                cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;