FAILED: patch "[PATCH] drm/msm: fix vram leak on bind errors" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-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-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 60d476af96015891c7959f30838ae7a9749932bf
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023051338-unthawed-shallow-1876@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
60d476af9601 ("drm/msm: fix vram leak on bind errors")214b09db6197 ("drm/msm: fix drm device leak on bind errors") 652eadfde810 ("Revert "drm/msm: Fix failure paths in msm_drm_init()"") 8636500300a0 ("drm/msm: Fix failure paths in msm_drm_init()") 2027e5b3413d ("drm/msm: Initialize MDSS irq domain at probe time") ec919e6e7146 ("drm/msm: Allocate msm_drm_private early and pass it as driver data") 83b965d118cb ("Merge remote-tracking branch 'drm/drm-next' into msm-next-staging")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 60d476af96015891c7959f30838ae7a9749932bf Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 6 Mar 2023 11:07:18 +0100
Subject: [PATCH] drm/msm: fix vram leak on bind errors
Make sure to release the VRAM buffer also in a case a subcomponent fails to bind.
Patchwork: https://patchwork.freedesktop.org/patch/525094/
drivers/gpu/drm/msm/msm_drv.c +19 -7
@@ -52,6 +52,8 @@#define MSM_VERSION_MINOR 10#define MSM_VERSION_PATCHLEVEL 0 +static void msm_deinit_vram (struct drm_device *ddev); +static const struct drm_mode_config_funcs mode_config_funcs = { .fb_create = msm_framebuffer_create, .output_poll_changed = drm_fb_helper_output_poll_changed,
@@ -261,12 +263,7 @@ static int msm_drm_uninit(struct device *dev)if (kms && kms->funcs) kms->funcs->destroy (kms); -if (priv->vram.paddr) { -unsigned long attrs =DMA_ATTR_NO_KERNEL_MAPPING ; -drm_mm_takedown (&priv->vram.mm); -dma_free_attrs (dev, priv->vram.size,NULL , - priv->vram.paddr, attrs); - } +msm_deinit_vram (ddev);component_unbind_all (dev, ddev);
@@ -404,6 +401,19 @@ static int msm_init_vram(struct drm_device *dev)return ret; } +static void msm_deinit_vram (struct drm_device *ddev) +{ +struct msm_drm_private *priv = ddev->dev_private; +unsigned long attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + +if (!priv->vram.paddr) +return ; + +drm_mm_takedown (&priv->vram.mm); +dma_free_attrs (ddev->dev, priv->vram.size,NULL , priv->vram.paddr, + attrs); +} +static int msm_drm_init (struct device *dev,const struct drm_driver *drv) {struct msm_drm_private *priv =dev_get_drvdata (dev);
@@ -450,7 +460,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)/* Bind all our sub-components: */ ret =component_bind_all (dev, ddev);if (ret) - goto err_put_dev; + goto err_deinit_vram;dma_set_max_seg_size (dev,UINT_MAX );
@@ -548,6 +558,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)return ret; +err_deinit_vram: +msm_deinit_vram (ddev); err_put_dev:drm_dev_put (ddev);