From: Greg Kroah-Hartman Date: Sat, 8 Mar 2014 00:57:30 +0000 (-0800) Subject: 3.4-stable patches X-Git-Tag: v3.4.83~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf0103710db38ba359beb3437d8ead2fc5ef14af;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: alsa-6fire-fix-unlocked-snd_pcm_stop-call.patch alsa-asihpi-fix-unlocked-snd_pcm_stop-call.patch alsa-atiixp-fix-unlocked-snd_pcm_stop-call.patch alsa-pxa2xx-fix-unlocked-snd_pcm_stop-call.patch alsa-ua101-fix-unlocked-snd_pcm_stop-call.patch alsa-usx2y-fix-unlocked-snd_pcm_stop-call.patch asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch asoc-s6000-fix-unlocked-snd_pcm_stop-call.patch asoc-sglt5000-fix-the-default-value-of-chip_sss_ctrl.patch staging-line6-fix-unlocked-snd_pcm_stop-call.patch sunrpc-clarify-comments-on-rpc_make_runnable.patch sunrpc-prevent-an-rpc_task-wakeup-race.patch --- diff --git a/queue-3.4/alsa-6fire-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-6fire-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..f005b7ceb36 --- /dev/null +++ b/queue-3.4/alsa-6fire-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,50 @@ +From 28518ed66242869c1b04ab40d4e84ce5fedb0c56 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:57:55 +0200 +Subject: ALSA: 6fire: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 5b9ab3f7324a1b94a5a5a76d44cf92dfeb3b5e80 upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/6fire/pcm.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/sound/usb/6fire/pcm.c ++++ b/sound/usb/6fire/pcm.c +@@ -639,17 +639,25 @@ int __devinit usb6fire_pcm_init(struct s + void usb6fire_pcm_abort(struct sfire_chip *chip) + { + struct pcm_runtime *rt = chip->pcm; ++ unsigned long flags; + int i; + + if (rt) { + rt->panic = true; + +- if (rt->playback.instance) ++ if (rt->playback.instance) { ++ snd_pcm_stream_lock_irqsave(rt->playback.instance, flags); + snd_pcm_stop(rt->playback.instance, + SNDRV_PCM_STATE_XRUN); +- if (rt->capture.instance) ++ snd_pcm_stream_unlock_irqrestore(rt->playback.instance, flags); ++ } ++ ++ if (rt->capture.instance) { ++ snd_pcm_stream_lock_irqsave(rt->capture.instance, flags); + snd_pcm_stop(rt->capture.instance, + SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock_irqrestore(rt->capture.instance, flags); ++ } + + for (i = 0; i < PCM_N_URBS; i++) { + usb_poison_urb(&rt->in_urbs[i].instance); diff --git a/queue-3.4/alsa-asihpi-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-asihpi-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..b71dc4d21e7 --- /dev/null +++ b/queue-3.4/alsa-asihpi-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,32 @@ +From 60478295d6876619f8f47f6d1a5c25eaade69ee3 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:55:57 +0200 +Subject: ALSA: asihpi: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 60478295d6876619f8f47f6d1a5c25eaade69ee3 upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Signed-off-by: Takashi Iwai +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/asihpi/asihpi.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/sound/pci/asihpi/asihpi.c ++++ b/sound/pci/asihpi/asihpi.c +@@ -769,7 +769,10 @@ static void snd_card_asihpi_timer_functi + s->number); + ds->drained_count++; + if (ds->drained_count > 20) { ++ unsigned long flags; ++ snd_pcm_stream_lock_irqsave(s, flags); + snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock_irqrestore(s, flags); + continue; + } + } else { diff --git a/queue-3.4/alsa-atiixp-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-atiixp-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..09c653701b5 --- /dev/null +++ b/queue-3.4/alsa-atiixp-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,45 @@ +From 53fcffc423f4f56269533c2b82f96295019a6f58 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:56:56 +0200 +Subject: ALSA: atiixp: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit cc7282b8d5abbd48c81d1465925d464d9e3eaa8f upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/atiixp.c | 2 ++ + sound/pci/atiixp_modem.c | 2 ++ + 2 files changed, 4 insertions(+) + +--- a/sound/pci/atiixp.c ++++ b/sound/pci/atiixp.c +@@ -688,7 +688,9 @@ static void snd_atiixp_xrun_dma(struct a + if (! dma->substream || ! dma->running) + return; + snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type); ++ snd_pcm_stream_lock(dma->substream); + snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock(dma->substream); + } + + /* +--- a/sound/pci/atiixp_modem.c ++++ b/sound/pci/atiixp_modem.c +@@ -638,7 +638,9 @@ static void snd_atiixp_xrun_dma(struct a + if (! dma->substream || ! dma->running) + return; + snd_printdd("atiixp-modem: XRUN detected (DMA %d)\n", dma->ops->type); ++ snd_pcm_stream_lock(dma->substream); + snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock(dma->substream); + } + + /* diff --git a/queue-3.4/alsa-pxa2xx-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-pxa2xx-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..dc591f5a777 --- /dev/null +++ b/queue-3.4/alsa-pxa2xx-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,33 @@ +From 272f254b2719720e8a2de1d2baec234a35ea8a8f Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:59:33 +0200 +Subject: ALSA: pxa2xx: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 46f6c1aaf790be9ea3c8ddfc8f235a5f677d08e2 upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Acked-by: Mark Brown +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/arm/pxa2xx-pcm-lib.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/arm/pxa2xx-pcm-lib.c ++++ b/sound/arm/pxa2xx-pcm-lib.c +@@ -166,7 +166,9 @@ void pxa2xx_pcm_dma_irq(int dma_ch, void + } else { + printk(KERN_ERR "%s: DMA error on channel %d (DCSR=%#x)\n", + rtd->params->name, dma_ch, dcsr); ++ snd_pcm_stream_lock(substream); + snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock(substream); + } + } + EXPORT_SYMBOL(pxa2xx_pcm_dma_irq); diff --git a/queue-3.4/alsa-ua101-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-ua101-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..a6014a15863 --- /dev/null +++ b/queue-3.4/alsa-ua101-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,50 @@ +From a4d0e7c132a92025f7c3dd7cf96bc763799ef2de Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:58:25 +0200 +Subject: ALSA: ua101: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 9538aa46c2427d6782aa10036c4da4c541605e0e upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Acked-by: Clemens Ladisch +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/misc/ua101.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/sound/usb/misc/ua101.c ++++ b/sound/usb/misc/ua101.c +@@ -613,14 +613,24 @@ static int start_usb_playback(struct ua1 + + static void abort_alsa_capture(struct ua101 *ua) + { +- if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states)) ++ unsigned long flags; ++ ++ if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states)) { ++ snd_pcm_stream_lock_irqsave(ua->capture.substream, flags); + snd_pcm_stop(ua->capture.substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock_irqrestore(ua->capture.substream, flags); ++ } + } + + static void abort_alsa_playback(struct ua101 *ua) + { +- if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) ++ unsigned long flags; ++ ++ if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) { ++ snd_pcm_stream_lock_irqsave(ua->playback.substream, flags); + snd_pcm_stop(ua->playback.substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock_irqrestore(ua->playback.substream, flags); ++ } + } + + static int set_stream_hw(struct ua101 *ua, struct snd_pcm_substream *substream, diff --git a/queue-3.4/alsa-usx2y-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/alsa-usx2y-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..b9417db7fbc --- /dev/null +++ b/queue-3.4/alsa-usx2y-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,34 @@ +From e93a7f00a3db345c0e2c5ab1570b4d6fec77173b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 17:58:47 +0200 +Subject: ALSA: usx2y: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 5be1efb4c2ed79c3d7c0cbcbecae768377666e84 upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/usx2y/usbusx2yaudio.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/sound/usb/usx2y/usbusx2yaudio.c ++++ b/sound/usb/usx2y/usbusx2yaudio.c +@@ -273,7 +273,11 @@ static void usX2Y_clients_stop(struct us + struct snd_usX2Y_substream *subs = usX2Y->subs[s]; + if (subs) { + if (atomic_read(&subs->state) >= state_PRERUNNING) { ++ unsigned long flags; ++ ++ snd_pcm_stream_lock_irqsave(subs->pcm_substream, flags); + snd_pcm_stop(subs->pcm_substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock_irqrestore(subs->pcm_substream, flags); + } + for (u = 0; u < NRURBS; u++) { + struct urb *urb = subs->urb[u]; diff --git a/queue-3.4/asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch b/queue-3.4/asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch new file mode 100644 index 00000000000..e2c995872b1 --- /dev/null +++ b/queue-3.4/asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch @@ -0,0 +1,42 @@ +From 0f260fd5c5b7f44f522b96dfb77b67c8bda5bfbc Mon Sep 17 00:00:00 2001 +From: Sascha Hauer +Date: Sun, 10 Mar 2013 19:33:03 +0100 +Subject: ASoC: imx-ssi: Fix occasional AC97 reset failure + +From: Sascha Hauer + +commit b6e51600f4e983e757b1b6942becaa1ae7d82e67 upstream. + +Signed-off-by: Sascha Hauer +Signed-off-by: Markus Pargmann +Signed-off-by: Mark Brown +[bwh: Backported to 3.2: adjust filename] +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/imx/imx-ssi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/sound/soc/imx/imx-ssi.c ++++ b/sound/soc/imx/imx-ssi.c +@@ -497,6 +497,8 @@ static void imx_ssi_ac97_reset(struct sn + + if (imx_ssi->ac97_reset) + imx_ssi->ac97_reset(ac97); ++ /* First read sometimes fails, do a dummy read */ ++ imx_ssi_ac97_read(ac97, 0); + } + + static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) +@@ -505,6 +507,9 @@ static void imx_ssi_ac97_warm_reset(stru + + if (imx_ssi->ac97_warm_reset) + imx_ssi->ac97_warm_reset(ac97); ++ ++ /* First read sometimes fails, do a dummy read */ ++ imx_ssi_ac97_read(ac97, 0); + } + + struct snd_ac97_bus_ops soc_ac97_ops = { diff --git a/queue-3.4/asoc-s6000-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/asoc-s6000-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..93d3f1482ec --- /dev/null +++ b/queue-3.4/asoc-s6000-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,33 @@ +From 8ac7e3f3ac405c3cc4feee6a09b9b2899ec61aea Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 18:00:25 +0200 +Subject: ASoC: s6000: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 61be2b9a18ec70f3cbe3deef7a5f77869c71b5ae upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Acked-by: Mark Brown +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/s6000/s6000-pcm.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/soc/s6000/s6000-pcm.c ++++ b/sound/soc/s6000/s6000-pcm.c +@@ -128,7 +128,9 @@ static irqreturn_t s6000_pcm_irq(int irq + substream->runtime && + snd_pcm_running(substream)) { + dev_dbg(pcm->dev, "xrun\n"); ++ snd_pcm_stream_lock(substream); + snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); ++ snd_pcm_stream_unlock(substream); + ret = IRQ_HANDLED; + } + diff --git a/queue-3.4/asoc-sglt5000-fix-the-default-value-of-chip_sss_ctrl.patch b/queue-3.4/asoc-sglt5000-fix-the-default-value-of-chip_sss_ctrl.patch new file mode 100644 index 00000000000..b60ea87d971 --- /dev/null +++ b/queue-3.4/asoc-sglt5000-fix-the-default-value-of-chip_sss_ctrl.patch @@ -0,0 +1,35 @@ +From 95d909e86710aa3f055812b7134c4a568c38fc4c Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Thu, 4 Jul 2013 20:01:02 -0300 +Subject: ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRL + +From: Fabio Estevam + +commit 016fcab8ff46fca29375d484226ec91932aa4a07 upstream. + +According to the sgtl5000 reference manual, the default value of CHIP_SSS_CTRL +is 0x10. + +Reported-by: Oskar Schirmer +Signed-off-by: Fabio Estevam +Signed-off-by: Mark Brown +[bwh: Backported to 3.2: format of register defaults array is different] +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/sgtl5000.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/sgtl5000.c ++++ b/sound/soc/codecs/sgtl5000.c +@@ -37,7 +37,7 @@ + static const u16 sgtl5000_regs[SGTL5000_MAX_REG_OFFSET] = { + [SGTL5000_CHIP_CLK_CTRL] = 0x0008, + [SGTL5000_CHIP_I2S_CTRL] = 0x0010, +- [SGTL5000_CHIP_SSS_CTRL] = 0x0008, ++ [SGTL5000_CHIP_SSS_CTRL] = 0x0010, + [SGTL5000_CHIP_DAC_VOL] = 0x3c3c, + [SGTL5000_CHIP_PAD_STRENGTH] = 0x015f, + [SGTL5000_CHIP_ANA_HP_CTRL] = 0x1818, diff --git a/queue-3.4/series b/queue-3.4/series index be8abb533e5..aa59ed2f920 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -74,3 +74,15 @@ xen-netback-don-t-disconnect-frontend-when-seeing-oversize-packet.patch xen-io-ring.h-new-macro-to-detect-whether-there-are-too-many-requests-on-the-ring.patch xen-blkback-check-for-insane-amounts-of-request-on-the-ring-v6.patch xen-events-mask-events-when-changing-their-vcpu-binding.patch +sunrpc-clarify-comments-on-rpc_make_runnable.patch +sunrpc-prevent-an-rpc_task-wakeup-race.patch +asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch +asoc-sglt5000-fix-the-default-value-of-chip_sss_ctrl.patch +alsa-atiixp-fix-unlocked-snd_pcm_stop-call.patch +alsa-6fire-fix-unlocked-snd_pcm_stop-call.patch +alsa-ua101-fix-unlocked-snd_pcm_stop-call.patch +alsa-usx2y-fix-unlocked-snd_pcm_stop-call.patch +alsa-pxa2xx-fix-unlocked-snd_pcm_stop-call.patch +asoc-s6000-fix-unlocked-snd_pcm_stop-call.patch +staging-line6-fix-unlocked-snd_pcm_stop-call.patch +alsa-asihpi-fix-unlocked-snd_pcm_stop-call.patch diff --git a/queue-3.4/staging-line6-fix-unlocked-snd_pcm_stop-call.patch b/queue-3.4/staging-line6-fix-unlocked-snd_pcm_stop-call.patch new file mode 100644 index 00000000000..1ddb2b4833b --- /dev/null +++ b/queue-3.4/staging-line6-fix-unlocked-snd_pcm_stop-call.patch @@ -0,0 +1,35 @@ +From 4bcfe68e7e4db75b1ec8d3668f04c435ff98b809 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 11 Jul 2013 18:02:38 +0200 +Subject: staging: line6: Fix unlocked snd_pcm_stop() call + +From: Takashi Iwai + +commit 86f0b5b86d142b9323432fef078a6cf0fb5dda74 upstream. + +snd_pcm_stop() must be called in the PCM substream lock context. + +Signed-off-by: Takashi Iwai +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/line6/pcm.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/staging/line6/pcm.c ++++ b/drivers/staging/line6/pcm.c +@@ -378,8 +378,11 @@ static int snd_line6_pcm_free(struct snd + */ + static void pcm_disconnect_substream(struct snd_pcm_substream *substream) + { +- if (substream->runtime && snd_pcm_running(substream)) ++ if (substream->runtime && snd_pcm_running(substream)) { ++ snd_pcm_stream_lock_irq(substream); + snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); ++ snd_pcm_stream_unlock_irq(substream); ++ } + } + + /* diff --git a/queue-3.4/sunrpc-clarify-comments-on-rpc_make_runnable.patch b/queue-3.4/sunrpc-clarify-comments-on-rpc_make_runnable.patch new file mode 100644 index 00000000000..51058334ca2 --- /dev/null +++ b/queue-3.4/sunrpc-clarify-comments-on-rpc_make_runnable.patch @@ -0,0 +1,38 @@ +From a27e05b0cf32d711c1ec57625b6053658efd11fc Mon Sep 17 00:00:00 2001 +From: Jeff Layton +Date: Mon, 23 Jul 2012 15:51:55 -0400 +Subject: sunrpc: clarify comments on rpc_make_runnable + +From: Jeff Layton + +commit 506026c3ec270e18402f0c9d33fee37482c23861 upstream. + +rpc_make_runnable is not generally called with the queue lock held, unless +it's waking up a task that has been sitting on a waitqueue. This is safe +when the task has not entered the FSM yet, but the comments don't really +spell this out. + +Signed-off-by: Jeff Layton +Signed-off-by: Trond Myklebust +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + net/sunrpc/sched.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/net/sunrpc/sched.c ++++ b/net/sunrpc/sched.c +@@ -302,8 +302,9 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet + /* + * Make an RPC task runnable. + * +- * Note: If the task is ASYNC, this must be called with +- * the spinlock held to protect the wait queue operation. ++ * Note: If the task is ASYNC, and is being made runnable after sitting on an ++ * rpc_wait_queue, this must be called with the queue spinlock held to protect ++ * the wait queue operation. + */ + static void rpc_make_runnable(struct rpc_task *task) + { diff --git a/queue-3.4/sunrpc-prevent-an-rpc_task-wakeup-race.patch b/queue-3.4/sunrpc-prevent-an-rpc_task-wakeup-race.patch new file mode 100644 index 00000000000..6dd08151f3f --- /dev/null +++ b/queue-3.4/sunrpc-prevent-an-rpc_task-wakeup-race.patch @@ -0,0 +1,45 @@ +From f7b72b71fe00b5159d71f0d385c8d5e5865bcd32 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 22 May 2013 12:57:24 -0400 +Subject: SUNRPC: Prevent an rpc_task wakeup race + +From: Trond Myklebust + +commit a3c3cac5d31879cd9ae2de7874dc6544ca704aec upstream. + +The lockless RPC_IS_QUEUED() test in __rpc_execute means that we need to +be careful about ordering the calls to rpc_test_and_set_running(task) and +rpc_clear_queued(task). If we get the order wrong, then we may end up +testing the RPC_TASK_RUNNING flag after __rpc_execute() has looped +and changed the state of the rpc_task. + +Signed-off-by: Trond Myklebust +Signed-off-by: Ben Hutchings +Cc: Weng Meiling +Signed-off-by: Greg Kroah-Hartman + +--- + net/sunrpc/sched.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/net/sunrpc/sched.c ++++ b/net/sunrpc/sched.c +@@ -305,11 +305,17 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet + * Note: If the task is ASYNC, and is being made runnable after sitting on an + * rpc_wait_queue, this must be called with the queue spinlock held to protect + * the wait queue operation. ++ * Note the ordering of rpc_test_and_set_running() and rpc_clear_queued(), ++ * which is needed to ensure that __rpc_execute() doesn't loop (due to the ++ * lockless RPC_IS_QUEUED() test) before we've had a chance to test ++ * the RPC_TASK_RUNNING flag. + */ + static void rpc_make_runnable(struct rpc_task *task) + { ++ bool need_wakeup = !rpc_test_and_set_running(task); ++ + rpc_clear_queued(task); +- if (rpc_test_and_set_running(task)) ++ if (!need_wakeup) + return; + if (RPC_IS_ASYNC(task)) { + INIT_WORK(&task->u.tk_work, rpc_async_schedule);