提交 8b421601 编写于 作者: A Abhijith Das 提交者: Steven Whitehouse

GFS2: BUG in gfs2_adjust_quota

HighMem pages on i686 do not get mapped to the buffer_heads and this was
causing a NULL pointer dereference when we were trying to memset page buffers
to zero.
We now use zero_user() that kmaps the page and directly manipulates page data.
This patch also fixes a boundary condition that was incorrect.
Signed-off-by: NAbhi Das <adas@redhat.com>
Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
上级 b1becbde
...@@ -694,10 +694,8 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, ...@@ -694,10 +694,8 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
if (!buffer_mapped(bh)) if (!buffer_mapped(bh))
goto unlock_out; goto unlock_out;
/* If it's a newly allocated disk block for quota, zero it */ /* If it's a newly allocated disk block for quota, zero it */
if (buffer_new(bh)) { if (buffer_new(bh))
memset(bh->b_data, 0, bh->b_size); zero_user(page, pos - blocksize, bh->b_size);
set_buffer_uptodate(bh);
}
} }
if (PageUptodate(page)) if (PageUptodate(page))
...@@ -723,7 +721,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, ...@@ -723,7 +721,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
/* If quota straddles page boundary, we need to update the rest of the /* If quota straddles page boundary, we need to update the rest of the
* quota at the beginning of the next page */ * quota at the beginning of the next page */
if (offset != 0) { /* first page, offset is closer to PAGE_CACHE_SIZE */ if ((offset + sizeof(struct gfs2_quota)) > PAGE_CACHE_SIZE) {
ptr = ptr + nbytes; ptr = ptr + nbytes;
nbytes = sizeof(struct gfs2_quota) - nbytes; nbytes = sizeof(struct gfs2_quota) - nbytes;
offset = 0; offset = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册