From: Daniel Vetter <daniel@ffwll.ch>
To: Sean Paul <sean@poorly.run>
Cc: Zain Wang <wzz@rock-chips.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Jose Souza <jose.souza@intel.com>,
Tomasz Figa <tfiga@chromium.org>, David Airlie <airlied@linux.ie>,
Sean Paul <seanpaul@chromium.org>,
dri-devel@lists.freedesktop.org,
Dan Carpenter <dan.carpenter@oracle.com>,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH] drm/self_refresh: Fix possible NULL deref in failure path
Date: Thu, 20 Jun 2019 13:28:55 +0200 [thread overview]
Message-ID: <20190620112855.GQ12905@phenom.ffwll.local> (raw)
In-Reply-To: <20190619181951.192305-1-sean@poorly.run>
On Wed, Jun 19, 2019 at 02:19:47PM -0400, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
>
> If state allocation fails, we still try to give back the reference on
> it. Also initialize ret in case the crtc is not enabled and we hit the
> eject button.
>
> Fixes: 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers")
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jose Souza <jose.souza@intel.com>
> Cc: Zain Wang <wzz@rock-chips.com>
> Cc: Tomasz Figa <tfiga@chromium.org>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_self_refresh_helper.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_self_refresh_helper.c b/drivers/gpu/drm/drm_self_refresh_helper.c
> index e0d2ad1f070cb..4b9424a8f1f1c 100644
> --- a/drivers/gpu/drm/drm_self_refresh_helper.c
> +++ b/drivers/gpu/drm/drm_self_refresh_helper.c
> @@ -69,14 +69,14 @@ static void drm_self_refresh_helper_entry_work(struct work_struct *work)
> struct drm_connector *conn;
> struct drm_connector_state *conn_state;
> struct drm_crtc_state *crtc_state;
> - int i, ret;
> + int i, ret = 0;
>
> drm_modeset_acquire_init(&ctx, 0);
>
> state = drm_atomic_state_alloc(dev);
> if (!state) {
> ret = -ENOMEM;
> - goto out;
> + goto out_drop_locks;
> }
>
> retry:
> @@ -116,6 +116,8 @@ static void drm_self_refresh_helper_entry_work(struct work_struct *work)
> }
>
> drm_atomic_state_put(state);
> +
> +out_drop_locks:
> drm_modeset_drop_locks(&ctx);
> drm_modeset_acquire_fini(&ctx);
> }
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-06-20 11:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 9:39 [bug report] drm: Add helpers to kick off self refresh mode in drivers Dan Carpenter
2019-06-19 9:41 ` Dan Carpenter
2019-06-19 18:19 ` [PATCH] drm/self_refresh: Fix possible NULL deref in failure path Sean Paul
2019-06-20 11:28 ` Daniel Vetter [this message]
2019-06-20 14:47 ` Sean Paul
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=20190620112855.GQ12905@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jose.souza@intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--cc=seanpaul@chromium.org \
--cc=tfiga@chromium.org \
--cc=wzz@rock-chips.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.