JFFS2 Fix of panics caused by wrong condition for hole frag creation in write_begin
David Woodhouse
maintainerPATCH 1/1 JFFS2 Fix of panics caused by wrong condition for hole frag creation in write_begin
From: Alexey Korolev <[email protected]>
This fixes a regression introduced in commit 205c109a7a96d9a3d8ffe64c4068b70811fef5e8 when switching to write_begin/write_end operations in JFFS2. The page offset is miscalculated, leading to corruption of the fragment lists and subsequently to memory corruption and panics.
fs/jffs2/file.c +1 -1
@@ -129,7 +129,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,struct inode *inode = mapping->host;struct jffs2_inode_info *f =JFFS2_INODE_INFO (inode);pgoff_t index = pos >>PAGE_CACHE_SHIFT ; -uint32_t pageofs = pos & (PAGE_CACHE_SIZE -1 ); +uint32_t pageofs = index <<PAGE_CACHE_SHIFT ;int ret =0 ; pg =__grab_cache_page (mapping, index);
Signature · 1 line
dwmw2
Quoted 11 lines · David Woodhouse
From: Alexey Korolev <[email protected]>
This fixes a regression introduced in commit
205c109a7a96d9a3d8ffe64c4068b70811fef5e8when switching to write_begin/write_end operations in JFFS2. The page offset is miscalculated, leading to corruption of the fragment lists and subsequently to memory corruption and panics.Signed-off-by Alexey Korolev <[email protected]>Signed-off-by Vasiliy Leonenko <[email protected]>Signed-off-by David Woodhouse <[email protected]>
I see this in final 2.6.25 kernel.
Is this worth to go to 2.6.24.y stable too?
---
Atsushi Nemoto