mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
io_uring: fix recvmsg memory leak with buffer selection
io_recvmsg() doesn't free memory allocated for struct io_buffer. This can causes a leak when used with automatic buffer selection. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
16d598030a
commit
681fda8d27
@ -3845,10 +3845,16 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock)
|
||||
|
||||
ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.msg,
|
||||
kmsg->uaddr, flags);
|
||||
if (force_nonblock && ret == -EAGAIN)
|
||||
return io_setup_async_msg(req, kmsg);
|
||||
if (force_nonblock && ret == -EAGAIN) {
|
||||
ret = io_setup_async_msg(req, kmsg);
|
||||
if (ret != -EAGAIN)
|
||||
kfree(kbuf);
|
||||
return ret;
|
||||
}
|
||||
if (ret == -ERESTARTSYS)
|
||||
ret = -EINTR;
|
||||
if (kbuf)
|
||||
kfree(kbuf);
|
||||
}
|
||||
|
||||
if (kmsg && kmsg->iov != kmsg->fast_iov)
|
||||
|
Loading…
Reference in New Issue
Block a user