summaryrefslogtreecommitdiff
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2021-02-22 10:18:06 +0300
committerJassi Brar <jaswinder.singh@linaro.org>2021-02-22 22:34:27 +0300
commit6b50df2b8c208a04d44b8df5b7baaf668ceb8fc3 (patch)
treede9a12d880c8ca9b212cdbc007ed88edcf858ef4 /drivers/mailbox
parentd1e6bc0ca01c0b0b1a2d543223024cf2c8f52fb7 (diff)
downloadlinux-6b50df2b8c208a04d44b8df5b7baaf668ceb8fc3.tar.xz
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: 5a6338cce9f4 ("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>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/arm_mhuv2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
index cdfb1939fabf..d997f8ebfa98 100644
--- a/drivers/mailbox/arm_mhuv2.c
+++ b/drivers/mailbox/arm_mhuv2.c
@@ -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;
}