Patch "iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger()" has been added to the 6.0-stable tree

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

 



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 6.0-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-6.0 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
@@ -634,8 +634,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-6.0/ata-libata-transport-fix-error-handling-in-ata_tport.patch
queue-6.0/iio-adc-at91_adc-fix-possible-memory-leak-in-at91_adc_allocate_trigger.patch
queue-6.0/siox-fix-possible-memory-leak-in-siox_device_add.patch
queue-6.0/scsi-scsi_transport_sas-fix-error-handling-in-sas_ph.patch
queue-6.0/misdn-fix-possible-memory-leak-in-misdn_dsp_element_.patch
queue-6.0/xen-pcpu-fix-possible-memory-leak-in-register_pcpu.patch
queue-6.0/iio-trigger-sysfs-fix-possible-memory-leak-in-iio_sysfs_trig_init.patch
queue-6.0/ata-libata-transport-fix-double-ata_host_put-in-ata_.patch
queue-6.0/ata-libata-transport-fix-error-handling-in-ata_tlink.patch
queue-6.0/ata-libata-transport-fix-error-handling-in-ata_tdev_.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux