summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanyuan Liu <yuanliu@codeaurora.org>2017-05-24 11:57:37 -0700
committerYuanyuan Liu <yuanliu@codeaurora.org>2017-05-24 14:08:16 -0700
commitcfc60f45a2bf046df4a1e79e449004efb2dc3d09 (patch)
treef4f993c4ccf5c1a1987fbe4f49a22366a1d7a63b
parent3d82d66409abb91539bcb9d1f343fcb9d583f2b4 (diff)
icnss: Free regread buffer before allocating new one
Free already allocated buffer before allocating new one to avoid memory leak when someone keep writing to this file but never read it. CRs-Fixed: 2051862 Change-Id: I29784fb30ea8eed315b7d073d35480972642bc55 Signed-off-by: Yuanyuan Liu <yuanliu@codeaurora.org>
-rw-r--r--drivers/soc/qcom/icnss.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c
index 8c242bc7a702..bb79ea5c9e60 100644
--- a/drivers/soc/qcom/icnss.c
+++ b/drivers/soc/qcom/icnss.c
@@ -3971,6 +3971,9 @@ static ssize_t icnss_regread_write(struct file *fp, const char __user *user_buf,
data_len > QMI_WLFW_MAX_DATA_SIZE_V01)
return -EINVAL;
+ kfree(priv->diag_reg_read_buf);
+ priv->diag_reg_read_buf = NULL;
+
reg_buf = kzalloc(data_len, GFP_KERNEL);
if (!reg_buf)
return -ENOMEM;