diff options
| author | Dave Airlie <airlied@redhat.com> | 2013-04-02 16:44:02 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-04-02 16:44:02 -0400 |
| commit | 7cebefe6cca5e8ff6ec9ba13ff9edb03d3c19fc7 (patch) | |
| tree | 66f54af06f2aacb81d504dfd682c485ff3997cc3 | |
| parent | 1caa590075ddef41950c46123e80cd6a64505218 (diff) | |
| parent | e4604d8fe8492f8120cf92d4b60b3cc90ba87bd0 (diff) | |
Merge branch 'drm-nouveau-fixes-3.9' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
Oops fixers.
* 'drm-nouveau-fixes-3.9' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
drm/nouveau: fix NULL ptr dereference from nv50_disp_intr()
drm/nouveau: fix handling empty channel list in ioctl's
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_abi16.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 32 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.h | 2 |
3 files changed, 31 insertions, 21 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 3b6dc883e150..5eb3e0da7c6e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
| @@ -391,7 +391,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
| 391 | struct nouveau_drm *drm = nouveau_drm(dev); | 391 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 392 | struct nouveau_device *device = nv_device(drm->device); | 392 | struct nouveau_device *device = nv_device(drm->device); |
| 393 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 393 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
| 394 | struct nouveau_abi16_chan *chan, *temp; | 394 | struct nouveau_abi16_chan *chan = NULL, *temp; |
| 395 | struct nouveau_abi16_ntfy *ntfy; | 395 | struct nouveau_abi16_ntfy *ntfy; |
| 396 | struct nouveau_object *object; | 396 | struct nouveau_object *object; |
| 397 | struct nv_dma_class args = {}; | 397 | struct nv_dma_class args = {}; |
| @@ -404,10 +404,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
| 404 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) | 404 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) |
| 405 | return nouveau_abi16_put(abi16, -EINVAL); | 405 | return nouveau_abi16_put(abi16, -EINVAL); |
| 406 | 406 | ||
| 407 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 407 | list_for_each_entry(temp, &abi16->channels, head) { |
| 408 | if (chan->chan->handle == (NVDRM_CHAN | info->channel)) | 408 | if (temp->chan->handle == (NVDRM_CHAN | info->channel)) { |
| 409 | chan = temp; | ||
| 409 | break; | 410 | break; |
| 410 | chan = NULL; | 411 | } |
| 411 | } | 412 | } |
| 412 | 413 | ||
| 413 | if (!chan) | 414 | if (!chan) |
| @@ -459,17 +460,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS) | |||
| 459 | { | 460 | { |
| 460 | struct drm_nouveau_gpuobj_free *fini = data; | 461 | struct drm_nouveau_gpuobj_free *fini = data; |
| 461 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 462 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
| 462 | struct nouveau_abi16_chan *chan, *temp; | 463 | struct nouveau_abi16_chan *chan = NULL, *temp; |
| 463 | struct nouveau_abi16_ntfy *ntfy; | 464 | struct nouveau_abi16_ntfy *ntfy; |
| 464 | int ret; | 465 | int ret; |
| 465 | 466 | ||
| 466 | if (unlikely(!abi16)) | 467 | if (unlikely(!abi16)) |
| 467 | return -ENOMEM; | 468 | return -ENOMEM; |
| 468 | 469 | ||
| 469 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 470 | list_for_each_entry(temp, &abi16->channels, head) { |
| 470 | if (chan->chan->handle == (NVDRM_CHAN | fini->channel)) | 471 | if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) { |
| 472 | chan = temp; | ||
| 471 | break; | 473 | break; |
| 472 | chan = NULL; | 474 | } |
| 473 | } | 475 | } |
| 474 | 476 | ||
| 475 | if (!chan) | 477 | if (!chan) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index d1099365bfc1..c95decf543e9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
| @@ -72,11 +72,25 @@ module_param_named(modeset, nouveau_modeset, int, 0400); | |||
| 72 | static struct drm_driver driver; | 72 | static struct drm_driver driver; |
| 73 | 73 | ||
| 74 | static int | 74 | static int |
| 75 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | ||
| 76 | { | ||
| 77 | struct nouveau_drm *drm = | ||
| 78 | container_of(event, struct nouveau_drm, vblank[head]); | ||
| 79 | drm_handle_vblank(drm->dev, head); | ||
| 80 | return NVKM_EVENT_KEEP; | ||
| 81 | } | ||
| 82 | |||
| 83 | static int | ||
| 75 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) | 84 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) |
| 76 | { | 85 | { |
| 77 | struct nouveau_drm *drm = nouveau_drm(dev); | 86 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 78 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
| 79 | nouveau_event_get(pdisp->vblank, head, &drm->vblank); | 88 | |
| 89 | if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank))) | ||
| 90 | return -EIO; | ||
| 91 | WARN_ON_ONCE(drm->vblank[head].func); | ||
| 92 | drm->vblank[head].func = nouveau_drm_vblank_handler; | ||
| 93 | nouveau_event_get(pdisp->vblank, head, &drm->vblank[head]); | ||
| 80 | return 0; | 94 | return 0; |
| 81 | } | 95 | } |
| 82 | 96 | ||
| @@ -85,16 +99,11 @@ nouveau_drm_vblank_disable(struct drm_device *dev, int head) | |||
| 85 | { | 99 | { |
| 86 | struct nouveau_drm *drm = nouveau_drm(dev); | 100 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 101 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
| 88 | nouveau_event_put(pdisp->vblank, head, &drm->vblank); | 102 | if (drm->vblank[head].func) |
| 89 | } | 103 | nouveau_event_put(pdisp->vblank, head, &drm->vblank[head]); |
| 90 | 104 | else | |
| 91 | static int | 105 | WARN_ON_ONCE(1); |
| 92 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | 106 | drm->vblank[head].func = NULL; |
| 93 | { | ||
| 94 | struct nouveau_drm *drm = | ||
| 95 | container_of(event, struct nouveau_drm, vblank); | ||
| 96 | drm_handle_vblank(drm->dev, head); | ||
| 97 | return NVKM_EVENT_KEEP; | ||
| 98 | } | 107 | } |
| 99 | 108 | ||
| 100 | static u64 | 109 | static u64 |
| @@ -292,7 +301,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
| 292 | 301 | ||
| 293 | dev->dev_private = drm; | 302 | dev->dev_private = drm; |
| 294 | drm->dev = dev; | 303 | drm->dev = dev; |
| 295 | drm->vblank.func = nouveau_drm_vblank_handler; | ||
| 296 | 304 | ||
| 297 | INIT_LIST_HEAD(&drm->clients); | 305 | INIT_LIST_HEAD(&drm->clients); |
| 298 | spin_lock_init(&drm->tile.lock); | 306 | spin_lock_init(&drm->tile.lock); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index b25df374c901..9c39bafbef2c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
| @@ -113,7 +113,7 @@ struct nouveau_drm { | |||
| 113 | struct nvbios vbios; | 113 | struct nvbios vbios; |
| 114 | struct nouveau_display *display; | 114 | struct nouveau_display *display; |
| 115 | struct backlight_device *backlight; | 115 | struct backlight_device *backlight; |
| 116 | struct nouveau_eventh vblank; | 116 | struct nouveau_eventh vblank[4]; |
| 117 | 117 | ||
| 118 | /* power management */ | 118 | /* power management */ |
| 119 | struct nouveau_pm *pm; | 119 | struct nouveau_pm *pm; |
