1
0
Fork 0

mailbox: arm_mhuv2: Skip calling kfree() with invalid pointer

It is possible that 'data' passed to kfree() is set to a error value
instead of allocated space. Make sure it doesn't get called with invalid
pointer.

Fixes: 5a6338cce9 ("mailbox: arm_mhuv2: Add driver")
Cc: v5.11 <stable@vger.kernel.org> # v5.11
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
master
Viresh Kumar 2021-02-22 12:48:06 +05:30 committed by Jassi Brar
parent d1e6bc0ca0
commit 6b50df2b8c
1 changed files with 3 additions and 1 deletions

View File

@ -699,7 +699,9 @@ static irqreturn_t mhuv2_receiver_interrupt(int irq, void *arg)
ret = IRQ_HANDLED;
}
kfree(data);
if (!IS_ERR(data))
kfree(data);
return ret;
}