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: <4f91be7b-a983-de6c-1f79-5266dcf5157e@users.sourceforge.net>
Date:   Wed, 25 Jan 2017 10:33:12 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-ima-devel@...ts.sourceforge.net,
        linux-ima-user@...ts.sourceforge.net,
        linux-security-module@...r.kernel.org,
        Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
        James Morris <james.l.morris@...cle.com>,
        Mimi Zohar <zohar@...ux.vnet.ibm.com>,
        "Serge E. Hallyn" <serge@...lyn.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 2/3] ima_fs: Reorder input parameter validation in
 ima_write_policy()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 24 Jan 2017 22:38:00 +0100

Move validation for the input parameter "ppos" to the beginning in this
function so that a following check for the input parameter "datalen"
can be occasionally avoided earlier.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 security/integrity/ima/ima_fs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index c1c8d34d111d..98304411915d 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -315,15 +315,14 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
 	char *data;
 	ssize_t result;
 
-	if (datalen >= PAGE_SIZE)
-		datalen = PAGE_SIZE - 1;
-
 	/* No partial writes. */
 	result = -EINVAL;
 	if (*ppos != 0)
 		goto reset_validity;
 
 	result = -ENOMEM;
+	if (datalen >= PAGE_SIZE)
+		datalen = PAGE_SIZE - 1;
 	data = kmalloc(datalen + 1, GFP_KERNEL);
 	if (!data)
 		goto reset_validity;
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ