]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
drm: correctly restore mappings if drm_open fails
authorIlija Hadzic <ihadzic@research.bell-labs.com>
Tue, 2 Apr 2013 13:56:10 +0000 (09:56 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 2 Apr 2013 20:44:38 +0000 (06:44 +1000)
commita8ec3a662921220fc058ed6f7f3674697876d218
treee7c35670e35d4e5ace87b01c83652dfee006fdc4
parent7cebefe6cca5e8ff6ec9ba13ff9edb03d3c19fc7
drm: correctly restore mappings if drm_open fails

If first drm_open fails, the error-handling path will
incorrectly restore inode's mapping to NULL. This can
cause the crash later on. Fix by separately storing
away mapping pointers that drm_open can touch and
restore each from its own respective variable if the
call fails.

Fixes: https://bugzilla.novell.com/show_bug.cgi?id=807850
(thanks to Michal Hocko for investigating investigating and
finding the root cause of the bug)

Reference:
http://lists.freedesktop.org/archives/dri-devel/2013-March/036564.html

v2: Use one variable to store file and inode mapping
    since they are the same at the function entry.
    Fix spelling mistakes in commit message.

v3: Add reference to the original bug report.

Reported-by: Marco Munderloh <munderl@tnt.uni-hannover.de>
Tested-by: Marco Munderloh <munderl@tnt.uni-hannover.de>
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_fops.c