)]}'
{
  "commit": "199bc9ff5ca5e4b3bcaff8927b2983c65f34c263",
  "tree": "65eae0838210e0807e75ed2caa7e1f2d151b7f09",
  "parents": [
    "c69f677cc852f3f7b2342ab2f1598670a463d576"
  ],
  "author": {
    "name": "David Woodhouse",
    "email": "dwmw2@infradead.org",
    "time": "Mon Nov 30 09:06:40 2009 +0000"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Mon Nov 30 13:52:40 2009 -0800"
  },
  "message": "jffs2: Fix memory corruption in jffs2_read_inode_range()\n\nIn 2.6.23 kernel, commit a32ea1e1f925399e0d81ca3f7394a44a6dafa12c\n(\"Fix read/truncate race\") fixed a race in the generic code, and as a\nside effect, now do_generic_file_read() can ask us to readpage() past\nthe i_size. This seems to be correctly handled by the block routines\n(e.g. block_read_full_page() fills the page with zeroes in case if\nsomebody is trying to read past the last inode\u0027s block).\n\nJFFS2 doesn\u0027t handle this; it assumes that it won\u0027t be asked to read\npages which don\u0027t exist -- and thus that there will be at least _one_\nvalid \u0027frag\u0027 on the page it\u0027s being asked to read. It will fill any\nholes with the following memset:\n\n  memset(buf, 0, min(end, frag-\u003eofs + frag-\u003esize) - offset);\n\nWhen the \u0027closest smaller match\u0027 returned by jffs2_lookup_node_frag() is\nactually on a previous page and ends before \u0027offset\u0027, that results in:\n\n  memset(buf, 0, \u003chuge unsigned negative\u003e);\n\nHopefully, in most cases the corruption is fatal, and quickly causing\nrandom oopses, like this:\n\n  root@10.0.0.4:~/ltp-fs-20090531# ./testcases/kernel/fs/ftest/ftest01\n  Unable to handle kernel paging request for data at address 0x00000008\n  Faulting instruction address: 0xc01cd980\n  Oops: Kernel access of bad area, sig: 11 [#1]\n  [...]\n  NIP [c01cd980] rb_insert_color+0x38/0x184\n  LR [c0043978] enqueue_hrtimer+0x88/0xc4\n  Call Trace:\n  [c6c63b60] [c004f9a8] tick_sched_timer+0xa0/0xe4 (unreliable)\n  [c6c63b80] [c0043978] enqueue_hrtimer+0x88/0xc4\n  [c6c63b90] [c0043a48] __run_hrtimer+0x94/0xbc\n  [c6c63bb0] [c0044628] hrtimer_interrupt+0x140/0x2b8\n  [c6c63c10] [c000f8e8] timer_interrupt+0x13c/0x254\n  [c6c63c30] [c001352c] ret_from_except+0x0/0x14\n  --- Exception: 901 at memset+0x38/0x5c\n      LR \u003d jffs2_read_inode_range+0x144/0x17c\n  [c6c63cf0] [00000000] (null) (unreliable)\n\nThis patch fixes the issue, plus fixes all LTP tests on NAND/UBI with\nJFFS2 filesystem that were failing since 2.6.23 (seems like the bug\nabove also broke the truncation).\n\nReported-By: Anton Vorontsov \u003cavorontsov@ru.mvista.com\u003e\nTested-By: Anton Vorontsov \u003cavorontsov@ru.mvista.com\u003e\nSigned-off-by: David Woodhouse \u003cDavid.Woodhouse@intel.com\u003e\nCc: stable@kernel.org\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "cfe05c1966a582140986e33cf25940683abdafb5",
      "old_mode": 33188,
      "old_path": "fs/jffs2/read.c",
      "new_id": "3f39be1b0455a03be83b8cb08bfa224a6dd75d7b",
      "new_mode": 33188,
      "new_path": "fs/jffs2/read.c"
    }
  ]
}
