]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/iov_iter: fix import_iovec_ubuf iovec management
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 31 Jan 2025 14:13:15 +0000 (14:13 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:22 +0000 (04:30 -0800)
commitcd1c4113ba9e100d889a5b702c5b42c62026bf88
tree64284fe9c6195b7cb5c8810e784bc7ee97bdbe1a
parent3fb84dfb978473f1b79a2541cb81a7f4820d2397
lib/iov_iter: fix import_iovec_ubuf iovec management

commit f4b78260fc678ccd7169f32dc9f3bfa3b93931c7 upstream.

import_iovec() says that it should always be fine to kfree the iovec
returned in @iovp regardless of the error code.  __import_iovec_ubuf()
never reallocates it and thus should clear the pointer even in cases when
copy_iovec_*() fail.

Link: https://lkml.kernel.org/r/378ae26923ffc20fd5e41b4360d673bf47b1775b.1738332461.git.asml.silence@gmail.com
Fixes: 3b2deb0e46da ("iov_iter: import single vector iovecs as ITER_UBUF")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/iov_iter.c