Skip to content

Commit 96413c7

Browse files
committed
Merge tag 'drm-misc-next-fixes-2019-03-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
- Properly mark the ptr_to_compat argument with the __user tag - Merge __drm_atomic_helper_disable_all into drm_atomic_helper_disable_all Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190306105454.33ddidiqmsjcvxa4@flea
2 parents 4b057e7 + e552f08 commit 96413c7

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,9 +3039,31 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
30393039
return 0;
30403040
}
30413041

3042-
static int __drm_atomic_helper_disable_all(struct drm_device *dev,
3043-
struct drm_modeset_acquire_ctx *ctx,
3044-
bool clean_old_fbs)
3042+
/**
3043+
* drm_atomic_helper_disable_all - disable all currently active outputs
3044+
* @dev: DRM device
3045+
* @ctx: lock acquisition context
3046+
*
3047+
* Loops through all connectors, finding those that aren't turned off and then
3048+
* turns them off by setting their DPMS mode to OFF and deactivating the CRTC
3049+
* that they are connected to.
3050+
*
3051+
* This is used for example in suspend/resume to disable all currently active
3052+
* functions when suspending. If you just want to shut down everything at e.g.
3053+
* driver unload, look at drm_atomic_helper_shutdown().
3054+
*
3055+
* Note that if callers haven't already acquired all modeset locks this might
3056+
* return -EDEADLK, which must be handled by calling drm_modeset_backoff().
3057+
*
3058+
* Returns:
3059+
* 0 on success or a negative error code on failure.
3060+
*
3061+
* See also:
3062+
* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
3063+
* drm_atomic_helper_shutdown().
3064+
*/
3065+
int drm_atomic_helper_disable_all(struct drm_device *dev,
3066+
struct drm_modeset_acquire_ctx *ctx)
30453067
{
30463068
struct drm_atomic_state *state;
30473069
struct drm_connector_state *conn_state;
@@ -3099,35 +3121,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
30993121
drm_atomic_state_put(state);
31003122
return ret;
31013123
}
3102-
3103-
/**
3104-
* drm_atomic_helper_disable_all - disable all currently active outputs
3105-
* @dev: DRM device
3106-
* @ctx: lock acquisition context
3107-
*
3108-
* Loops through all connectors, finding those that aren't turned off and then
3109-
* turns them off by setting their DPMS mode to OFF and deactivating the CRTC
3110-
* that they are connected to.
3111-
*
3112-
* This is used for example in suspend/resume to disable all currently active
3113-
* functions when suspending. If you just want to shut down everything at e.g.
3114-
* driver unload, look at drm_atomic_helper_shutdown().
3115-
*
3116-
* Note that if callers haven't already acquired all modeset locks this might
3117-
* return -EDEADLK, which must be handled by calling drm_modeset_backoff().
3118-
*
3119-
* Returns:
3120-
* 0 on success or a negative error code on failure.
3121-
*
3122-
* See also:
3123-
* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
3124-
* drm_atomic_helper_shutdown().
3125-
*/
3126-
int drm_atomic_helper_disable_all(struct drm_device *dev,
3127-
struct drm_modeset_acquire_ctx *ctx)
3128-
{
3129-
return __drm_atomic_helper_disable_all(dev, ctx, false);
3130-
}
31313124
EXPORT_SYMBOL(drm_atomic_helper_disable_all);
31323125

31333126
/**
@@ -3148,7 +3141,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
31483141

31493142
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
31503143

3151-
ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
3144+
ret = drm_atomic_helper_disable_all(dev, &ctx);
31523145
if (ret)
31533146
DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
31543147

drivers/gpu/drm/drm_ioc32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
185185
m32.size = map.size;
186186
m32.type = map.type;
187187
m32.flags = map.flags;
188-
m32.handle = ptr_to_compat(map.handle);
188+
m32.handle = ptr_to_compat((void __user *)map.handle);
189189
m32.mtrr = map.mtrr;
190190
if (copy_to_user(argp, &m32, sizeof(m32)))
191191
return -EFAULT;
@@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
216216

217217
m32.offset = map.offset;
218218
m32.mtrr = map.mtrr;
219-
m32.handle = ptr_to_compat(map.handle);
219+
m32.handle = ptr_to_compat((void __user *)map.handle);
220220
if (map.handle != compat_ptr(m32.handle))
221221
pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
222222
map.handle, m32.type, m32.offset);
@@ -526,7 +526,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
526526
if (err)
527527
return err;
528528

529-
req32.handle = ptr_to_compat(req.handle);
529+
req32.handle = ptr_to_compat((void __user *)req.handle);
530530
if (copy_to_user(argp, &req32, sizeof(req32)))
531531
return -EFAULT;
532532

0 commit comments

Comments
 (0)