soc: qcom: sanity check for aon_com_dev node
Add sanity check to handle write operation on aon_com_dev node from userspace when driver is not initialized. Change-Id: I1bd1fb94ee5b59ff113f8e359c303a2dd1f47430 Signed-off-by: Praveen koya <quic_pkoya@quicinc.com>
This commit is contained in:
@@ -1051,10 +1051,15 @@ static ssize_t slatecom_char_write(struct file *f, const char __user *buf,
|
||||
unsigned char qcli_cmnd;
|
||||
uint32_t opcode;
|
||||
int ret = 0;
|
||||
struct slatedaemon_priv *dev = container_of(slatecom_intf_drv,
|
||||
struct slatedaemon_priv *dev = NULL;
|
||||
|
||||
if (!slatecom_intf_drv) {
|
||||
pr_err("Invalid use-case, slatecom driver is not ready\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev = container_of(slatecom_intf_drv,
|
||||
struct slatedaemon_priv,
|
||||
lhndl);
|
||||
|
||||
if (copy_from_user(&qcli_cmnd, buf, sizeof(unsigned char)))
|
||||
return -EFAULT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user