Skip to content

Commit

Permalink
cosa: Add missing kfree in error path of cosa_write
Browse files Browse the repository at this point in the history
If memory allocation for 'kbuf' succeed, cosa_write() doesn't have a
corresponding kfree() in exception handling. Thus add kfree() for this
function implementation.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wang Hai <[email protected]>
Acked-by: Jan "Yenya" Kasprzak <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Wang Hai authored and kuba-moo committed Nov 12, 2020
1 parent 460cd17 commit 52755b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/wan/cosa.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file,
chan->tx_status = 1;
spin_unlock_irqrestore(&cosa->lock, flags);
up(&chan->wsem);
kfree(kbuf);
return -ERESTARTSYS;
}
}
Expand Down

0 comments on commit 52755b6

Please sign in to comment.