aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-16 20:14:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-16 20:14:55 -0400
commitcb1ecf25a84aec8c9d1fc6ad0c78adf4fd8335de (patch)
tree8c466871a54837c7b64c0a10bf6afe498bdafddc
parent33e9ee8dbd0c564533e9ac0e1a0c00e073d5b5c0 (diff)
parentd7178c79d9b7c5518f9943188091a75fc6ce0675 (diff)
Merge branch 'akpm' (more patches from Andrew)
Merge some more email patches from Andrew Morton: "A couple of nilfs fixes" * emailed from Andrew Morton <akpm@linux-foundation.org>: nilfs2: fix NULL pointer dereference in nilfs_load_super_block() nilfs2: clamp ns_r_segments_percentage to [1, 99]
-rw-r--r--fs/nilfs2/the_nilfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index d32714094375..501b7f8b739f 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -409,6 +409,12 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
409 nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block); 409 nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block);
410 nilfs->ns_r_segments_percentage = 410 nilfs->ns_r_segments_percentage =
411 le32_to_cpu(sbp->s_r_segments_percentage); 411 le32_to_cpu(sbp->s_r_segments_percentage);
412 if (nilfs->ns_r_segments_percentage < 1 ||
413 nilfs->ns_r_segments_percentage > 99) {
414 printk(KERN_ERR "NILFS: invalid reserved segments percentage.\n");
415 return -EINVAL;
416 }
417
412 nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments)); 418 nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments));
413 nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed); 419 nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed);
414 return 0; 420 return 0;
@@ -515,6 +521,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
515 brelse(sbh[1]); 521 brelse(sbh[1]);
516 sbh[1] = NULL; 522 sbh[1] = NULL;
517 sbp[1] = NULL; 523 sbp[1] = NULL;
524 valid[1] = 0;
518 swp = 0; 525 swp = 0;
519 } 526 }
520 if (!valid[swp]) { 527 if (!valid[swp]) {