Patch "ice: Fix potential memory leak in ice_gnss_tty_write()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ice: Fix potential memory leak in ice_gnss_tty_write()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ice-fix-potential-memory-leak-in-ice_gnss_tty_write.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit dd52bce5069fb1f62a55aa0d491e163da7fa0b36
Author: Yuan Can <yuancan@xxxxxxxxxx>
Date:   Wed Dec 7 08:55:02 2022 +0000

    ice: Fix potential memory leak in ice_gnss_tty_write()
    
    [ Upstream commit f58985620f55580a07d40062c4115d8c9cf6ae27 ]
    
    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@xxxxxxxxxx>
    Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Tested-by: Gurucharan G <gurucharanx.g@xxxxxxxxx> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux