kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: wwan: iosm: fix memory leak in ipc_devlink_create_region()
@ 2021-09-15 10:35 Dan Carpenter
  2021-09-15 11:05 ` Kumar, M Chetan
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-09-15 10:35 UTC (permalink / raw)
  To: M Chetan Kumar
  Cc: Intel Corporation, Loic Poulain, Sergey Ryazanov, Johannes Berg,
	David S. Miller, Jakub Kicinski, netdev, kernel-janitors

This doesn't free the first region in devlink->cd_regions[0] so it's a
memory leak.

Fixes: 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump collection")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wwan/iosm/iosm_ipc_devlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.c b/drivers/net/wwan/iosm/iosm_ipc_devlink.c
index 592792c277fe..6d4f592ba0b6 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_devlink.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_devlink.c
@@ -231,7 +231,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink)
 {
 	struct devlink_region_ops *mdm_coredump;
 	int rc = 0;
-	u8 i;
+	int i;
 
 	mdm_coredump = devlink->iosm_devlink_mdm_coredump;
 	for (i = 0; i < IOSM_NOF_CD_REGION; i++) {
@@ -247,7 +247,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink)
 			rc = PTR_ERR(devlink->cd_regions[i]);
 			dev_err(devlink->dev, "Devlink region fail,err %d", rc);
 			/* Delete previously created regions */
-			for ( ; i > 0; i--)
+			for ( ; i >= 0; i--)
 				devlink_region_destroy(devlink->cd_regions[i]);
 			goto region_create_fail;
 		}
-- 
2.20.1


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

* RE: [PATCH net-next] net: wwan: iosm: fix memory leak in ipc_devlink_create_region()
  2021-09-15 10:35 [PATCH net-next] net: wwan: iosm: fix memory leak in ipc_devlink_create_region() Dan Carpenter
@ 2021-09-15 11:05 ` Kumar, M Chetan
  2021-09-15 19:58   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar, M Chetan @ 2021-09-15 11:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linuxwwan, Loic Poulain, Sergey Ryazanov, Johannes Berg,
	David S. Miller, Jakub Kicinski, netdev, kernel-janitors

> This doesn't free the first region in devlink->cd_regions[0] so it's a memory
> leak.
> 
> Fixes: 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump
> collection")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_devlink.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: M Chetan Kumar <m.chetan.kumar@intel.com>

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

* Re: [PATCH net-next] net: wwan: iosm: fix memory leak in ipc_devlink_create_region()
  2021-09-15 11:05 ` Kumar, M Chetan
@ 2021-09-15 19:58   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-09-15 19:58 UTC (permalink / raw)
  To: Kumar, M Chetan
  Cc: Dan Carpenter, linuxwwan, Loic Poulain, Sergey Ryazanov,
	Johannes Berg, David S. Miller, netdev, kernel-janitors

On Wed, 15 Sep 2021 11:05:42 +0000 Kumar, M Chetan wrote:
> > This doesn't free the first region in devlink->cd_regions[0] so it's a memory
> > leak.
> > 
> > Fixes: 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump
> > collection")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/net/wwan/iosm/iosm_ipc_devlink.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)  
> 
> Reviewed-by: M Chetan Kumar <m.chetan.kumar@intel.com>

I'll toss this from patchwork because I'm going to post a revert 
of the entire patch.

The abuse of devlink params for configuring flashing process is
unacceptable.

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

end of thread, other threads:[~2021-09-15 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 10:35 [PATCH net-next] net: wwan: iosm: fix memory leak in ipc_devlink_create_region() Dan Carpenter
2021-09-15 11:05 ` Kumar, M Chetan
2021-09-15 19:58   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).