security: tlk: abort driver init if dev->req_param_buf is NULL
Varun Wadekar [Mon, 7 Apr 2014 06:51:22 +0000 (11:51 +0530)]
During driver init, we allocate memory for dev->req_param_buf if
the secure firmware supports the new way of accessing request
params. We need to check that dev->req_param_buf was allocated
before using it.

Change-Id: I796255274937f46fe01aeb1f5372c23bae830b85
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/393218
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

security/tlk_driver/ote_device.c

index bfc59d3..d7dfd7a 100644 (file)
@@ -76,7 +76,7 @@ static int te_create_free_cmd_list(struct tlk_device *dev)
                                        &dev->param_addr_phys, GFP_KERNEL);
        }
 
-       if ((dev->req_addr == NULL) || (dev->param_addr == NULL)) {
+       if (!dev->req_addr || !dev->param_addr || !dev->req_param_buf) {
                ret = -ENOMEM;
                goto error;
        }