Skip to content

Commit

Permalink
iio: adc: ti_am335x_adc: avoid double free of buffer.
Browse files Browse the repository at this point in the history
The driver is missing the iio_buffer_attach() call. As such it will attempt
to free the buffer twice on removal.

Introduced in commit 9e69c9 ("iio: Add reference counting for buffers").

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Nov 9, 2013
1 parent 5fa4061 commit fe26980
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/iio/adc/ti_am335x_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,15 @@ static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev,
unsigned long flags,
const struct iio_buffer_setup_ops *setup_ops)
{
struct iio_buffer *buffer;
int ret;

indio_dev->buffer = iio_kfifo_allocate(indio_dev);
if (!indio_dev->buffer)
buffer = iio_kfifo_allocate(indio_dev);
if (!buffer)
return -ENOMEM;

iio_device_attach_buffer(indio_dev, buffer);

ret = request_threaded_irq(irq, pollfunc_th, pollfunc_bh,
flags, indio_dev->name, indio_dev);
if (ret)
Expand Down

0 comments on commit fe26980

Please sign in to comment.