security: tlk_driver: return failure for IOCTL_FILE_NEW_REQ during suspend
Varun Wadekar [Tue, 2 Jul 2013 07:26:15 +0000 (12:26 +0530)]
The user space daemon will retry 3 times whenever it receives errors for new
requests.

Bug 1314244

Change-Id: I57f1740d7b24d2f3f3f97e7e83a5434f54d05bdb
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/244187
(cherry picked from commit 639efa238a01be8fd9debf4c8511c9eac942fc46)
Reviewed-on: http://git-master/r/249874
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Aaron Gamble <jgamble@nvidia.com>

security/tlk_driver/ote_fs.c

index 716d004..4c9997a 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/list.h>
 #include <linux/completion.h>
 #include <linux/workqueue.h>
-#include <linux/freezer.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
 
@@ -63,13 +62,13 @@ int te_handle_fs_ioctl(struct file *file, unsigned int ioctl_num,
 
                ptr_user_req = (struct te_file_req *)ioctl_param;
 
-               set_freezable();
-
                set_bit(TE_FS_READY_BIT, &fs_ready);
 
                /* wait for a new request */
-               while (wait_for_completion_interruptible(&req_ready))
-                       try_to_freeze();
+               if (wait_for_completion_interruptible(&req_ready)) {
+                       clear_bit(TE_FS_READY_BIT, &fs_ready);
+                       return -ENODATA;
+               }
 
                /* dequeue new request from the secure world */
                req_node = list_first_entry(&req_list, struct te_file_req_node,
@@ -181,11 +180,8 @@ static void _te_fs_file_operation(const char *name, void *buf, int len,
        list_add_tail(&req_list, &req_node->node);
        complete(&req_ready);
 
-       set_freezable();
-
        /* wait for the consumer's signal */
-       while (wait_for_completion_interruptible(&req_complete))
-               try_to_freeze();
+       wait_for_completion(&req_complete);
 
        kfree(new_req);