Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fat: Fix possible null deref in fat_cache_add()

Reported-by: <dame_eugene@mail.ru>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

+7
+7
fs/fat/cache.c
··· 151 151 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); 152 152 153 153 tmp = fat_cache_alloc(inode); 154 + if (!tmp) { 155 + spin_lock(&MSDOS_I(inode)->cache_lru_lock); 156 + MSDOS_I(inode)->nr_caches--; 157 + spin_unlock(&MSDOS_I(inode)->cache_lru_lock); 158 + return; 159 + } 160 + 154 161 spin_lock(&MSDOS_I(inode)->cache_lru_lock); 155 162 cache = fat_cache_merge(inode, new); 156 163 if (cache != NULL) {