)]}'
{
  "commit": "342ff28f5a2e5aa3236617bd2bddf6c749677ef2",
  "tree": "6c76de805597459768c25b9ffbb9ccfe27c39b13",
  "parents": [
    "8c3423359644d01cfba3a401e403c549c3f88ac4"
  ],
  "author": {
    "name": "Brian Norris",
    "email": "computersforpeace@gmail.com",
    "time": "Mon Nov 07 15:51:05 2011 -0800"
  },
  "committer": {
    "name": "David Woodhouse",
    "email": "David.Woodhouse@intel.com",
    "time": "Mon Jan 09 18:04:01 2012 +0000"
  },
  "message": "mtd: mtd_blkdevs: don\u0027t increase \u0027open\u0027 count on error path\n\nSome error paths in mtd_blkdevs were fixed in the following commit:\n\n    commit 94735ec4044a6d318b83ad3c5794e931ed168d10\n    mtd: mtd_blkdevs: fix error path in blktrans_open\n\nBut on these error paths, the block device\u0027s `dev-\u003eopen\u0027 count is\nalready incremented before we check for errors. This meant that, while\nthe error path was handled correctly on the first time through\nblktrans_open(), the device is erroneously considered already open on\nthe second time through.\n\nThis problem can be seen, for instance, when a UBI volume is\nsimultaneously mounted as a UBIFS partition and read through its\ncorresponding gluebi mtdblockX device. This results in blktrans_open()\npassing its error checks (with `dev-\u003eopen \u003e 0\u0027) without actually having\na handle on the device. Here\u0027s a summarized log of the actions and\nresults with nandsim:\n\n    # modprobe nandsim\n    # modprobe mtdblock\n    # modprobe gluebi\n    # modprobe ubifs\n    # ubiattach /dev/ubi_ctrl -m 0\n    ...\n    # ubimkvol /dev/ubi0 -N test -s 16MiB\n    ...\n    # mount -t ubifs ubi0:test /mnt\n    # ls /dev/mtdblock*\n    /dev/mtdblock0  /dev/mtdblock1\n    # cat /dev/mtdblock1 \u003e /dev/null\n    cat: can\u0027t open \u0027/dev/mtdblock4\u0027: Device or resource busy\n    # cat /dev/mtdblock1 \u003e /dev/null\n\n    CPU 0 Unable to handle kernel paging request at virtual address\n    fffffff0, epc \u003d\u003d 8031536c, ra \u003d\u003d 8031f280\n    Oops[#1]:\n    ...\n    Call Trace:\n    [\u003c8031536c\u003e] ubi_leb_read+0x14/0x164\n    [\u003c8031f280\u003e] gluebi_read+0xf0/0x148\n    [\u003c802edba8\u003e] mtdblock_readsect+0x64/0x198\n    [\u003c802ecfe4\u003e] mtd_blktrans_thread+0x330/0x3f4\n    [\u003c8005be98\u003e] kthread+0x88/0x90\n    [\u003c8000bc04\u003e] kernel_thread_helper+0x10/0x18\n\nCc: stable@kernel.org [3.0+]\nSigned-off-by: Brian Norris \u003ccomputersforpeace@gmail.com\u003e\nSigned-off-by: Artem Bityutskiy \u003cArtem.Bityutskiy@linux.intel.com\u003e\nSigned-off-by: David Woodhouse \u003cDavid.Woodhouse@intel.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ed8b5e744b12abc15b0db0189c972b3331bd1f0b",
      "old_mode": 33188,
      "old_path": "drivers/mtd/mtd_blkdevs.c",
      "new_id": "424ca5f93c6c37f74304f04a2e393523ae453f7a",
      "new_mode": 33188,
      "new_path": "drivers/mtd/mtd_blkdevs.c"
    }
  ]
}
