Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ast: Don't grab dev->struct_mutex for in mmap offset ioctl

Since David Herrmann's mmap vma manager rework we don't need to grab
dev->struct_mutex any more to prevent races when looking up the mmap
offset. Drop it and instead don't forget to use the unref_unlocked
variant (since the drm core still cares).

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

+5 -11
+5 -11
drivers/gpu/drm/ast/ast_main.c
··· 571 571 uint64_t *offset) 572 572 { 573 573 struct drm_gem_object *obj; 574 - int ret; 575 574 struct ast_bo *bo; 576 575 577 - mutex_lock(&dev->struct_mutex); 578 576 obj = drm_gem_object_lookup(dev, file, handle); 579 - if (obj == NULL) { 580 - ret = -ENOENT; 581 - goto out_unlock; 582 - } 577 + if (obj == NULL) 578 + return -ENOENT; 583 579 584 580 bo = gem_to_ast_bo(obj); 585 581 *offset = ast_bo_mmap_offset(bo); 586 582 587 - drm_gem_object_unreference(obj); 588 - ret = 0; 589 - out_unlock: 590 - mutex_unlock(&dev->struct_mutex); 591 - return ret; 583 + drm_gem_object_unreference_unlocked(obj); 584 + 585 + return 0; 592 586 593 587 } 594 588