mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 05:32:00 +00:00
net: qrtr: fix memort leak in qrtr_tun_write_iter
In qrtr_tun_write_iter the allocated kbuf should be release in case of error or success return. v2 Update: Thanks to David Miller for pointing out the release on success path as well. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
10cc514f45
commit
a21b7f0cff
@ -84,11 +84,14 @@ static ssize_t qrtr_tun_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||
if (!kbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!copy_from_iter_full(kbuf, len, from))
|
||||
if (!copy_from_iter_full(kbuf, len, from)) {
|
||||
kfree(kbuf);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
ret = qrtr_endpoint_post(&tun->ep, kbuf, len);
|
||||
|
||||
kfree(kbuf);
|
||||
return ret < 0 ? ret : len;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user