projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
384f5c9
)
fat: Fix possible null deref in fat_cache_add()
author
OGAWA Hirofumi
<hirofumi@mail.parknet.co.jp>
Tue, 12 Apr 2011 12:08:38 +0000
(21:08 +0900)
committer
OGAWA Hirofumi
<hirofumi@mail.parknet.co.jp>
Tue, 12 Apr 2011 12:12:16 +0000
(21:12 +0900)
Reported-by: <dame_eugene@mail.ru>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
fs/fat/cache.c
patch
|
blob
|
history
diff --git
a/fs/fat/cache.c
b/fs/fat/cache.c
index ae8200f84e395f4e27680d509e28ade20807c82e..1cc7038e273de02bb404c91623bec8f65cd85288 100644
(file)
--- a/
fs/fat/cache.c
+++ b/
fs/fat/cache.c
@@
-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) {