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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 07, 2013 at 03:51:58PM +0100, 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 cleaned up.  Unfortunately, the flag gets
> clobbered by `do_cmd_ioctl()` which calls
> `comedi_set_subdevice_runflags()` with a mask value `~0` and only the
> `SRF_USER` and `SRF_RUNNING` flags set, all the other SRF flags being
> cleared.
> 
> Change the calls to `comedi_set_subdevice_runflags()` that currently use
> a mask value of `~0` to use a more relevant mask value.  For
> `do_cmd_ioctl()`, the relevant SRF flags are `SRF_USER`, `SRF_ERROR` and
> `SRF_RUNNING`.  (At one time, `SRF_RT` would be included in that set of
> flags, but it is no longer used.)  For `comedi_alloc_spriv()` replace
> the call to `comedi_set_subdevice_runflags()` with a simple
> OR-assignment to avoid unnecessary use of a spin-lock.
> 
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx> # 3.11.y
> ---
> v2: Replaced call to `comedi_set_subdevice_runflags()` from
> `comedi_alloc_spriv()` with a simple OR-assignment, as suggested by
> Hartley S Sweeten.
> 
> Note: The first version of this patch was posted on 2013-07-05 but I
> think it must have got lost in the driverdev-devel mailing list outage
> around that time.

Sorry about that, I must have missed it somehow.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]