diff mbox series

[net-next] net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set()

Message ID 20211129151652.1165433-1-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Commit 1a59c9c55585e1ec5b352d31b3f8402f196eae94
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: richardcochran@gmail.com; 1 maintainers not CCed: richardcochran@gmail.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wei Yongjun Nov. 29, 2021, 3:16 p.m. UTC
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(-)

Comments

Vladimir Oltean Nov. 29, 2021, 3:17 p.m. UTC | #1
On Mon, Nov 29, 2021 at 03:16:52PM +0000, Wei Yongjun wrote:
> 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>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
patchwork-bot+netdevbpf@kernel.org Nov. 30, 2021, 4:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 29 Nov 2021 15:16:52 +0000 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net-next] net: mscc: ocelot: fix missing unlock on error in ocelot_hwstamp_set()
    https://git.kernel.org/netdev/net/c/1a59c9c55585

You are awesome, thank you!
diff mbox series

Patch

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;