diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 23:00:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 23:00:43 -0500 |
commit | 4c9a44aebeaef35570a67aed17b72a2cf8d0b219 (patch) | |
tree | abb874fe7f50671627b282f6c7fb58db5e75a2e3 /fs/hfsplus/bitmap.c | |
parent | 1f0377ff088ed2971c57debc9b0c3b846ec431fd (diff) | |
parent | cfde819088422503b5c69e03ab7bb90f87121d4d (diff) |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge the rest of Andrew's patches for -rc1:
"A bunch of fixes and misc missed-out-on things.
That'll do for -rc1. I still have a batch of IPC patches which still
have a possible bug report which I'm chasing down."
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (25 commits)
keys: use keyring_alloc() to create module signing keyring
keys: fix unreachable code
sendfile: allows bypassing of notifier events
SGI-XP: handle non-fatal traps
fat: fix incorrect function comment
Documentation: ABI: remove testing/sysfs-devices-node
proc: fix inconsistent lock state
linux/kernel.h: fix DIV_ROUND_CLOSEST with unsigned divisors
memcg: don't register hotcpu notifier from ->css_alloc()
checkpatch: warn on uapi #includes that #include <uapi/...
revert "rtc: recycle id when unloading a rtc driver"
mm: clean up transparent hugepage sysfs error messages
hfsplus: add error message for the case of failure of sync fs in delayed_sync_fs() method
hfsplus: rework processing of hfs_btree_write() returned error
hfsplus: rework processing errors in hfsplus_free_extents()
hfsplus: avoid crash on failed block map free
kcmp: include linux/ptrace.h
drivers/rtc/rtc-imxdi.c: must include <linux/spinlock.h>
mm: cma: WARN if freed memory is still in use
exec: do not leave bprm->interp on stack
...
Diffstat (limited to 'fs/hfsplus/bitmap.c')
-rw-r--r-- | fs/hfsplus/bitmap.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c index 4cfbe2edd29..6feefc0cb48 100644 --- a/fs/hfsplus/bitmap.c +++ b/fs/hfsplus/bitmap.c | |||
@@ -176,12 +176,14 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
176 | dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); | 176 | dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); |
177 | /* are all of the bits in range? */ | 177 | /* are all of the bits in range? */ |
178 | if ((offset + count) > sbi->total_blocks) | 178 | if ((offset + count) > sbi->total_blocks) |
179 | return -2; | 179 | return -ENOENT; |
180 | 180 | ||
181 | mutex_lock(&sbi->alloc_mutex); | 181 | mutex_lock(&sbi->alloc_mutex); |
182 | mapping = sbi->alloc_file->i_mapping; | 182 | mapping = sbi->alloc_file->i_mapping; |
183 | pnr = offset / PAGE_CACHE_BITS; | 183 | pnr = offset / PAGE_CACHE_BITS; |
184 | page = read_mapping_page(mapping, pnr, NULL); | 184 | page = read_mapping_page(mapping, pnr, NULL); |
185 | if (IS_ERR(page)) | ||
186 | goto kaboom; | ||
185 | pptr = kmap(page); | 187 | pptr = kmap(page); |
186 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; | 188 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
187 | end = pptr + PAGE_CACHE_BITS / 32; | 189 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -214,6 +216,8 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
214 | set_page_dirty(page); | 216 | set_page_dirty(page); |
215 | kunmap(page); | 217 | kunmap(page); |
216 | page = read_mapping_page(mapping, ++pnr, NULL); | 218 | page = read_mapping_page(mapping, ++pnr, NULL); |
219 | if (IS_ERR(page)) | ||
220 | goto kaboom; | ||
217 | pptr = kmap(page); | 221 | pptr = kmap(page); |
218 | curr = pptr; | 222 | curr = pptr; |
219 | end = pptr + PAGE_CACHE_BITS / 32; | 223 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -232,4 +236,11 @@ out: | |||
232 | mutex_unlock(&sbi->alloc_mutex); | 236 | mutex_unlock(&sbi->alloc_mutex); |
233 | 237 | ||
234 | return 0; | 238 | return 0; |
239 | |||
240 | kaboom: | ||
241 | printk(KERN_CRIT "hfsplus: unable to mark blocks free: error %ld\n", | ||
242 | PTR_ERR(page)); | ||
243 | mutex_unlock(&sbi->alloc_mutex); | ||
244 | |||
245 | return -EIO; | ||
235 | } | 246 | } |