summaryrefslogtreecommitdiffstats
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2023-03-30 14:52:38 +0200
committerJens Axboe <axboe@kernel.dk>2023-03-30 14:53:42 +0200
commitfd30d1cdcc4ff405fc54765edf2e11b03f2ed4f3 (patch)
tree418e351d7b94cff15ac165353e2064b5ee0b3a0a /io_uring
parentio_uring/rsrc: fix rogue rsrc node grabbing (diff)
downloadlinux-fd30d1cdcc4ff405fc54765edf2e11b03f2ed4f3.tar.xz
linux-fd30d1cdcc4ff405fc54765edf2e11b03f2ed4f3.zip
io_uring: fix poll/netmsg alloc caches
We increase cache->nr_cached when we free into the cache but don't decrease when we take from it, so in some time we'll get an empty cache with cache->nr_cached larger than IO_ALLOC_CACHE_MAX, that fails io_alloc_cache_put() and effectively disables caching. Fixes: 9b797a37c4bd8 ("io_uring: add abstraction around apoll cache") Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/alloc_cache.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/io_uring/alloc_cache.h b/io_uring/alloc_cache.h
index 729793ae9712..c2cde88aeed5 100644
--- a/io_uring/alloc_cache.h
+++ b/io_uring/alloc_cache.h
@@ -27,6 +27,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c
struct hlist_node *node = cache->list.first;
hlist_del(node);
+ cache->nr_cached--;
return container_of(node, struct io_cache_entry, node);
}