Patch "platform/x86: x86-android-tablets: Fix use after free on platform_device_register() errors" has been added to the 6.6-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

    platform/x86: x86-android-tablets: Fix use after free on platform_device_register() errors

to the 6.6-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:
     platform-x86-x86-android-tablets-fix-use-after-free-.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 43f954625e8f70e0b77928d363f85ee86b5be406
Author: Hans de Goede <hdegoede@xxxxxxxxxx>
Date:   Sat Oct 5 15:05:45 2024 +0200

    platform/x86: x86-android-tablets: Fix use after free on platform_device_register() errors
    
    [ Upstream commit 2fae3129c0c08e72b1fe93e61fd8fd203252094a ]
    
    x86_android_tablet_remove() frees the pdevs[] array, so it should not
    be used after calling x86_android_tablet_remove().
    
    When platform_device_register() fails, store the pdevs[x] PTR_ERR() value
    into the local ret variable before calling x86_android_tablet_remove()
    to avoid using pdevs[] after it has been freed.
    
    Fixes: 5eba0141206e ("platform/x86: x86-android-tablets: Add support for instantiating platform-devs")
    Fixes: e2200d3f26da ("platform/x86: x86-android-tablets: Add gpio_keys support to x86_android_tablet_init()")
    Cc: stable@xxxxxxxxxxxxxxx
    Reported-by: Aleksandr Burakov <a.burakov@xxxxxxxxxxxx>
    Closes: https://lore.kernel.org/platform-driver-x86/20240917120458.7300-1-a.burakov@xxxxxxxxxxxx/
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241005130545.64136-1-hdegoede@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index ebfd9a3dac957..a0fa0b6859c9c 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -339,8 +339,9 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
 	for (i = 0; i < pdev_count; i++) {
 		pdevs[i] = platform_device_register_full(&dev_info->pdev_info[i]);
 		if (IS_ERR(pdevs[i])) {
+			ret = PTR_ERR(pdevs[i]);
 			x86_android_tablet_remove(pdev);
-			return PTR_ERR(pdevs[i]);
+			return ret;
 		}
 	}
 
@@ -388,8 +389,9 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
 								  PLATFORM_DEVID_AUTO,
 								  &pdata, sizeof(pdata));
 		if (IS_ERR(pdevs[pdev_count])) {
+			ret = PTR_ERR(pdevs[pdev_count]);
 			x86_android_tablet_remove(pdev);
-			return PTR_ERR(pdevs[pdev_count]);
+			return ret;
 		}
 		pdev_count++;
 	}




[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