All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Subject: [PATCH 85/93] module: fix symbol waiting when module fails before init
Date: Tue,  5 Feb 2013 20:07:14 -0200	[thread overview]
Message-ID: <1360102042-10732-86-git-send-email-herton.krzesinski@canonical.com> (raw)
In-Reply-To: <1360102042-10732-1-git-send-email-herton.krzesinski@canonical.com>

3.5.7.5 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rusty Russell <rusty@rustcorp.com.au>

commit 6f13909f4fe9652f189b462c6c98767309000321 upstream.

We use resolve_symbol_wait(), which blocks if the module containing
the symbol is still loading.  However:

1) The module_wq we use is only woken after calling the modules' init
   function, but there are other failure paths after the module is
   placed in the linked list where we need to do the same thing.

2) wake_up() only wakes one waiter, and our waitqueue is shared by all
   modules, so we need to wake them all.

3) wake_up_all() doesn't imply a memory barrier: I feel happier calling
   it after we've grabbed and dropped the module_mutex, not just after
   the state assignment.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 kernel/module.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 2a15c59..27e302a 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2984,7 +2984,7 @@ static struct module *load_module(void __user *umod,
 	/* Unlink carefully: kallsyms could be walking list. */
 	list_del_rcu(&mod->list);
 	module_bug_cleanup(mod);
-
+	wake_up_all(&module_wq);
  ddebug:
 	dynamic_debug_remove(info.debug);
  unlock:
@@ -3059,7 +3059,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
 		blocking_notifier_call_chain(&module_notify_list,
 					     MODULE_STATE_GOING, mod);
 		free_module(mod);
-		wake_up(&module_wq);
+		wake_up_all(&module_wq);
 		return ret;
 	}
 	if (ret > 0) {
@@ -3071,9 +3071,8 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
 		dump_stack();
 	}
 
-	/* Now it's a first class citizen!  Wake up anyone waiting for it. */
+	/* Now it's a first class citizen! */
 	mod->state = MODULE_STATE_LIVE;
-	wake_up(&module_wq);
 	blocking_notifier_call_chain(&module_notify_list,
 				     MODULE_STATE_LIVE, mod);
 
@@ -3096,6 +3095,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
 	mod->init_ro_size = 0;
 	mod->init_text_size = 0;
 	mutex_unlock(&module_mutex);
+	wake_up_all(&module_wq);
 
 	return 0;
 }
-- 
1.7.9.5


  parent reply	other threads:[~2013-02-05 22:13 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 22:05 [ 3.5.y.z extended stable ] Linux 3.5.7.5 stable review Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 01/93] virtio-blk: Don't free ida when disk is in use Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 02/93] ioat: Fix DMA memory sync direction correct flag Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 03/93] PCI: pciehp: Use per-slot workqueues to avoid deadlock Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 04/93] PCI/AER: pci_get_domain_bus_and_slot() call missing required pci_dev_put() Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 05/93] PCI: Allow pcie_aspm=force even when FADT indicates it is unsupported Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 06/93] xen/grant-table: correctly initialize grant table version 1 Herton Ronaldo Krzesinski
2013-02-05 22:05 ` Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 07/93] serial:ifx6x60:Delete SPI timer when shut down port Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 08/93] tty: 8250_dw: Fix inverted arguments to serial_out in IRQ handler Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 09/93] drm/i915: Invalidate the relocation presumed_offsets along the slow path Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 10/93] ARM: 7627/1: Predicate preempt logic on PREEMP_COUNT not PREEMPT alone Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 11/93] xen: Fix stack corruption in xen_failsafe_callback for 32bit PVOPS guests Herton Ronaldo Krzesinski
2013-02-06 10:18   ` Frediano Ziglio
2013-02-06 10:18     ` Frediano Ziglio
2013-02-06 13:16     ` Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 12/93] staging: vt6656: Fix inconsistent structure packing Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 13/93] 8250/16?50: Add support for Broadcom TruManage redirected serial port Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 14/93] KVM: PPC: Emulate dcbf Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 15/93] staging: wlan-ng: Fix clamping of returned SSID length Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 16/93] USB: option: blacklist network interface on ONDA MT8205 4G LTE Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 17/93] USB: option: add TP-LINK HSUPA Modem MA180 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 18/93] ALSA: hda - Fix mute led for another HP machine Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 19/93] usb: dwc3: gadget: fix ep->maxburst for ep0 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 20/93] ACPI / cpuidle: Fix NULL pointer issues when cpuidle is disabled Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 21/93] ACPI / processor: Get power info before updating the C-states Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 22/93] ARM: DMA: Fix struct page iterator in dma_cache_maint() to work with sparsemem Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 23/93] evm: checking if removexattr is not a NULL Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 24/93] ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 25/93] ftrace: Be first to run code modification on modules Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 26/93] i2c: mxs: Fix type of error code Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 27/93] USB: UHCI: fix IRQ race during initialization Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 28/93] async: fix __lowest_in_progress() Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 29/93] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 30/93] ARM: at91: rm9200: remake the BGA as default version Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 31/93] Bluetooth: Fix sending HCI commands after reset Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 32/93] Bluetooth: Fix incorrect strncpy() in hidp_setup_hid() Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 33/93] ath9k_htc: Fix memory leak Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 34/93] ath9k: do not link receive buffers during flush Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 35/93] ath9k: add a better fix for the rx tasklet vs rx flush race Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 36/93] ath9k: fix rx flush handling Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 37/93] brcmsmac: increase timer reference count for new timers only Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 38/93] ath9k: remove sc->rx.rxbuflock to fix a deadlock Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 39/93] ath9k: disable the tasklet before taking the PCU lock Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 40/93] ASoC: wm2200: correct mixer values and text Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 41/93] mac80211: fix FT roaming Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 42/93] mac80211: synchronize scan off/on-channel and PS states Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 43/93] efi, x86: Pass a proper identity mapping in efi_call_phys_prelog Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 44/93] iwlegacy: fix IBSS cleanup Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 45/93] ath9k_hw: fix calibration issues on chainmask that don't include chain 0 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 46/93] ath9k_hw: fix chain swap setting when setting rx chainmask to 5 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 47/93] mwifiex: fix typo in PCIe adapter NULL check Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 48/93] drm/i915: Disable AsyncFlip performance optimisations Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 49/93] drm/i915: GFX_MODE Flush TLB Invalidate Mode must be '1' for scanline waits Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 50/93] iommu/intel: disable DMAR for g4x integrated gfx Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 51/93] drm/i915: dump UTS_RELEASE into the error_state Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 52/93] ALSA: hda - Add a fixup for Packard-Bell desktop with ALC880 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 53/93] drm/radeon: fix cursor corruption on DCE6 and newer Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 54/93] radeon_display: Use pointer return error codes Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 55/93] drm/radeon: fix error path in kpage allocation Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 56/93] drm/radeon: fix a rare case of double kfree Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 57/93] x86/msr: Add capabilities check Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 58/93] x86, efi: Set runtime_version to the EFI spec revision Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 59/93] can: c_can: fix invalid error codes Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 60/93] can: ti_hecc: " Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 61/93] can: pch_can: " Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 62/93] ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 63/93] smp: Fix SMP function call empty cpu mask race Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 64/93] IOMMU, AMD Family15h Model10-1Fh erratum 746 Workaround Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 65/93] xfs: Fix possible use-after-free with AIO Herton Ronaldo Krzesinski
2013-02-05 22:06   ` Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 66/93] powerpc/book3e: Disable interrupt after preempt_schedule_irq Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 67/93] ALSA: hda - Fix non-snoop page handling Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 68/93] EDAC: Test correct variable in ->store function Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 69/93] efi: Make 'efi_enabled' a function to query EFI facilities Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 70/93] samsung-laptop: Disable on EFI hardware Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 71/93] NFS: Fix error reporting in nfs_xdev_mount Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 72/93] NFS: Don't silently fail setattr() requests on mountpoints Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 73/93] NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 74/93] drivers/firmware/dmi_scan.c: check dmi version when get system uuid Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 75/93] drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 76/93] [libata] ahci: Add support for Enmotus Bobcat device Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 77/93] [libata] ahci: Fix lack of command retry after a success error handler Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 78/93] x86/Sandy Bridge: mark arrays in __init functions as __initconst Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 79/93] x86/Sandy Bridge: Sandy Bridge workaround depends on CONFIG_PCI Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 80/93] ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up() Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 81/93] ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 82/93] wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 83/93] drm/i915: Implement WaDisableHiZPlanesWhenMSAAEnabled Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 84/93] ahci: Add identifiers for ASM106x devices Herton Ronaldo Krzesinski
2013-02-05 22:07 ` Herton Ronaldo Krzesinski [this message]
2013-02-05 22:07 ` [PATCH 86/93] module: wait when loading a module which is currently initializing Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 87/93] module: add new state MODULE_STATE_UNFORMED Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 88/93] module: put modules in list much earlier Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 89/93] module: fix missing module_mutex unlock Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 90/93] intel_idle: Don't register CPU notifier if we are not running Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 91/93] xfs: fix periodic log flushing Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 92/93] gspca_kinect: add Kinect for Windows USB id Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 93/93] ARM: 7628/1: head.S: map one extra section for the ATAG/DTB area Herton Ronaldo Krzesinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360102042-10732-86-git-send-email-herton.krzesinski@canonical.com \
    --to=herton.krzesinski@canonical.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.