]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
security: tlk_driver: fix sys_munlock issue
authorScott Long <scottl@nvidia.com>
Wed, 7 Jan 2015 05:08:25 +0000 (21:08 -0800)
committerChris Johnson <cwj@nvidia.com>
Thu, 15 Jan 2015 18:44:33 +0000 (10:44 -0800)
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>
security/tlk_driver/ote_comms.c

index f6000617b5274d6385de945f2f09f75f15ed26ec..ddeea51af1b6c6c99c221ce6db5a499b2ea6eac7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -232,7 +232,7 @@ static void te_release_mem_buffer(struct te_shmem_desc *shmem_desc)
        }
        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)