From patchwork Mon Dec 10 14:19:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3.5.y.z, extended, stable] Patch "md: Avoid write invalid address if read_seqretry returned" has been added to staging queue Date: Mon, 10 Dec 2012 04:19:03 -0000 From: Herton Ronaldo Krzesinski X-Patchwork-Id: 204903 Message-Id: <1355149143-8573-1-git-send-email-herton.krzesinski@canonical.com> To: majianpeng Cc: NeilBrown , zhuwenfeng@kedacom.com, kernel-team@lists.ubuntu.com This is a note to let you know that I have just added a patch titled md: Avoid write invalid address if read_seqretry returned to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ >From 80a8c8833f72b5d7dc2fa62b751792a46fc497ac Mon Sep 17 00:00:00 2001 From: majianpeng Date: Thu, 8 Nov 2012 08:56:27 +0800 Subject: [PATCH] md: Avoid write invalid address if read_seqretry returned true. commit 35f9ac2dcec8f79d7059ce174fd7b7ee3290d620 upstream. 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-g2699b67. So fix is suitable for 3.0.y thru 3.6.y. Reported-by: zhuwenfeng@kedacom.com Tested-by: zhuwenfeng@kedacom.com Signed-off-by: Jianpeng Ma Signed-off-by: NeilBrown Signed-off-by: Herton Ronaldo Krzesinski --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/md/md.c b/drivers/md/md.c index e977874..97edf9e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1881,10 +1881,10 @@ retry: memset(bbp, 0xff, PAGE_SIZE); for (i = 0 ; i < bb->count ; i++) { - u64 internal_bb = *p++; + u64 internal_bb = p[i]; u64 store_bb = ((BB_OFFSET(internal_bb) << 10) | BB_LEN(internal_bb)); - *bbp++ = cpu_to_le64(store_bb); + bbp[i] = cpu_to_le64(store_bb); } bb->changed = 0; if (read_seqretry(&bb->lock, seq))