icnss2: Add null check for priv variable
Add null check for priv variable to avoid null pointer dereference. Change-Id: Ib1746d564f27f8096f66761946d37a2a3faf2e57 CRs-Fixed: 3378034
This commit is contained in:

committed by
Madan Koyyalamudi

parent
01cb81be76
commit
ecd2be21ed
@@ -152,6 +152,9 @@ static ssize_t icnss_sysfs_store(struct kobject *kobj,
|
|||||||
{
|
{
|
||||||
struct icnss_priv *priv = icnss_get_plat_priv();
|
struct icnss_priv *priv = icnss_get_plat_priv();
|
||||||
|
|
||||||
|
if (!priv)
|
||||||
|
return count;
|
||||||
|
|
||||||
icnss_pr_dbg("Received shutdown indication");
|
icnss_pr_dbg("Received shutdown indication");
|
||||||
|
|
||||||
atomic_set(&priv->is_shutdown, true);
|
atomic_set(&priv->is_shutdown, true);
|
||||||
@@ -466,7 +469,7 @@ static int icnss_send_smp2p(struct icnss_priv *priv,
|
|||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (IS_ERR(priv->smp2p_info[smp2p_entry].smem_state))
|
if (!priv || IS_ERR(priv->smp2p_info[smp2p_entry].smem_state))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* No Need to check FW_DOWN for ICNSS_RESET_MSG */
|
/* No Need to check FW_DOWN for ICNSS_RESET_MSG */
|
||||||
@@ -547,11 +550,11 @@ static irqreturn_t fw_crash_indication_handler(int irq, void *ctx)
|
|||||||
|
|
||||||
icnss_pr_err("Received early crash indication from FW\n");
|
icnss_pr_err("Received early crash indication from FW\n");
|
||||||
|
|
||||||
if (priv->wpss_self_recovery_enabled)
|
|
||||||
mod_timer(&priv->wpss_ssr_timer,
|
|
||||||
jiffies + msecs_to_jiffies(ICNSS_WPSS_SSR_TIMEOUT));
|
|
||||||
|
|
||||||
if (priv) {
|
if (priv) {
|
||||||
|
if (priv->wpss_self_recovery_enabled)
|
||||||
|
mod_timer(&priv->wpss_ssr_timer,
|
||||||
|
jiffies + msecs_to_jiffies(ICNSS_WPSS_SSR_TIMEOUT));
|
||||||
|
|
||||||
set_bit(ICNSS_FW_DOWN, &priv->state);
|
set_bit(ICNSS_FW_DOWN, &priv->state);
|
||||||
icnss_ignore_fw_timeout(true);
|
icnss_ignore_fw_timeout(true);
|
||||||
|
|
||||||
@@ -2426,6 +2429,9 @@ static void icnss_pdr_notifier_cb(int state, char *service_path, void *priv_cb)
|
|||||||
struct icnss_uevent_fw_down_data fw_down_data = {0};
|
struct icnss_uevent_fw_down_data fw_down_data = {0};
|
||||||
enum icnss_pdr_cause_index cause = ICNSS_ROOT_PD_CRASH;
|
enum icnss_pdr_cause_index cause = ICNSS_ROOT_PD_CRASH;
|
||||||
|
|
||||||
|
if (!priv)
|
||||||
|
return;
|
||||||
|
|
||||||
icnss_pr_dbg("PD service notification: 0x%lx state: 0x%lx\n",
|
icnss_pr_dbg("PD service notification: 0x%lx state: 0x%lx\n",
|
||||||
state, priv->state);
|
state, priv->state);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user