* [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
@ 2024-12-16 7:05 Harshit Mogalapalli
2024-12-16 7:05 ` [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
2024-12-16 8:09 ` [PATCH next 1/2] octeontx2-pf: fix netdev memory leak " Przemek Kitszel
0 siblings, 2 replies; 6+ messages in thread
From: Harshit Mogalapalli @ 2024-12-16 7:05 UTC (permalink / raw)
To: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
Bharat Bhushan, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
incomplete iteration before going to "exit:" label.
Fixes: 3937b7308d4f ("octeontx2-pf: Create representor netdev")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is found by Smatch, based on static analysis, only compile tested.
---
drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
index 232b10740c13..9e3fcbae5dee 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
@@ -680,8 +680,10 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
ndev->features |= ndev->hw_features;
eth_hw_addr_random(ndev);
err = rvu_rep_devlink_port_register(rep);
- if (err)
+ if (err) {
+ free_netdev(ndev);
goto exit;
+ }
SET_NETDEV_DEVLINK_PORT(ndev, &rep->dl_port);
err = register_netdev(ndev);
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port in rvu_rep_create()
2024-12-16 7:05 [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create() Harshit Mogalapalli
@ 2024-12-16 7:05 ` Harshit Mogalapalli
2024-12-16 8:13 ` Przemek Kitszel
2024-12-16 8:09 ` [PATCH next 1/2] octeontx2-pf: fix netdev memory leak " Przemek Kitszel
1 sibling, 1 reply; 6+ messages in thread
From: Harshit Mogalapalli @ 2024-12-16 7:05 UTC (permalink / raw)
To: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
Bharat Bhushan, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
Unregister the devlink port when register_netdev() fails.
Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is from static analysis, only compile tested.
---
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.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port in rvu_rep_create()
2024-12-16 7:05 ` [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
@ 2024-12-16 8:13 ` Przemek Kitszel
0 siblings, 0 replies; 6+ messages in thread
From: Przemek Kitszel @ 2024-12-16 8:13 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: dan.carpenter, kernel-janitors, error27, Sunil Goutham,
Geetha sowjanya, Subbaraya Sundeep, hariprasad, Bharat Bhushan,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-kernel
On 12/16/24 08:05, Harshit Mogalapalli wrote:
> Unregister the devlink port when register_netdev() fails.
>
> Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
same comment that this is better applied to -net, otherwise fine for me:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> ---
> This is from static analysis, only compile tested.
> ---
> 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;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
2024-12-16 7:05 [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create() Harshit Mogalapalli
2024-12-16 7:05 ` [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
@ 2024-12-16 8:09 ` Przemek Kitszel
2024-12-16 9:05 ` Harshit Mogalapalli
1 sibling, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2024-12-16 8:09 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: dan.carpenter, kernel-janitors, error27, Sunil Goutham,
Geetha sowjanya, Subbaraya Sundeep, hariprasad, Bharat Bhushan,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-kernel
On 12/16/24 08:05, Harshit Mogalapalli wrote:
> When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
> incomplete iteration before going to "exit:" label.
>
> Fixes: 3937b7308d4f ("octeontx2-pf: Create representor netdev")
I would say that you are fixing:
Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
this is also a -net material
code is fine otherwise, so:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is found by Smatch, based on static analysis, only compile tested.
> ---
> drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
> index 232b10740c13..9e3fcbae5dee 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
> @@ -680,8 +680,10 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
> ndev->features |= ndev->hw_features;
> eth_hw_addr_random(ndev);
> err = rvu_rep_devlink_port_register(rep);
> - if (err)
> + if (err) {
> + free_netdev(ndev);
> goto exit;
> + }
>
> SET_NETDEV_DEVLINK_PORT(ndev, &rep->dl_port);
> err = register_netdev(ndev);
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
2024-12-16 8:09 ` [PATCH next 1/2] octeontx2-pf: fix netdev memory leak " Przemek Kitszel
@ 2024-12-16 9:05 ` Harshit Mogalapalli
2024-12-16 9:15 ` Przemek Kitszel
0 siblings, 1 reply; 6+ messages in thread
From: Harshit Mogalapalli @ 2024-12-16 9:05 UTC (permalink / raw)
To: Przemek Kitszel
Cc: dan.carpenter, kernel-janitors, error27, Sunil Goutham,
Geetha sowjanya, Subbaraya Sundeep, hariprasad, Bharat Bhushan,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-kernel
Hi,
On 16/12/24 13:39, Przemek Kitszel wrote:
> On 12/16/24 08:05, Harshit Mogalapalli wrote:
>> When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
>> incomplete iteration before going to "exit:" label.
>>
>> Fixes: 3937b7308d4f ("octeontx2-pf: Create representor netdev")
>
Thanks for the review.
> I would say that you are fixing:
> Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
>
Oh right, thank you for catching that. Will fix in V2.
> this is also a -net material
So while sending a V2 I will include [PATCH net-next], that sounds good ?
Thanks,
Harshit
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
2024-12-16 9:05 ` Harshit Mogalapalli
@ 2024-12-16 9:15 ` Przemek Kitszel
0 siblings, 0 replies; 6+ messages in thread
From: Przemek Kitszel @ 2024-12-16 9:15 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: dan.carpenter, kernel-janitors, error27, Sunil Goutham,
Geetha sowjanya, Subbaraya Sundeep, hariprasad, Bharat Bhushan,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-kernel
On 12/16/24 10:05, Harshit Mogalapalli wrote:
> Hi,
>
> On 16/12/24 13:39, Przemek Kitszel wrote:
>> On 12/16/24 08:05, Harshit Mogalapalli wrote:
>>> When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
>>> incomplete iteration before going to "exit:" label.
>>>
>>> Fixes: 3937b7308d4f ("octeontx2-pf: Create representor netdev")
>>
>
> Thanks for the review.
>> I would say that you are fixing:
>> Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
>>
> Oh right, thank you for catching that. Will fix in V2.
>> this is also a -net material
>
> So while sending a V2 I will include [PATCH net-next], that sounds good ?
Just [PATCH net v2].
Please add my Reviewed-by tags to both patches.
Please wait also one day, to don't send same series twice within 24h.
>
> Thanks,
> Harshit
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-16 9:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 7:05 [PATCH next 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create() Harshit Mogalapalli
2024-12-16 7:05 ` [PATCH next 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
2024-12-16 8:13 ` Przemek Kitszel
2024-12-16 8:09 ` [PATCH next 1/2] octeontx2-pf: fix netdev memory leak " Przemek Kitszel
2024-12-16 9:05 ` Harshit Mogalapalli
2024-12-16 9:15 ` Przemek Kitszel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox