[PATCH] staging: comedi: avoid memleak for subdevice private

2013-07-05 Thread Ian Abbott
`comedi_alloc_spriv()` allocates private storage for a comedi subdevice and sets the `SRF_FREE_SPRIV` flag in the `runflags` member of the subdevice to allow the private storage to be automatically freed when the comedi device is being cleaned up. Unfortunately, the flag gets clobbered by `do_cmd_

[PATCH] staging: comedi: fix a race between do_cmd_ioctl() and read/write

2013-07-05 Thread Ian Abbott
`do_cmd_ioctl()` is called with the comedi device's mutex locked to process the `COMEDI_CMD` ioctl to set up comedi's asynchronous command handling on a comedi subdevice. `comedi_read()` and `comedi_write()` are the `read` and `write` handlers for the comedi device, but do not lock the mutex (for

RE: [PATCH] staging: comedi: avoid memleak for subdevice private

2013-07-05 Thread H Hartley Sweeten
On Friday, July 05, 2013 8:30 AM, Ian Abbott wrote: > `comedi_alloc_spriv()` allocates private storage for a comedi subdevice > and sets the `SRF_FREE_SPRIV` flag in the `runflags` member of the > subdevice to allow the private storage to be automatically freed when > the comedi device is being cle