Skip to content

Commit f589856

Browse files
Yuan Cananguy11
authored andcommitted
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: d6b98c8 ("ice: add write functionality for GNSS TTY") Signed-off-by: Yuan Can <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Tested-by: Gurucharan G <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 7d6ceeb commit f589856

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/intel/ice/ice_gnss.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ ice_gnss_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
363363
/* Send the data out to a hardware port */
364364
write_buf = kzalloc(sizeof(*write_buf), GFP_KERNEL);
365365
if (!write_buf) {
366+
kfree(cmd_buf);
366367
err = -ENOMEM;
367368
goto exit;
368369
}

0 commit comments

Comments
 (0)