This is a note to let you know that I've just added the patch titled iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger() to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iio-adc-at91_adc-fix-possible-memory-leak-in-at91_adc_allocate_trigger.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 65f20301607d07ee279b0804d11a05a62a6c1a1c Mon Sep 17 00:00:00 2001 From: Yang Yingliang <yangyingliang@xxxxxxxxxx> Date: Mon, 24 Oct 2022 16:45:11 +0800 Subject: iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger() From: Yang Yingliang <yangyingliang@xxxxxxxxxx> 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@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221024084511.815096-1-yangyingliang@xxxxxxxxxx Cc: <Stable@xxxxxxxxxxxxxxx> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/iio/adc/at91_adc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -616,8 +616,10 @@ static struct iio_trigger *at91_adc_allo trig->ops = &at91_adc_trigger_ops; ret = iio_trigger_register(trig); - if (ret) + if (ret) { + iio_trigger_free(trig); return NULL; + } return trig; } Patches currently in stable-queue which might be from yangyingliang@xxxxxxxxxx are queue-5.4/iio-adc-at91_adc-fix-possible-memory-leak-in-at91_adc_allocate_trigger.patch queue-5.4/siox-fix-possible-memory-leak-in-siox_device_add.patch queue-5.4/misdn-fix-possible-memory-leak-in-misdn_dsp_element_.patch queue-5.4/xen-pcpu-fix-possible-memory-leak-in-register_pcpu.patch queue-5.4/hid-hyperv-fix-possible-memory-leak-in-mousevsc_prob.patch queue-5.4/iio-trigger-sysfs-fix-possible-memory-leak-in-iio_sysfs_trig_init.patch queue-5.4/ata-libata-transport-fix-double-ata_host_put-in-ata_.patch