Commit 52755b66 authored by Wang Hai's avatar Wang Hai Committed by Jakub Kicinski

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: 1da177e4 ("Linux-2.6.12-rc2")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
Acked-by: default avatarJan "Yenya" Kasprzak <kas@fi.muni.cz>
Link: https://lore.kernel.org/r/20201110144614.43194-1-wanghai38@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 460cd17e
...@@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file, ...@@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file,
chan->tx_status = 1; chan->tx_status = 1;
spin_unlock_irqrestore(&cosa->lock, flags); spin_unlock_irqrestore(&cosa->lock, flags);
up(&chan->wsem); up(&chan->wsem);
kfree(kbuf);
return -ERESTARTSYS; return -ERESTARTSYS;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment