This is a note to let you know that I've just added the patch titled drm/ingenic: Fix missing platform_driver_unregister() call in ingenic_drm_init() to the 5.10-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: drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 47078311b8efebdefd5b3b2f87e2b02b14f49c66 Mon Sep 17 00:00:00 2001 From: Yuan Can <yuancan@xxxxxxxxxx> Date: Fri, 4 Nov 2022 06:45:12 +0000 Subject: drm/ingenic: Fix missing platform_driver_unregister() call in ingenic_drm_init() From: Yuan Can <yuancan@xxxxxxxxxx> commit 47078311b8efebdefd5b3b2f87e2b02b14f49c66 upstream. A problem about modprobe ingenic-drm failed is triggered with the following log given: [ 303.561088] Error: Driver 'ingenic-ipu' is already registered, aborting... modprobe: ERROR: could not insert 'ingenic_drm': Device or resource busy The reason is that ingenic_drm_init() returns platform_driver_register() directly without checking its return value, if platform_driver_register() failed, it returns without unregistering ingenic_ipu_driver_ptr, resulting the ingenic-drm can never be installed later. A simple call graph is shown as below: ingenic_drm_init() platform_driver_register() # ingenic_ipu_driver_ptr are registered platform_driver_register() driver_register() bus_add_driver() priv = kzalloc(...) # OOM happened # return without unregister ingenic_ipu_driver_ptr Fixing this problem by checking the return value of platform_driver_register() and do platform_unregister_drivers() if error happened. Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU") Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20221104064512.8569-1-yuancan@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1120,7 +1120,11 @@ static int ingenic_drm_init(void) return err; } - return platform_driver_register(&ingenic_drm_driver); + err = platform_driver_register(&ingenic_drm_driver); + if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && err) + platform_driver_unregister(ingenic_ipu_driver_ptr); + + return err; } module_init(ingenic_drm_init); Patches currently in stable-queue which might be from yuancan@xxxxxxxxxx are queue-5.10/scsi-hpsa-fix-possible-memory-leak-in-hpsa_init_one.patch queue-5.10/hsi-omap_ssi_core-fix-error-handling-in-ssi_init.patch queue-5.10/platform-chrome-cros_usbpd_notify-fix-error-handling.patch queue-5.10/remoteproc-qcom_q6v5_pas-fix-missing-of_node_put-in-.patch queue-5.10/drm-ingenic-fix-missing-platform_driver_unregister-call-in-ingenic_drm_init.patch queue-5.10/media-platform-exynos4-is-fix-error-handling-in-fimc.patch queue-5.10/rdma-nldev-add-checks-for-nla_nest_start-in-fill_sta.patch queue-5.10/drivers-net-qlcnic-fix-potential-memory-leak-in-qlcn.patch queue-5.10/iommu-fsl_pamu-fix-resource-leak-in-fsl_pamu_probe.patch queue-5.10/serial-sunsab-fix-error-handling-in-sunsab_init.patch queue-5.10/tpm-tpm_ftpm_tee-fix-error-handling-in-ftpm_mod_init.patch queue-5.10/asoc-qcom-add-checks-for-devm_kcalloc.patch queue-5.10/perf-arm_dsu-fix-hotplug-callback-leak-in-dsu_pmu_in.patch