Skip to content

Commit 52755b6

Browse files
Wang Haikuba-moo
authored andcommitted
cosa: Add missing kfree in error path of cosa_write
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 <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> Acked-by: Jan "Yenya" Kasprzak <kas@fi.muni.cz> Link: https://lore.kernel.org/r/20201110144614.43194-1-wanghai38@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 460cd17 commit 52755b6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/wan/cosa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file,
889889
chan->tx_status = 1;
890890
spin_unlock_irqrestore(&cosa->lock, flags);
891891
up(&chan->wsem);
892+
kfree(kbuf);
892893
return -ERESTARTSYS;
893894
}
894895
}

0 commit comments

Comments
 (0)