Commit cb1ecf25 authored by Linus Torvalds's avatar Linus Torvalds

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]
parents 33e9ee8d d7178c79
...@@ -409,6 +409,12 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, ...@@ -409,6 +409,12 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block); nilfs->ns_first_data_block = le64_to_cpu(sbp->s_first_data_block);
nilfs->ns_r_segments_percentage = nilfs->ns_r_segments_percentage =
le32_to_cpu(sbp->s_r_segments_percentage); le32_to_cpu(sbp->s_r_segments_percentage);
if (nilfs->ns_r_segments_percentage < 1 ||
nilfs->ns_r_segments_percentage > 99) {
printk(KERN_ERR "NILFS: invalid reserved segments percentage.\n");
return -EINVAL;
}
nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments)); nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments));
nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed); nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed);
return 0; return 0;
...@@ -515,6 +521,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs, ...@@ -515,6 +521,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
brelse(sbh[1]); brelse(sbh[1]);
sbh[1] = NULL; sbh[1] = NULL;
sbp[1] = NULL; sbp[1] = NULL;
valid[1] = 0;
swp = 0; swp = 0;
} }
if (!valid[swp]) { if (!valid[swp]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment