)]}'
{
  "commit": "4c898c7f2f286b204fefc5dddb568f755d195d0c",
  "tree": "026fead9aef220a5fd994e2eaa269ed598651d39",
  "parents": [
    "0b50f81d5a63428f131ff20596f4e3d473e5b94f"
  ],
  "author": {
    "name": "Daniel Ritz",
    "email": "daniel.ritz@gmx.ch",
    "time": "Thu Sep 22 00:47:11 2005 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@g5.osdl.org",
    "time": "Thu Sep 22 07:58:24 2005 -0700"
  },
  "message": "[PATCH] Driver Core: fis bus rescan devices race\n\nbus_rescan_devices_helper() does not hold the dev-\u003esem when it checks for\n!dev-\u003edriver().  device_attach() holds the sem, but calls again\ndevice_bind_driver() even when dev-\u003edriver is set.\n\nWhat happens is that a first device_attach() call (module insertion time)\nis on the way binding the device to a driver.  Another thread calls\nbus_rescan_devices().  Now when bus_rescan_devices_helper() checks for\ndev-\u003edriver it is still NULL \u0027cos the the prior device_attach() is not yet\nfinished.  But as soon as the first one releases the dev-\u003esem the second\ndevice_attach() tries to rebind the already bound device again.\ndevice_bind_driver() does this blindly which leads to a corrupt\ndriver-\u003eklist_devices list (the device links itself, the head points to the\ndevice).  Later a call to device_release_driver() sets dev-\u003edriver to NULL\nand breaks the link it has to itself on knode_driver.  Rmmoding the driver\nlater calls driver_detach() which leads to an endless loop \u0027cos the list\nhead in klist_devices still points to the device.  And since dev-\u003edriver is\nNULL it\u0027s stuck with the same device forever.  Boom.  And rmmod hangs.\n\nVery easy to reproduce with new-style pcmcia and a 16bit card.  Just loop\nmodprobe \u003cpcmcia-modules\u003e ;cardctl eject; rmmod \u003ccard driver, pcmcia\nmodules\u003e.\n\nEasiest fix is to check if the device is already bound to a driver in\ndevice_bind_driver().  This avoids the double binding.\n\nSigned-off-by: Daniel Ritz \u003cdaniel.ritz@gmx.ch\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@suse.de\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d5bbce38282fd233f06ef77891257a399be2471e",
      "old_mode": 33188,
      "old_path": "drivers/base/dd.c",
      "new_id": "3565e9795301d6d90a72ce2e433313a635df5c1c",
      "new_mode": 33188,
      "new_path": "drivers/base/dd.c"
    }
  ]
}
