Trivial cleanups, mainly.

Cheers,
 Rusty.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJU3ZxKAAoJENkgDmzRrbjxJ4gQAL7Jma9KPJ8BJ/4ICVGn+4jm
 u3p3dGMVPjldiwJPZVThlbVZn0LUdML4T3y85vhBb1511kDov+t7D8OmlkogVjfw
 08LZlu6YIVrZPOx2VrMMemCNPRofsRpXe3v44p+cVyKTxDP35Z5NUgby036p8JsZ
 //koPL/1p0MzOQkFuAHVl2G9GE2cTy7L2tB2ZZWP829dMnETTteCEpM8Fjd2UeGg
 ooh+9LOBa/490fTSw+4gqItDTqmfEKdIMxU8R9G5XH1Bdof1ddNrMuQaSuI4DhAQ
 aLCK8bogo3nEE80pNWVNIgzi9GCk+KePiocV1r83K8pVRGVOydbUkggoOeh03fZT
 bNEScgsgLXabRzmuNtCbjq3gtyR6DGF3bAk2wpIhSDzjQxAtjq9eyRAyLB5iYKRD
 Aoyq0imYGMBZfhxzevewAqafJ7HIczw9CN1FpnZbpT/Tljn7IoG4tB8oTcshZYRZ
 PzN2NZrLzL0zvbNZBPaJZu01pBZb4xre3WeZFpeUBKpwx0KUpGEduxPOYqRzldAs
 /pzUsvpCpXg0QNl0gQmsZ3FvhpWLfGpwJKchW6dQzPcHVVTL90hMncHNQFIcFLB/
 WWZ04jwjG576pmSS4jvXJo6VMsWUQZX0EAo2JOwBLg1Z6wpqJaWWctdp5BYTTGQ4
 ZEU1LfDLykH31JXmaRSS
 =y2j/
 -----END PGP SIGNATURE-----

Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module update from Rusty Russell:
 "Trivial cleanups, mainly"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: Replace over-engineered nested sleep
  module: Annotate nested sleep in resolve_symbol()
  module: Remove double spaces in module verification taint message
  kernel/module.c: Free lock-classes if parse_args failed
  module: set ksymtab/kcrctab* section addresses to 0x0
This commit is contained in:
Linus Torvalds 2015-02-13 10:47:13 -08:00
commit a42cf70eb8
2 changed files with 28 additions and 39 deletions

View file

@ -1225,6 +1225,12 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
const unsigned long *crc;
int err;
/*
* The module_mutex should not be a heavily contended lock;
* if we get the occasional sleep here, we'll go an extra iteration
* in the wait_event_interruptible(), which is harmless.
*/
sched_annotate_sleep();
mutex_lock(&module_mutex);
sym = find_symbol(name, &owner, &crc,
!(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
@ -2978,6 +2984,12 @@ static bool finished_loading(const char *name)
struct module *mod;
bool ret;
/*
* The module_mutex should not be a heavily contended lock;
* if we get the occasional sleep here, we'll go an extra iteration
* in the wait_event_interruptible(), which is harmless.
*/
sched_annotate_sleep();
mutex_lock(&module_mutex);
mod = find_module_all(name, strlen(name), true);
ret = !mod || mod->state == MODULE_STATE_LIVE
@ -3119,32 +3131,6 @@ static int may_init_module(void)
return 0;
}
/*
* Can't use wait_event_interruptible() because our condition
* 'finished_loading()' contains a blocking primitive itself (mutex_lock).
*/
static int wait_finished_loading(struct module *mod)
{
DEFINE_WAIT_FUNC(wait, woken_wake_function);
int ret = 0;
add_wait_queue(&module_wq, &wait);
for (;;) {
if (finished_loading(mod->name))
break;
if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
}
remove_wait_queue(&module_wq, &wait);
return ret;
}
/*
* We try to place it in the list now to make sure it's unique before
* we dedicate too many resources. In particular, temporary percpu
@ -3165,8 +3151,8 @@ static int add_unformed_module(struct module *mod)
|| old->state == MODULE_STATE_UNFORMED) {
/* Wait in case it fails to load. */
mutex_unlock(&module_mutex);
err = wait_finished_loading(mod);
err = wait_event_interruptible(module_wq,
finished_loading(mod->name));
if (err)
goto out_unlocked;
goto again;
@ -3265,7 +3251,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
mod->sig_ok = info->sig_ok;
if (!mod->sig_ok) {
pr_notice_once("%s: module verification failed: signature "
"and/or required key missing - tainting "
"and/or required key missing - tainting "
"kernel\n", mod->name);
add_taint_module(mod, TAINT_UNSIGNED_MODULE, LOCKDEP_STILL_OK);
}
@ -3356,6 +3342,9 @@ static int load_module(struct load_info *info, const char __user *uargs,
module_bug_cleanup(mod);
mutex_unlock(&module_mutex);
/* Free lock-classes: */
lockdep_free_key_range(mod->module_core, mod->core_size);
/* we can't deallocate the module until we clear memory protection */
unset_module_init_ro_nx(mod);
unset_module_core_ro_nx(mod);

View file

@ -6,14 +6,14 @@
SECTIONS {
/DISCARD/ : { *(.discard) }
__ksymtab : { *(SORT(___ksymtab+*)) }
__ksymtab_gpl : { *(SORT(___ksymtab_gpl+*)) }
__ksymtab_unused : { *(SORT(___ksymtab_unused+*)) }
__ksymtab_unused_gpl : { *(SORT(___ksymtab_unused_gpl+*)) }
__ksymtab_gpl_future : { *(SORT(___ksymtab_gpl_future+*)) }
__kcrctab : { *(SORT(___kcrctab+*)) }
__kcrctab_gpl : { *(SORT(___kcrctab_gpl+*)) }
__kcrctab_unused : { *(SORT(___kcrctab_unused+*)) }
__kcrctab_unused_gpl : { *(SORT(___kcrctab_unused_gpl+*)) }
__kcrctab_gpl_future : { *(SORT(___kcrctab_gpl_future+*)) }
__ksymtab 0 : { *(SORT(___ksymtab+*)) }
__ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
__ksymtab_unused 0 : { *(SORT(___ksymtab_unused+*)) }
__ksymtab_unused_gpl 0 : { *(SORT(___ksymtab_unused_gpl+*)) }
__ksymtab_gpl_future 0 : { *(SORT(___ksymtab_gpl_future+*)) }
__kcrctab 0 : { *(SORT(___kcrctab+*)) }
__kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
__kcrctab_unused 0 : { *(SORT(___kcrctab_unused+*)) }
__kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) }
__kcrctab_gpl_future 0 : { *(SORT(___kcrctab_gpl_future+*)) }
}