Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set()
@ 2021-11-29 15:16 Wei Yongjun
  2021-11-29 15:17 ` Vladimir Oltean
  2021-11-30  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2021-11-29 15:16 UTC (permalink / raw)
  To: weiyongjun1, Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski, Russell King
  Cc: netdev, kernel-janitors, Hulk Robot

Add the missing mutex_unlock before return from function
ocelot_hwstamp_set() in the ocelot_setup_ptp_traps() error
handling case.

Fixes: 96ca08c05838 ("net: mscc: ocelot: set up traps for PTP packets")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index fe8abb30f185..b1856d8c944b 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1651,8 +1651,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;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-30  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 15:16 [PATCH net-next] net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set() Wei Yongjun
2021-11-29 15:17 ` Vladimir Oltean
2021-11-30  4:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox