diff mbox series

[net,v2,2/2] octeontx2-pf: fix error handling of devlink port in rvu_rep_create()

Message ID 20241217052326.1086191-2-harshit.m.mogalapalli@oracle.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net,v2,1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
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/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
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, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-17--06-01 (tests: 795)

Commit Message

Harshit Mogalapalli Dec. 17, 2024, 5:23 a.m. UTC
Unregister the devlink port when register_netdev() fails.

Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
v1->v2:  Add R.B from Przemek
---
 drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Geethasowjanya Akula Dec. 18, 2024, 6:04 a.m. UTC | #1
>-----Original Message-----
>From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>Sent: Tuesday, December 17, 2024 10:53 AM
>To: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Geethasowjanya Akula
><gakula@marvell.com>; Subbaraya Sundeep Bhatta <sbhatta@marvell.com>;
>Hariprasad Kelam <hkelam@marvell.com>; Bharat Bhushan
><bbhushan2@marvell.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David
>S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
>Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Simon
>Horman <horms@kernel.org>; netdev@vger.kernel.org; linux-
>kernel@vger.kernel.org
>Cc: dan.carpenter@linaro.org; kernel-janitors@vger.kernel.org;
>error27@gmail.com; harshit.m.mogalapalli@oracle.com; Przemek Kitszel
><przemyslaw.kitszel@intel.com>
>Subject: [EXTERNAL] [PATCH net v2 2/2] octeontx2-pf: fix error handling of
>devlink port in rvu_rep_create()
>
>Unregister the devlink port when register_netdev() fails.
>
>Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
>Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>---
>v1->v2:  Add R.B from Przemek
>---
> drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>index 9e3fcbae5dee..04e08e06f30f 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
>@@ -690,6 +690,7 @@ int rvu_rep_create(struct otx2_nic *priv, struct
>netlink_ext_ack *extack)
> 		if (err) {
> 			NL_SET_ERR_MSG_MOD(extack,
> 					   "PFVF representor registration
>failed");
>+			rvu_rep_devlink_port_unregister(rep);
> 			free_netdev(ndev);
> 			goto exit;
> 		}
>--
>2.46.0
Ack.
Thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
index 9e3fcbae5dee..04e08e06f30f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
@@ -690,6 +690,7 @@  int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
 		if (err) {
 			NL_SET_ERR_MSG_MOD(extack,
 					   "PFVF representor registration failed");
+			rvu_rep_devlink_port_unregister(rep);
 			free_netdev(ndev);
 			goto exit;
 		}