)]}'
{
  "commit": "051522bb47797f7168a617a0752d7ddc1a2f6f24",
  "tree": "18a2a4eb01300be10f09f671adbb98df2f5323a0",
  "parents": [
    "18a77b5d237a67d2c621a46f5271a3b51da1b380"
  ],
  "author": {
    "name": "Francesco Lavra",
    "email": "francescolavra@interfree.it",
    "time": "Tue Nov 03 10:53:07 2009 +0000"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@suse.de",
    "time": "Tue Nov 17 16:46:33 2009 -0800"
  },
  "message": "USB: cdc_acm: Fix memory leak after hangup\n\nAm Donnerstag, 10. September 2009 15:43:53 schrieb Dietmar Hilbrich:\n\u003e Hello,\n\u003e\n\u003e i have the following problem with the cdc-acm - driver:\n\u003e\n\u003e I\u0027m using the driver with an \"Ericsson F3507G\" on a Thinkpad T400.\n\u003e\n\u003e If a disable the device (with the RFKill-Switch) while it is used by a\n\u003e programm like ppp, the driver doesn\u0027t seem to correctly clean up the tty,\n\u003e even after the program has been closed)\n\u003e\n\u003e The tty is still active (e.g. there still exists an entry in\n\u003e /sys/dev/char/166:0 if ttyACM0 was used) and if a reacticate the device,\n\u003e this device entry will be skipped and the Device-Nodes ttyACM1, ttyACM2\n\u003e and ttyACM3 will be used.\n\u003e\n\u003e This problem was introduced with the commit\n\u003e 10077d4a6674f535abdbe25cdecb1202af7948f1 (before 2.6.31-rc1) and still\n\u003e exists in 2.6.31.\n\u003e\n\u003e I was able the fix this problem with the following patch:\n\u003e\n\u003e diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c\n\u003e index 2bfc41e..0970d2f 100644\n\u003e --- a/drivers/usb/class/cdc-acm.c\n\u003e +++ b/drivers/usb/class/cdc-acm.c\n\u003e @@ -676,6 +676,7 @@ static void acm_tty_hangup(struct tty_struct *tty)\n\u003e         struct acm *acm \u003d tty-\u003edriver_data;\n\u003e         tty_port_hangup(\u0026acm-\u003eport);\n\u003e         acm_port_down(acm, 0);\n\u003e +       acm_tty_unregister(acm);\n\u003e  }\n\nI have the same problem with cdc-acm (I\u0027m using a Samsung SGH-U900): when I\nunplug it from the USB port during a PPP connection, the ppp daemon gets the\nhangup correctly (and closes the device), but the struct acm corresponding to\nthe device disconnected is not freed. Hence reconnecting the device results in\ncreation of /dev/ttyACM(x+1). The same happens when the system is hibernated\nduring a PPP connection.\n\nThis memory leak is due to the fact that when the tty is hung up,\ntty_port_close_start() returns always zero, and acm_tty_close() never reaches\nthe point where acm_tty_unregister() is called.\n\nHere is a fix for this.\n\nSigned-off-by: Francesco Lavra \u003cfrancescolavra@interfree.it\u003e\nAcked-by: Oliver Neukum \u003coliver@neukum.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@suse.de\u003e\n\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b72fa49eb257aad26d3b634ab81f6b36ad615239",
      "old_mode": 33188,
      "old_path": "drivers/usb/class/cdc-acm.c",
      "new_id": "e4eca7810bcf1bed6821086e4bab6130525e3c17",
      "new_mode": 33188,
      "new_path": "drivers/usb/class/cdc-acm.c"
    }
  ]
}
