From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Jeffy Chen <jeffy.chen@rock-chips.com>, linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v2] drm/atomic: Unref duplicated drm_atomic_state in drm_atomic_helper_resume()
Date: Mon, 9 Oct 2017 13:56:57 +0200 [thread overview]
Message-ID: <a8fa4d03-e577-55c2-f2e7-8b1a9f8f1f3f@linux.intel.com> (raw)
In-Reply-To: <20171009064641.15174-1-jeffy.chen@rock-chips.com>
Op 09-10-17 om 08:46 schreef Jeffy Chen:
> Kmemleak reported memory leak after suspend and resume:
> unreferenced object 0xffffffc0e31d8880 (size 128):
> comm "bash", pid 181, jiffies 4294763583 (age 24.694s)
> hex dump (first 32 bytes):
> 01 00 00 00 00 00 00 00 00 20 a2 eb c0 ff ff ff ......... ......
> 01 00 00 00 00 00 00 00 80 87 1d e3 c0 ff ff ff ................
> backtrace:
> [<ffffffc00034bb64>] __save_stack_trace+0x48/0x6c
> [<ffffffc00034c244>] create_object+0x138/0x254
> [<ffffffc0009dd218>] kmemleak_alloc+0x58/0x8c
> [<ffffffc000346de4>] kmem_cache_alloc_trace+0x188/0x254
> [<ffffffc0005af4c0>] drm_atomic_state_alloc+0x3c/0x88
> [<ffffffc000591f0c>] drm_atomic_helper_duplicate_state+0x28/0x158
> [<ffffffc000592098>] drm_atomic_helper_suspend+0x5c/0xf0
>
> Problem here is that we are duplicating the drm_atomic_state in
> drm_atomic_helper_suspend(), but not unreference it in the resume path.
>
> Fixes: 1494276000db ("drm/atomic-helper: Implement subsystem-level suspend/resume")
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
>
> Changes in v2:
> Unref duplicated drm_atomic_state in drm_atomic_helper_resume() instead
> of specific drivers.
>
> drivers/gpu/drm/drm_atomic_helper.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 01c34bc5b5b0..4a262380c631 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3052,6 +3052,7 @@ int drm_atomic_helper_resume(struct drm_device *dev,
> drm_modeset_backoff(&ctx);
> }
>
> + drm_atomic_state_put(state);
> drm_modeset_drop_locks(&ctx);
> drm_modeset_acquire_fini(&ctx);
>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
Cc: <stable@vger.kernel.org> # v4.10+
and pushed, thanks for finding it. :)
The bug is probably older than that commit, but only happened on failure paths before. If resume fails we probably have bigger issues than leaking some memory.
prev parent reply other threads:[~2017-10-09 11:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 6:46 Jeffy Chen
2017-10-09 11:56 ` Maarten Lankhorst [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a8fa4d03-e577-55c2-f2e7-8b1a9f8f1f3f@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jeffy.chen@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome