Ian Abbott
9ae4c50f5e
staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf
...
commit af4b54a2e5 upstream.
`ni6501_alloc_usb_buffers()` is called from `ni6501_auto_attach()` to
allocate RX and TX buffers for USB transfers. It allocates
`devpriv->usb_rx_buf` followed by `devpriv->usb_tx_buf`. If the
allocation of `devpriv->usb_tx_buf` fails, it frees
`devpriv->usb_rx_buf`, leaving the pointer set dangling, and returns an
error. Later, `ni6501_detach()` will be called from the core comedi
module code to clean up. `ni6501_detach()` also frees both
`devpriv->usb_rx_buf` and `devpriv->usb_tx_buf`, but
`devpriv->usb_rx_buf` may have already beed freed, leading to a
double-free error. Fix it bu removing the call to
`kfree(devpriv->usb_rx_buf)` from `ni6501_alloc_usb_buffers()`, relying
on `ni6501_detach()` to free the memory.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk >
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-04-27 09:35:37 +02:00
..
2019-04-20 09:15:06 +02:00
2018-05-01 12:58:21 -07:00
2018-12-05 19:41:26 +01:00
2019-02-12 19:46:03 +01:00
2019-02-27 10:08:05 +01:00
2019-04-20 09:15:00 +02:00
2019-04-20 09:15:10 +02:00
2019-03-23 14:35:12 +01:00
2019-03-27 14:13:53 +09:00
2018-12-01 09:42:49 +01:00
2019-04-05 22:31:35 +02:00
2019-04-17 08:37:44 +02:00
2019-04-05 22:31:40 +02:00
2019-03-23 14:35:20 +01:00
2019-04-05 22:31:31 +02:00
2019-02-12 19:46:03 +01:00
2019-04-20 09:15:06 +02:00
2018-08-24 13:09:08 +02:00
2018-04-12 12:32:13 +02:00
2019-04-05 22:31:40 +02:00
2018-06-05 11:41:57 +02:00
2018-11-13 11:15:06 -08:00
2018-09-09 19:55:56 +02:00
2018-04-26 11:02:03 +02:00
2019-04-05 22:31:36 +02:00
2019-02-12 19:45:58 +01:00
2019-04-20 09:15:04 +02:00
2019-04-20 09:15:07 +02:00
2019-04-20 09:15:05 +02:00
2019-01-31 08:13:44 +01:00
2019-02-27 10:08:05 +01:00
2019-04-20 09:15:07 +02:00
2019-03-23 14:35:25 +01:00
2018-12-21 14:13:14 +01:00
2018-08-09 12:16:39 +02:00
2019-04-27 09:35:36 +02:00
2019-04-20 09:15:00 +02:00
2019-03-23 14:35:13 +01:00
2019-04-20 09:15:06 +02:00
2019-04-20 09:15:03 +02:00
2019-04-03 06:25:08 +02:00
2019-04-05 22:31:33 +02:00
2018-11-13 11:14:52 -08:00
2018-09-19 22:43:41 +02:00
2019-03-23 14:35:15 +01:00
2019-04-20 09:15:08 +02:00
2019-04-20 09:15:04 +02:00
2018-08-03 07:50:38 +02:00
2019-02-12 19:46:04 +01:00
2018-05-25 16:17:47 +02:00
2019-02-27 10:08:03 +01:00
2019-04-20 09:15:06 +02:00
2019-04-20 09:15:00 +02:00
2019-02-15 08:09:11 +01:00
2018-01-17 09:45:27 +01:00
2019-04-27 09:35:35 +02:00
2018-12-01 09:42:54 +01:00
2018-04-26 11:02:13 +02:00
2019-03-23 14:35:18 +01:00
2019-02-20 10:20:50 +01:00
2018-08-24 13:09:14 +02:00
2019-01-23 08:09:49 +01:00
2018-05-30 07:52:28 +02:00
2019-03-23 14:35:24 +01:00
2019-04-17 08:37:55 +02:00
2018-11-13 11:14:46 -08:00
2018-10-18 09:16:24 +02:00
2019-04-03 06:25:19 +02:00
2019-03-23 14:35:14 +01:00
2019-04-05 22:31:35 +02:00
2019-03-27 14:13:55 +09:00
2019-02-12 19:45:59 +01:00
2018-09-15 09:45:27 +02:00
2019-04-05 22:31:39 +02:00
2018-06-21 04:02:48 +09:00
2018-12-08 13:03:40 +01:00
2018-11-13 11:15:12 -08:00
2019-03-27 14:13:55 +09:00
2019-04-03 06:25:21 +02:00
2018-12-21 14:13:13 +01:00
2019-04-20 09:15:01 +02:00
2019-04-20 09:15:06 +02:00
2019-03-23 14:35:19 +01:00
2019-04-27 09:35:37 +02:00
2019-03-23 14:35:20 +01:00
2018-11-13 11:15:11 -08:00
2018-06-21 04:02:54 +09:00
2019-04-20 09:15:01 +02:00
2018-04-24 09:36:29 +02:00
2019-04-20 09:15:04 +02:00
2019-02-15 08:09:14 +01:00
2019-04-05 22:31:37 +02:00
2018-10-03 17:00:46 -07:00
2018-08-03 07:50:23 +02:00
2019-04-27 09:35:34 +02:00
2019-04-05 22:31:37 +02:00
2019-04-17 08:37:53 +02:00
2018-11-13 11:15:09 -08:00
2019-02-12 19:46:03 +01:00
2019-02-27 10:08:03 +01:00
2018-05-30 07:52:30 +02:00
2018-02-25 11:07:53 +01:00