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: <200909221435.22512.rusty@rustcorp.com.au>
Date:	Tue, 22 Sep 2009 14:35:21 +0930
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Tejun Heo <tj@...nel.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org, Eric Dumazet <dada1@...mosbay.com>,
	Américo Wang <xiyou.wangcong@...il.com>
Subject: Re: [PATCH] fix error handling in load_module()

On Tue, 22 Sep 2009 12:11:21 am Tejun Heo wrote:
> Hello, Andrew.
> 
> Andrew Morton wrote:
> > My reverse engineering of the secret, undocumented percpu_modfree()
> > indicates that its mad inventor intended that percpu_modfree(NULL) be a
> > valid thing to do.
> > 
> > It calls free_percpu(), all implementations of which appear to secretly
> > support free_percpu(NULL).
> 
> Eh... unfortunately, the original percpu_modfree() implementation
> didn't seem to support it.

OK, I'll Andrew's fix for Tejun, and after his (spot-on!) comment about
percpu_modfree never taking NULL, I've fixed the one caller to match
the other two:

Subject: module: don't call percpu_modfree on NULL pointer.

The general one handles NULL, the static obsolescent
(CONFIG_HAVE_LEGACY_PER_CPU_AREA) one in module.c doesn't; Eric's
commit 720eba31 assumed it did, and various frobbings since then kept
that assumption.

All other callers in module.c all protect it with an if; this effectively
does the same as free_init is only goto if we fail percpu_modalloc().

Reported-by: Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
Cc: Eric Dumazet <dada1@...mosbay.com>
Cc: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Américo Wang <xiyou.wangcong@...il.com>

diff --git a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2522,8 +2522,8 @@ static noinline struct module *load_modu
  free_unload:
 	module_unload_free(mod);
 #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+	percpu_modfree(mod->refptr);
  free_init:
-	percpu_modfree(mod->refptr);
 #endif
 	module_free(mod, mod->module_init);
  free_core:
--
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