Dan Carpenter reported the following bug: ``` The patch b6884b5f15cf: "mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}" from Sep 11, 2023 (linux-next), leads to the following Smatch static checker warning: mm/shrinker.c:100 alloc_shrinker_info() warn: inconsistent returns '&shrinker_mutex'. ``` To fix it, unlock the &shrinker_rwsem before the call to free_shrinker_info(). Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Closes: https://lore.kernel.org/linux-mm/f960ae49-078c-4c00-9516-da31fc1a17d6@moroto.mountain/ Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> --- mm/shrinker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/shrinker.c b/mm/shrinker.c index 893079806553..e9644cda80b5 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -95,6 +95,7 @@ int alloc_shrinker_info(struct mem_cgroup *memcg) return ret; err: + up_write(&shrinker_rwsem); free_shrinker_info(memcg); return -ENOMEM; } -- 2.30.2