Only call sys_munlock if current->mm is non-null to avoid
race condition where mm cleanup happens before tlk_device_release
is invoked.
Bug
200069038
Change-Id: I0ec2f9ba5cdf4f380d79aea86bc11b67adbada51
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/670000
(cherry picked from commit
69a9d75b7ea4b49be78566a81b49bacbb34008e3)
Reviewed-on: http://git-master/r/672292
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Chris Johnson <cwj@nvidia.com>
Tested-by: Chris Johnson <cwj@nvidia.com>
/*
- * Copyright (c) 2012-2014 NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2012-2015 NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
kfree(shmem_desc->pages);
- if (shmem_desc->is_locked) {
+ if (shmem_desc->is_locked && current->mm) {
status = sys_munlock((unsigned long)shmem_desc->buffer,
shmem_desc->size);
if (status)