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
(thanks to Michal Hocko for investigating investigating and
finding the root cause of the bug)
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 <firstname.lastname@example.org>
Tested-by: Marco Munderloh <email@example.com>
Signed-off-by: Ilija Hadzic <firstname.lastname@example.org>
Cc: Michal Hocko <email@example.com>
Signed-off-by: Dave Airlie <firstname.lastname@example.org>
1 file changed