From: Sasha Levin Date: Thu, 30 Mar 2023 11:13:00 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.14.312~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee089a8f3f28e1e22bc581a38c47082e821225f6;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/bus-imx-weim-fix-branch-condition-evaluates-to-a-gar.patch b/queue-4.19/bus-imx-weim-fix-branch-condition-evaluates-to-a-gar.patch new file mode 100644 index 00000000000..46943ead2d5 --- /dev/null +++ b/queue-4.19/bus-imx-weim-fix-branch-condition-evaluates-to-a-gar.patch @@ -0,0 +1,44 @@ +From b002bb1e319cd75ae2bc02c9297de0e562612c89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Mar 2023 16:25:26 +0300 +Subject: bus: imx-weim: fix branch condition evaluates to a garbage value + +From: Ivan Bornyakov + +[ Upstream commit 1adab2922c58e7ff4fa9f0b43695079402cce876 ] + +If bus type is other than imx50_weim_devtype and have no child devices, +variable 'ret' in function weim_parse_dt() will not be initialized, but +will be used as branch condition and return value. Fix this by +initializing 'ret' with 0. + +This was discovered with help of clang-analyzer, but the situation is +quite possible in real life. + +Fixes: 52c47b63412b ("bus: imx-weim: improve error handling upon child probe-failure") +Signed-off-by: Ivan Bornyakov +Cc: stable@vger.kernel.org +Reviewed-by: Fabio Estevam +Signed-off-by: Shawn Guo +Signed-off-by: Sasha Levin +--- + drivers/bus/imx-weim.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c +index 6a94aa6a22c27..1a0f977904b68 100644 +--- a/drivers/bus/imx-weim.c ++++ b/drivers/bus/imx-weim.c +@@ -146,8 +146,8 @@ static int __init weim_parse_dt(struct platform_device *pdev, + const struct of_device_id *of_id = of_match_device(weim_id_table, + &pdev->dev); + const struct imx_weim_devtype *devtype = of_id->data; ++ int ret = 0, have_child = 0; + struct device_node *child; +- int ret, have_child = 0; + + if (devtype == &imx50_weim_devtype) { + ret = imx_weim_gpr_setup(pdev); +-- +2.39.2 + diff --git a/queue-4.19/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch b/queue-4.19/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch new file mode 100644 index 00000000000..feb82e20bd5 --- /dev/null +++ b/queue-4.19/drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch @@ -0,0 +1,74 @@ +From d0aeb51d4e4bf55ef4414ecc34457d0b3f35d0cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 Dec 2021 00:55:15 +0100 +Subject: drm/meson: Fix error handling when afbcd.ops->init fails + +From: Martin Blumenstingl + +[ Upstream commit fa747d75f65d1b1cbc3f4691fa67b695e8a399c8 ] + +When afbcd.ops->init fails we need to free the struct drm_device. Also +all errors which come after afbcd.ops->init was successful need to exit +the AFBCD, just like meson_drv_unbind() does. + +Fixes: d1b5e41e13a7e9 ("drm/meson: Add AFBCD module driver") +Signed-off-by: Martin Blumenstingl +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20211230235515.1627522-3-martin.blumenstingl@googlemail.com +Stable-dep-of: ba98413bf45e ("drm/meson: fix missing component unbind on bind errors") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/meson/meson_drv.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 9959522ce802d..6da4a40e54565 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -266,27 +266,27 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + ret = meson_venc_cvbs_create(priv); + if (ret) +- goto free_drm; ++ goto exit_afbcd; + + if (has_components) { + ret = component_bind_all(drm->dev, drm); + if (ret) { + dev_err(drm->dev, "Couldn't bind all components\n"); +- goto free_drm; ++ goto exit_afbcd; + } + } + + ret = meson_plane_create(priv); + if (ret) +- goto free_drm; ++ goto exit_afbcd; + + ret = meson_crtc_create(priv); + if (ret) +- goto free_drm; ++ goto exit_afbcd; + + ret = drm_irq_install(drm, priv->vsync_irq); + if (ret) +- goto free_drm; ++ goto exit_afbcd; + + drm_mode_config_reset(drm); + +@@ -309,6 +309,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + uninstall_irq: + drm_irq_uninstall(drm); ++exit_afbcd: ++ if (priv->afbcd.ops) ++ priv->afbcd.ops->exit(priv); + free_drm: + drm_dev_put(drm); + +-- +2.39.2 + diff --git a/queue-4.19/drm-meson-fix-missing-component-unbind-on-bind-error.patch b/queue-4.19/drm-meson-fix-missing-component-unbind-on-bind-error.patch new file mode 100644 index 00000000000..f8d4a019dee --- /dev/null +++ b/queue-4.19/drm-meson-fix-missing-component-unbind-on-bind-error.patch @@ -0,0 +1,60 @@ +From 8fe3dfb16320b692e84769c5f4972837f379427f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Mar 2023 11:35:33 +0100 +Subject: drm/meson: fix missing component unbind on bind errors + +From: Johan Hovold + +[ Upstream commit ba98413bf45edbf33672e2539e321b851b2cfbd1 ] + +Make sure to unbind all subcomponents when binding the aggregate device +fails. + +Fixes: a41e82e6c457 ("drm/meson: Add support for components") +Cc: stable@vger.kernel.org # 4.12 +Cc: Neil Armstrong +Signed-off-by: Johan Hovold +Acked-by: Neil Armstrong +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20230306103533.4915-1-johan+linaro@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/meson/meson_drv.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 6da4a40e54565..adb8ce6eac43e 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -278,15 +278,15 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + ret = meson_plane_create(priv); + if (ret) +- goto exit_afbcd; ++ goto unbind_all; + + ret = meson_crtc_create(priv); + if (ret) +- goto exit_afbcd; ++ goto unbind_all; + + ret = drm_irq_install(drm, priv->vsync_irq); + if (ret) +- goto exit_afbcd; ++ goto unbind_all; + + drm_mode_config_reset(drm); + +@@ -309,6 +309,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + uninstall_irq: + drm_irq_uninstall(drm); ++unbind_all: ++ if (has_components) ++ component_unbind_all(drm->dev, drm); + exit_afbcd: + if (priv->afbcd.ops) + priv->afbcd.ops->exit(priv); +-- +2.39.2 + diff --git a/queue-4.19/series b/queue-4.19/series index 09f40ad501f..c5a6d379b44 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -48,3 +48,6 @@ sched-fair-sanitize-vruntime-of-entity-being-placed.patch sched-fair-sanitize-vruntime-of-entity-being-migrated.patch tun-avoid-double-free-in-tun_free_netdev.patch ocfs2-fix-data-corruption-after-failed-write.patch +bus-imx-weim-fix-branch-condition-evaluates-to-a-gar.patch +drm-meson-fix-error-handling-when-afbcd.ops-init-fai.patch +drm-meson-fix-missing-component-unbind-on-bind-error.patch