Re: [PATCH] fixup: mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrew,

After applying this fix patch, the following modifications also need to
be applied to the "[PATCH v6 45/45] mm: shrinker: convert shrinker_rwsem
to mutex".

diff --git a/mm/shrinker.c b/mm/shrinker.c
index 6857cbb520ea..dd91eab43ed3 100644
--- a/mm/shrinker.c
+++ b/mm/shrinker.c
@@ -96,7 +96,7 @@ int alloc_shrinker_info(struct mem_cgroup *memcg)
        return ret;

 err:
-       up_write(&shrinker_rwsem);
+       mutex_unlock(&shrinker_mutex);
        free_shrinker_info(memcg);
        return -ENOMEM;
 }

Or do I need to resend the entire patch set? If yes please let me know.

Thanks,
Qi

On 2023/9/28 22:15, Qi Zheng wrote:
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;
  }



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux