From 0d124578fed92cadeaca47d734da782beacdc1a7 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Tue, 28 Jan 2025 20:56:15 +0000 Subject: [PATCH] io_uring: remove !KASAN guards from cache free Test setups (with KASAN) will avoid !KASAN sections, and so it's not testing paths that would be exercised otherwise. That's bad as to be sure that your code works you now have to specifically test both KASAN and !KASAN configs. Remove !CONFIG_KASAN guards from io_netmsg_cache_free() and io_rw_cache_free(). The free functions should always be getting valid entries, and even though for KASAN iovecs should already be cleared, that's better than skipping the chunks completely. Signed-off-by: Pavel Begunkov Reviewed-by: Gabriel Krisman Bertazi Link: https://lore.kernel.org/r/d6078a51c7137a243f9d00849bc3daa660873209.1738087204.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- io_uring/net.c | 2 -- io_uring/rw.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/io_uring/net.c b/io_uring/net.c index 4d21f7bd2149e..d89c39f853e39 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1813,10 +1813,8 @@ void io_netmsg_cache_free(const void *entry) { struct io_async_msghdr *kmsg = (struct io_async_msghdr *) entry; -#if !defined(CONFIG_KASAN) if (kmsg->free_iov) io_netmsg_iovec_free(kmsg); -#endif kfree(kmsg); } #endif diff --git a/io_uring/rw.c b/io_uring/rw.c index 991ecfbea88e3..c496f195aae2b 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -1309,9 +1309,7 @@ void io_rw_cache_free(const void *entry) { struct io_async_rw *rw = (struct io_async_rw *) entry; -#if !defined(CONFIG_KASAN) if (rw->free_iovec) io_rw_iovec_free(rw); -#endif kfree(rw); } -- 2.50.1