]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger()
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 24 Oct 2022 08:45:11 +0000 (16:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:35:41 +0000 (17:35 +0100)
commitc3ce73f60599a483dca7becd4112508833a40ef9
tree114f54a5f369e44937cbf3944803dc60d95735cf
parent9c7693166b485c224b11fd4c97add7758941a031
iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger()

commit 65f20301607d07ee279b0804d11a05a62a6c1a1c upstream.

If iio_trigger_register() returns error, it should call iio_trigger_free()
to give up the reference that hold in iio_trigger_alloc(), so that it can
call iio_trig_release() to free memory when the refcount hit to 0.

Fixes: 0e589d5fb317 ("ARM: AT91: IIO: Add AT91 ADC driver.")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221024084511.815096-1-yangyingliang@huawei.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/at91_adc.c