summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lew <clew@codeaurora.org>2016-09-15 18:07:10 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-22 16:54:32 -0700
commit341918f5d60bf2c46bb5a43cb8c97cffa6bc4a93 (patch)
tree7fecfcc644360b4986b21d0cafef1ed0c0496439
parent9e2d528dc47d04e98c5e6f1c4ef84fc268115d36 (diff)
soc: qcom: qsee_ipc_irq_bridge: Fix null pointer dereferences
The get irq data function can return a null pointer. Add a check before using the returned value. CRs-Fixed: 1067981 Change-Id: Ib91bae1c6605e8727081c7acb248192ecf1b170a Signed-off-by: Chris Lew <clew@codeaurora.org>
-rw-r--r--drivers/soc/qcom/qsee_ipc_irq_bridge.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/soc/qcom/qsee_ipc_irq_bridge.c b/drivers/soc/qcom/qsee_ipc_irq_bridge.c
index ab43bbb7e86a..eee42d7ba314 100644
--- a/drivers/soc/qcom/qsee_ipc_irq_bridge.c
+++ b/drivers/soc/qcom/qsee_ipc_irq_bridge.c
@@ -115,10 +115,8 @@ static struct qiib_driver_data *qiib_info;
static int qiib_driver_data_init(void)
{
qiib_info = kzalloc(sizeof(*qiib_info), GFP_KERNEL);
- if (!qiib_info) {
- QIIB_ERR("Unable to allocate info pointer\n");
+ if (!qiib_info)
return -ENOMEM;
- }
INIT_LIST_HEAD(&qiib_info->list);
mutex_init(&qiib_info->list_lock);
@@ -356,6 +354,7 @@ static int qiib_parse_node(struct device_node *node, struct qiib_dev *devp)
const char *dev_name;
uint32_t irqtype;
uint32_t irq_clear[2];
+ struct irq_data *irqtype_data;
int ret = -ENODEV;
key = "qcom,dev-name";
@@ -374,7 +373,12 @@ static int qiib_parse_node(struct device_node *node, struct qiib_dev *devp)
}
QIIB_DBG("%s: %s = %d\n", __func__, key, devp->irq_line);
- irqtype = irqd_get_trigger_type(irq_get_irq_data(devp->irq_line));
+ irqtype_data = irq_get_irq_data(devp->irq_line);
+ if (!irqtype_data) {
+ QIIB_ERR("%s: get irqdata fail:%d\n", __func__, devp->irq_line);
+ goto missing_key;
+ }
+ irqtype = irqd_get_trigger_type(irqtype_data);
QIIB_DBG("%s: irqtype = %d\n", __func__, irqtype);
key = "label";