Skip to content

Commit

Permalink
fat: Fix possible null deref in fat_cache_add()
Browse files Browse the repository at this point in the history
Reported-by: <[email protected]>
Signed-off-by: OGAWA Hirofumi <[email protected]>
  • Loading branch information
OGAWAHirofumi committed Apr 12, 2011
1 parent 384f5c9 commit 7003092
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/fat/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7003092

Please sign in to comment.