summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/genext2fs/genext2fs-1.4.1
diff options
context:
space:
mode:
authorChunrong Guo <B40290@freescale.com>2013-08-15 17:59:55 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-20 15:31:26 +0100
commitfe227a023e30f6651618423ab527cde21a350d1a (patch)
tree80799525f583b0576950dfd8ac5b2c9568b931b8 /meta/recipes-devtools/genext2fs/genext2fs-1.4.1
parent3c1f166ce52841d727b49ce6925be435e2430e50 (diff)
downloadpoky-fe227a023e30f6651618423ab527cde21a350d1a.tar.gz
genext2fs: fix memory corruption on powerpc
* fix memory corruption errors on powerpc64 e.g. |$ genext2fs -b 30000 -d . -i 8192 /tmp/tstrootfs | Segmentation fault (From OE-Core rev: d98f08a7ad95d0b17846276b028a6614f16b6846) Signed-off-by: Chunrong Guo <B40290@freescale.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1')
-rw-r--r--meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-memory-corruption-on-powerpc.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-memory-corruption-on-powerpc.patch b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-memory-corruption-on-powerpc.patch
new file mode 100644
index 0000000000..0ef162c023
--- /dev/null
+++ b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-memory-corruption-on-powerpc.patch
@@ -0,0 +1,76 @@
1Upstream-Status: Submitted
2
3fix memory corruption on powerpc
4
5Signed-off-by: Wrobel Heinz <Heinz.Wrobel@freescale.com>
6
7diff --unified a/genext2fs.c b/genext2fs.c
8--- a/genext2fs.c 2013-08-14 16:50:59.061623605 +0200
9+++ b/genext2fs.c 2013-08-14 16:47:23.349623674 +0200
10@@ -675,21 +675,34 @@
11 }
12
13 static void
14-swap_nod(inode *nod)
15+swap_nod(inode *nod, int fromdisk)
16 {
17 uint32 nblk;
18+ uint32 i_blocks = nod->i_blocks;
19+ uint32 i_size = nod->i_size;
20+ uint16 i_mode = nod->i_mode;
21+
22
23 #define this nod
24 inode_decl
25 #undef this
26
27+ if (fromdisk) {
28+ // Only now do we have the values in the correct
29+ // endianess for the host. So we override the
30+ // earlier assumption
31+ i_blocks = nod->i_blocks;
32+ i_size = nod->i_size;
33+ i_mode = nod->i_mode;
34+ }
35+
36 // block and character inodes store the major and minor in the
37 // i_block, so we need to unswap to get those. Also, if it's
38 // zero iblocks, put the data back like it belongs.
39- nblk = nod->i_blocks / INOBLK;
40- if ((nod->i_size && !nblk)
41- || ((nod->i_mode & FM_IFBLK) == FM_IFBLK)
42- || ((nod->i_mode & FM_IFCHR) == FM_IFCHR))
43+ nblk = i_blocks / INOBLK;
44+ if ((i_size && !nblk)
45+ || ((i_mode & FM_IFBLK) == FM_IFBLK)
46+ || ((i_mode & FM_IFCHR) == FM_IFCHR))
47 {
48 int i;
49 for(i = 0; i <= EXT2_TIND_BLOCK; i++)
50@@ -1066,7 +1079,7 @@
51 nod_info *ni = container_of(elem, nod_info, link);
52
53 if (ni->fs->swapit)
54- swap_nod(ni->itab);
55+ swap_nod(ni->itab, 0);
56 put_blk(ni->bi);
57 free(ni);
58 }
59@@ -1102,7 +1115,7 @@
60 ni->b = get_blk(fs, fs->gd[grp].bg_inode_table + boffset, &ni->bi);
61 ni->itab = ((inode *) ni->b) + offset;
62 if (fs->swapit)
63- swap_nod(ni->itab);
64+ swap_nod(ni->itab, 1);
65
66 out:
67 *rni = ni;
68@@ -1158,6 +1171,8 @@
69 if (dw->fs->swapit)
70 swap_dir(&dw->d);
71 memcpy(dw->last_d, &dw->d, sizeof(directory));
72+ if (dw->fs->swapit)
73+ swap_dir(&dw->d);
74
75 if (((int8 *) next_d) >= ((int8 *) dw->b + BLOCKSIZE))
76 return NULL;