intel-wired-lan.lists.osuosl.org archive mirror
 help / color / mirror / Atom feed
* Re: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
@ 2023-01-04  7:00 Stany V, Vasanth
  2023-01-05  5:15 ` Stany V, Vasanth
  0 siblings, 1 reply; 5+ messages in thread
From: Stany V, Vasanth @ 2023-01-04  7:00 UTC (permalink / raw)
  To: Yuan Can, Brandeburg, Jesse, Nguyen, Anthony L, davem, edumazet,
	kuba, pabeni, Kolacinski, Karol, intel-wired-lan, netdev


[-- Attachment #1.1: Type: text/plain, Size: 1442 bytes --]

> -----Original Message-----

> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org<mailto:intel-wired-lan-bounces@osuosl.org>> On Behalf Of Yuan Can

> Sent: Wednesday, December 7, 2022 12:55 AM

> To: Brandeburg, Jesse <jesse.brandeburg@intel.com<mailto:jesse.brandeburg@intel.com>>; Nguyen, Anthony L <anthony.l.nguyen@intel.com<mailto:anthony.l.nguyen@intel.com>>; davem@davemloft.net<mailto:davem@davemloft.net>; edumazet@google.com<mailto:edumazet@google.com>; kuba@kernel.org<mailto:kuba@kernel.org>; pabeni@redhat.com<mailto:pabeni@redhat.com>; Kolacinski, Karol <karol.kolacinski@intel.com<mailto:karol.kolacinski@intel.com>>; intel-wired-lan@lists.osuosl.org<mailto:intel-wired-lan@lists.osuosl.org>; netdev@vger.kernel.org<mailto:netdev@vger.kernel.org>

> Cc: yuancan@huawei.com<mailto:yuancan@huawei.com>

> Subject: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()

>

> The ice_gnss_tty_write() return directly if the write_buf alloc failed, leaking the cmd_buf.

>

> Fix by free cmd_buf if write_buf alloc failed.

>

> Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")

> Signed-off-by: Yuan Can <yuancan@huawei.com<mailto:yuancan@huawei.com>>

> ---

> drivers/net/ethernet/intel/ice/ice_gnss.c | 1 +

> 1 file changed, 1 insertion(+)

Tested-by:  Vasanth Stany < vasanth.stany.v@intel.com<mailto:vasanth.stany.v@intel.com> >




[-- Attachment #1.2: Type: text/html, Size: 4336 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
  2023-01-04  7:00 [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write() Stany V, Vasanth
@ 2023-01-05  5:15 ` Stany V, Vasanth
  0 siblings, 0 replies; 5+ messages in thread
From: Stany V, Vasanth @ 2023-01-05  5:15 UTC (permalink / raw)
  To: Yuan Can, Brandeburg, Jesse, Nguyen, Anthony L, davem, edumazet,
	kuba, pabeni, Kolacinski, Karol, intel-wired-lan, netdev

> -----Original Message-----
> From: Intel-wired-lan <mailto:intel-wired-lan-bounces@osuosl.org> On Behalf Of Yuan Can
> Sent: Wednesday, December 7, 2022 12:55 AM
> To: Brandeburg, Jesse <mailto:jesse.brandeburg@intel.com>; Nguyen, Anthony L <mailto:anthony.l.nguyen@intel.com>; mailto:davem@davemloft.net; mailto:edumazet@google.com; mailto:kuba@kernel.org; mailto:pabeni@redhat.com; Kolacinski, Karol <mailto:karol.kolacinski@intel.com>; mailto:intel-wired-lan@lists.osuosl.org; mailto:netdev@vger.kernel.org
> Cc: mailto:yuancan@huawei.com
> Subject: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
>
> The ice_gnss_tty_write() return directly if the write_buf alloc failed, leaking the cmd_buf.
>
> Fix by free cmd_buf if write_buf alloc failed.
>
> Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
> Signed-off-by: Yuan Can <mailto:yuancan@huawei.com>
> ---
> drivers/net/ethernet/intel/ice/ice_gnss.c | 1 +
> 1 file changed, 1 insertion(+)
Tested-by:  Vasanth Stany < mailto:vasanth.stany.v@intel.com > 



_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
  2022-12-07  8:55 Yuan Can
  2022-12-07  9:15 ` Leon Romanovsky
@ 2023-01-05  5:51 ` G, GurucharanX
  1 sibling, 0 replies; 5+ messages in thread
From: G, GurucharanX @ 2023-01-05  5:51 UTC (permalink / raw)
  To: Yuan Can, Brandeburg, Jesse, Nguyen, Anthony L, davem, edumazet,
	kuba, pabeni, Kolacinski, Karol, intel-wired-lan, netdev



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Yuan Can
> Sent: Wednesday, December 7, 2022 2:25 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; Kolacinski,
> Karol <karol.kolacinski@intel.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org
> Cc: yuancan@huawei.com
> Subject: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in
> ice_gnss_tty_write()
> 
> The ice_gnss_tty_write() return directly if the write_buf alloc failed, leaking
> the cmd_buf.
> 
> Fix by free cmd_buf if write_buf alloc failed.
> 
> Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_gnss.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
  2022-12-07  8:55 Yuan Can
@ 2022-12-07  9:15 ` Leon Romanovsky
  2023-01-05  5:51 ` G, GurucharanX
  1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-12-07  9:15 UTC (permalink / raw)
  To: Yuan Can
  Cc: karol.kolacinski, intel-wired-lan, jesse.brandeburg, edumazet,
	anthony.l.nguyen, netdev, kuba, pabeni, davem

On Wed, Dec 07, 2022 at 08:55:02AM +0000, Yuan Can wrote:
> The ice_gnss_tty_write() return directly if the write_buf alloc failed,
> leaking the cmd_buf.
> 
> Fix by free cmd_buf if write_buf alloc failed.
> 
> Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_gnss.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write()
@ 2022-12-07  8:55 Yuan Can
  2022-12-07  9:15 ` Leon Romanovsky
  2023-01-05  5:51 ` G, GurucharanX
  0 siblings, 2 replies; 5+ messages in thread
From: Yuan Can @ 2022-12-07  8:55 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
	pabeni, karol.kolacinski, intel-wired-lan, netdev
  Cc: yuancan

The ice_gnss_tty_write() return directly if the write_buf alloc failed,
leaking the cmd_buf.

Fix by free cmd_buf if write_buf alloc failed.

Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/net/ethernet/intel/ice/ice_gnss.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index b5a7f246d230..a1915551c69a 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -363,6 +363,7 @@ ice_gnss_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
 	/* Send the data out to a hardware port */
 	write_buf = kzalloc(sizeof(*write_buf), GFP_KERNEL);
 	if (!write_buf) {
+		kfree(cmd_buf);
 		err = -ENOMEM;
 		goto exit;
 	}
-- 
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2023-01-05 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04  7:00 [Intel-wired-lan] [PATCH net] ice: Fix potential memory leak in ice_gnss_tty_write() Stany V, Vasanth
2023-01-05  5:15 ` Stany V, Vasanth
  -- strict thread matches above, loose matches on Subject: below --
2022-12-07  8:55 Yuan Can
2022-12-07  9:15 ` Leon Romanovsky
2023-01-05  5:51 ` G, GurucharanX

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).