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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 03 Jan 2013 11:11:03 +1030
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Sasha Levin <sasha.levin@...cle.com>, linux-kernel@...r.kernel.org
Cc:	Sasha Levin <sasha.levin@...cle.com>
Subject: Re: [PATCH] module: prevent warning when finit_module a 0 sized file

Sasha Levin <sasha.levin@...cle.com> writes:

> If we try to finit_module on a file sized 0 bytes vmalloc will
> scream and spit out a warning.
>
> Since modules have to be bigger than 0 bytes anyways we can just
> check that beforehand and avoid the warning.

Applied, but I added the comment you somehow missed :)

Thanks,
Rusty.

diff --git a/kernel/module.c b/kernel/module.c
index 250092c..41bc118 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2527,6 +2527,13 @@ static int copy_module_from_fd(int fd, struct load_info *info)
 		err = -EFBIG;
 		goto out;
 	}
+
+	/* Don't hand 0 to vmalloc, it whines. */
+	if (stat.size == 0) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	info->hdr = vmalloc(stat.size);
 	if (!info->hdr) {
 		err = -ENOMEM;
--
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