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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426618104-32401-1-git-send-email-daniel@zonque.org>
Date:	Tue, 17 Mar 2015 19:48:24 +0100
From:	Daniel Mack <daniel@...que.org>
To:	gregkh@...uxfoundation.org
Cc:	dh.herrmann@...glemail.com, tixxdz@...ndz.org,
	dan.carpenter@...cle.com, linux-kernel@...r.kernel.org,
	Daniel Mack <daniel@...que.org>
Subject: [PATCH] kdbus: connection: fix handling of failed fget()

The patch 5fc8dd5c84fc: "kdbus: add connection, queue handling and
message validation code" from Sep 11, 2014, leads to the following
static checker warning:

	ipc/kdbus/connection.c:2000 kdbus_cmd_send()
	warn: 'cancel_fd' isn't an ERR_PTR

Fix this by checking for NULL pointers returned from fget().

Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Daniel Mack <daniel@...que.org>
---
 ipc/kdbus/connection.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index e554f1a..ab476fa 100644
--- a/ipc/kdbus/connection.c
+++ b/ipc/kdbus/connection.c
@@ -1997,9 +1997,8 @@ int kdbus_cmd_send(struct kdbus_conn *conn, struct file *f, void __user *argp)
 
 	if (argv[1].item) {
 		cancel_fd = fget(argv[1].item->fds[0]);
-		if (IS_ERR(cancel_fd)) {
-			ret = PTR_ERR(cancel_fd);
-			cancel_fd = NULL;
+		if (!cancel_fd) {
+			ret = -EBADF;
 			goto exit;
 		}
 
-- 
2.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ