FAILED: patch "[PATCH] platform/x86: x86-android-tablets: Fix use after free on" failed to apply to 6.6-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 2fae3129c0c08e72b1fe93e61fd8fd203252094a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024100741-rubber-buzz-b17a@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
2fae3129c0c0 ("platform/x86: x86-android-tablets: Fix use after free on platform_device_register() errors") 8b57d33a6fdb ("platform/x86: x86-android-tablets: Create a platform_device from module_init()")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2fae3129c0c08e72b1fe93e61fd8fd203252094a Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Sat, 5 Oct 2024 15:05:45 +0200
Subject: [PATCH] platform/x86: x86-android-tablets: Fix use after free on
platform_device_register() errors
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.
drivers/platform/x86/x86-android-tablets/core.c +4 -2
@@ -390,8 +390,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; } }
@@ -443,8 +444,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++; }