lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20180110045812.GD5809@thunk.org> Date: Tue, 9 Jan 2018 23:58:12 -0500 From: Theodore Ts'o <tytso@....edu> To: Jiang Biao <jiang.biao2@....com.cn> Cc: linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org, ebiggers@...gle.com, akpm@...ux-foundation.org, jack@...e.cz, zhong.weidong@....com.cn Subject: Re: [PATCH v2] fs/mbcache: make sure mb_cache_count() not return negative value. I think I've found the cause of it, but having a sanity check is a good idea. I've simplified the patch and its description, though. This is what I have in my tree. - Ted commit 252194e48f00d146de303822bba8c3568ca127cd Author: Jiang Biao <jiang.biao2@....com.cn> Date: Tue Jan 9 23:57:52 2018 -0500 mbcache: make sure c_entry_count is not decremented past zero Signed-off-by: Jiang Biao <jiang.biao2@....com.cn> Signed-off-by: Theodore Ts'o <tytso@....edu> CC: Eric Biggers <ebiggers@...gle.com> CC: Andrew Morton <akpm@...ux-foundation.org> CC: Jan Kara <jack@...e.cz> diff --git a/fs/mbcache.c b/fs/mbcache.c index 0851af5c1c3d..f2f15b747bed 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -239,7 +239,9 @@ void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value) spin_lock(&cache->c_list_lock); if (!list_empty(&entry->e_list)) { list_del_init(&entry->e_list); - cache->c_entry_count--; + if (!WARN_ONCE(cache->c_entry_count == 0, + "mbcache: attempt to decrement c_entry_count past zero")) + cache->c_entry_count--; atomic_dec(&entry->e_refcnt); } spin_unlock(&cache->c_list_lock);
Powered by blists - more mailing lists