lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <0a3813079e349d4871c85d0015b9cf16fdbb0dea.1613978176.git.viresh.kumar@linaro.org>
Date:   Mon, 22 Feb 2021 12:48:06 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>,
        Tushar Khandelwal <Tushar.Khandelwal@....com>,
        Jassi Brar <jassisinghbrar@...il.com>
Cc:     Vincent Guittot <vincent.guittot@...aro.org>,
        "v5 . 11" <stable@...r.kernel.org>,
        kernel test robot <lkp@...el.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        Tushar Khandelwal <tushar.khandelwal@....com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...r.kernel.org> # v5.11
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/mailbox/arm_mhuv2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 }
 
-- 
2.25.0.rc1.19.g042ed3e048af

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ