[PATCH 20/62] octeontx2-pf: Fix locking in an error path
From: Bart Van Assche
Date: Mon Feb 23 2026 - 17:08:58 EST
From: Bart Van Assche <bvanassche@xxxxxxx>
Only unlock pf->mbox.lock if it has been locked by otx2_do_set_vf_vlan().
This bug has been detected by the Clang thread-safety analyzer.
Cc: Naveen Mamindlapalli <naveenm@xxxxxxxxxxx>
Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
Cc: Sunil Goutham <sgoutham@xxxxxxxxxxx>
Cc: Geetha sowjanya <gakula@xxxxxxxxxxx>
Cc: Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>
Cc: hariprasad <hkelam@xxxxxxxxxxx>
Cc: Bharat Bhushan <bbhushan2@xxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Fixes: f0c2982aaf98 ("octeontx2-pf: Add support for SR-IOV management functions")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index ee623476e5ff..8c9f08ed90fd 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2588,7 +2588,7 @@ static int otx2_do_set_vf_vlan(struct otx2_nic *pf, int vf, u16 vlan, u8 qos,
config = &pf->vf_configs[vf];
if (!vlan && !config->vlan)
- goto out;
+ return err;
mutex_lock(&pf->mbox.lock);