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>
This commit is contained in:
OGAWA Hirofumi 2011-04-12 21:08:38 +09:00
parent 384f5c96ea
commit 7003092955
1 changed files with 7 additions and 0 deletions

View File

@ -151,6 +151,13 @@ static void fat_cache_add(struct inode *inode, struct fat_cache_id *new)
spin_unlock(&MSDOS_I(inode)->cache_lru_lock);
tmp = fat_cache_alloc(inode);
if (!tmp) {
spin_lock(&MSDOS_I(inode)->cache_lru_lock);
MSDOS_I(inode)->nr_caches--;
spin_unlock(&MSDOS_I(inode)->cache_lru_lock);
return;
}
spin_lock(&MSDOS_I(inode)->cache_lru_lock);
cache = fat_cache_merge(inode, new);
if (cache != NULL) {