提交 35f9ac2d 编写于 作者: M majianpeng 提交者: NeilBrown

md: Avoid write invalid address if read_seqretry returned true.

If read_seqretry returned true and bbp was changed, it will write
invalid address which can cause some serious problem.

This bug was introduced by commit v3.0-rc7-130-g2699b672.
So fix is suitable for 3.0.y thru 3.6.y.

Reported-by: zhuwenfeng@kedacom.com
Tested-by: zhuwenfeng@kedacom.com
Cc: stable@vger.kernel.org
Signed-off-by: NJianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 ab05613a
...@@ -1817,10 +1817,10 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1817,10 +1817,10 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
memset(bbp, 0xff, PAGE_SIZE); memset(bbp, 0xff, PAGE_SIZE);
for (i = 0 ; i < bb->count ; i++) { for (i = 0 ; i < bb->count ; i++) {
u64 internal_bb = *p++; u64 internal_bb = p[i];
u64 store_bb = ((BB_OFFSET(internal_bb) << 10) u64 store_bb = ((BB_OFFSET(internal_bb) << 10)
| BB_LEN(internal_bb)); | BB_LEN(internal_bb));
*bbp++ = cpu_to_le64(store_bb); bbp[i] = cpu_to_le64(store_bb);
} }
bb->changed = 0; bb->changed = 0;
if (read_seqretry(&bb->lock, seq)) if (read_seqretry(&bb->lock, seq))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册