All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: seanpaul@chromium.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [bug report] drm: Add helpers to kick off self refresh mode in drivers
Date: Wed, 19 Jun 2019 12:41:52 +0300	[thread overview]
Message-ID: <20190619094151.GI18776@kadam> (raw)
In-Reply-To: <20190619093937.GA25140@mwanda>

On Wed, Jun 19, 2019 at 12:39:37PM +0300, Dan Carpenter wrote:
>     72          int i, ret;
>     73  
>     74          drm_modeset_acquire_init(&ctx, 0);
>     75  
>     76          state = drm_atomic_state_alloc(dev);
>     77          if (!state) {
>     78                  ret = -ENOMEM;
>     79                  goto out;
>                         ^^^^^^^^
> The allocation failed.
> 
>     80          }
>     81  
>     82  retry:
>     83          state->acquire_ctx = &ctx;
>     84  
>     85          crtc_state = drm_atomic_get_crtc_state(state, crtc);
>     86          if (IS_ERR(crtc_state)) {
>     87                  ret = PTR_ERR(crtc_state);
>     88                  goto out;
>     89          }
>     90  
>     91          if (!crtc_state->enable)
>     92                  goto out;

Oh...  Also we need to set "ret" here.

>     93  
>     94          ret = drm_atomic_add_affected_connectors(state, crtc);
>     95          if (ret)
>     96                  goto out;
>     97  
>     98          for_each_new_connector_in_state(state, conn, conn_state, i) {
>     99                  if (!conn_state->self_refresh_aware)
>    100                          goto out;
>    101          }
>    102  
>    103          crtc_state->active = false;
>    104          crtc_state->self_refresh_active = true;
>    105  
>    106          ret = drm_atomic_commit(state);
>    107          if (ret)
>    108                  goto out;
>    109  
>    110  out:
>    111          if (ret == -EDEADLK) {
>    112                  drm_atomic_state_clear(state);
>    113                  ret = drm_modeset_backoff(&ctx);
>    114                  if (!ret)
>    115                          goto retry;
>    116          }
>    117  
>    118          drm_atomic_state_put(state);
>                                      ^^^^^
> NULL dereference.
> 
>    119          drm_modeset_drop_locks(&ctx);
>    120          drm_modeset_acquire_fini(&ctx);
>    121  }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-06-19  9:42 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 [this message]
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
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=20190619094151.GI18776@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=seanpaul@chromium.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 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.