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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190726134432.12993-20-sashal@kernel.org>
Date:   Fri, 26 Jul 2019 09:44:22 -0400
From:   Sasha Levin <sashal@...nel.org>
To:     linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc:     Zhouyang Jia <jiazhouyang09@...il.com>,
        Jan Harkes <jaharkes@...cmu.edu>,
        Arnd Bergmann <arnd@...db.de>,
        Colin Ian King <colin.king@...onical.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        David Howells <dhowells@...hat.com>,
        Fabian Frederick <fabf@...net.be>,
        Mikko Rapeli <mikko.rapeli@....fi>,
        Sam Protsenko <semen.protsenko@...aro.org>,
        Yann Droneaud <ydroneaud@...eya.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Sasha Levin <sashal@...nel.org>, codalist@...a.cs.cmu.edu
Subject: [PATCH AUTOSEL 4.9 20/30] coda: add error handling for fget

From: Zhouyang Jia <jiazhouyang09@...il.com>

[ Upstream commit 02551c23bcd85f0c68a8259c7b953d49d44f86af ]

When fget fails, the lack of error-handling code may cause unexpected
results.

This patch adds error-handling code after calling fget.

Link: http://lkml.kernel.org/r/2514ec03df9c33b86e56748513267a80dd8004d9.1558117389.git.jaharkes@cs.cmu.edu
Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
Signed-off-by: Jan Harkes <jaharkes@...cmu.edu>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Colin Ian King <colin.king@...onical.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Fabian Frederick <fabf@...net.be>
Cc: Mikko Rapeli <mikko.rapeli@....fi>
Cc: Sam Protsenko <semen.protsenko@...aro.org>
Cc: Yann Droneaud <ydroneaud@...eya.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
 fs/coda/psdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 822629126e89..ff9b5cf8ff01 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -187,8 +187,11 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf,
 	if (req->uc_opcode == CODA_OPEN_BY_FD) {
 		struct coda_open_by_fd_out *outp =
 			(struct coda_open_by_fd_out *)req->uc_data;
-		if (!outp->oh.result)
+		if (!outp->oh.result) {
 			outp->fh = fget(outp->fd);
+			if (!outp->fh)
+				return -EBADF;
+		}
 	}
 
         wake_up(&req->uc_sleep);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ