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: <20180424125128.GA625@embeddedor.com>
Date:   Tue, 24 Apr 2018 07:51:28 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [PATCH] omap3isp: ispstat: fix potential NULL pointer dereference

new_conf is indirectly dereferenced before it is null checked, hence
there is a potential null pointer dereference.

Fix this by moving the pointer dereference after new_conf has been
properly null checked.

Addresses-Coverity-ID: 1468386 ("Dereference before null check")
Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
---
 drivers/media/platform/omap3isp/ispstat.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index 0b31f6c..549c7ab 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -522,8 +522,8 @@ int omap3isp_stat_config(struct ispstat *stat, void *new_conf)
 {
 	int ret;
 	unsigned long irqflags;
-	struct ispstat_generic_config *user_cfg = new_conf;
-	u32 buf_size = user_cfg->buf_size;
+	struct ispstat_generic_config *user_cfg;
+	u32 buf_size;
 
 	if (!new_conf) {
 		dev_dbg(stat->isp->dev, "%s: configuration is NULL\n",
@@ -531,6 +531,9 @@ int omap3isp_stat_config(struct ispstat *stat, void *new_conf)
 		return -EINVAL;
 	}
 
+	user_cfg = new_conf;
+	buf_size = user_cfg->buf_size;
+
 	mutex_lock(&stat->ioctl_lock);
 
 	dev_dbg(stat->isp->dev,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ