diff options
author | Jiang Biao <jiang.biao2@zte.com.cn> | 2018-01-09 23:57:52 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-01-09 23:57:52 -0500 |
commit | 9ee93ba3c430d5b5140ab72738dc70c4c54990e0 (patch) | |
tree | d7d52f041c158c0837fb66bf2104829b70637437 /fs/mbcache.c | |
parent | a90ac0f5dc17f23d15f20abdb9d08ef07f155480 (diff) | |
download | lwn-9ee93ba3c430d5b5140ab72738dc70c4c54990e0.tar.gz lwn-9ee93ba3c430d5b5140ab72738dc70c4c54990e0.zip |
mbcache: make sure c_entry_count is not decremented past zero
Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
CC: Eric Biggers <ebiggers@google.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/mbcache.c')
-rw-r--r-- | fs/mbcache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/mbcache.c b/fs/mbcache.c index 49c5b25bfa8c..bf41e2e72c18 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); |