From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 4.4 24/67] ALSA: hrtimer: Fix stall by hrtimer_cancel()
Date: Wed, 27 Jan 2016 10:12:18 -0800 [thread overview]
Message-ID: <20160127180910.783554969@linuxfoundation.org> (raw)
In-Reply-To: <20160127180907.419868641@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
commit 2ba1fe7a06d3624f9a7586d672b55f08f7c670f3 upstream.
hrtimer_cancel() waits for the completion from the callback, thus it
must not be called inside the callback itself. This was already a
problem in the past with ALSA hrtimer driver, and the early commit
[fcfdebe70759: ALSA: hrtimer - Fix lock-up] tried to address it.
However, the previous fix is still insufficient: it may still cause a
lockup when the ALSA timer instance reprograms itself in its callback.
Then it invokes the start function even in snd_timer_interrupt() that
is called in hrtimer callback itself, results in a CPU stall. This is
no hypothetical problem but actually triggered by syzkaller fuzzer.
This patch tries to fix the issue again. Now we call
hrtimer_try_to_cancel() at both start and stop functions so that it
won't fall into a deadlock, yet giving some chance to cancel the queue
if the functions have been called outside the callback. The proper
hrtimer_cancel() is called in anyway at closing, so this should be
enough.
Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/core/hrtimer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -90,7 +90,7 @@ static int snd_hrtimer_start(struct snd_
struct snd_hrtimer *stime = t->private_data;
atomic_set(&stime->running, 0);
- hrtimer_cancel(&stime->hrt);
+ hrtimer_try_to_cancel(&stime->hrt);
hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
HRTIMER_MODE_REL);
atomic_set(&stime->running, 1);
@@ -101,6 +101,7 @@ static int snd_hrtimer_stop(struct snd_t
{
struct snd_hrtimer *stime = t->private_data;
atomic_set(&stime->running, 0);
+ hrtimer_try_to_cancel(&stime->hrt);
return 0;
}
next prev parent reply other threads:[~2016-01-27 22:10 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 18:11 [PATCH 4.4 00/67] 4.4.1-stable review Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 01/67] KEYS: Fix keyring ref leak in join_session_keyring() Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 02/67] x86/xen: dont reset vcpu_info on a cancelled suspend Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 03/67] KVM: x86: expose MSR_TSC_AUX to userspace Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 04/67] KVM: x86: correctly print #AC in traces Greg Kroah-Hartman
2016-01-27 18:11 ` [PATCH 4.4 05/67] kvm: x86: Fix vmwrite to SECONDARY_VM_EXEC_CONTROL Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 06/67] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 07/67] x86/boot: Double BOOT_HEAP_SIZE to 64KB Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 08/67] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 09/67] x86/mm: Improve switch_mm() barrier comments Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 10/67] ALSA: usb: Add native DSD support for Oppo HA-1 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 11/67] ALSA: hda - Fixup inverted internal mic for Lenovo E50-80 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 12/67] ALSA: seq: Fix missing NULL check at remove_events ioctl Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 13/67] ALSA: usb-audio: Avoid calling usb_autopm_put_interface() at disconnect Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 14/67] ALSA: seq: Fix race at timer setup and close Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 15/67] ALSA: hda - Fix white noise on Dell Latitude E5550 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 16/67] ALSA: usb-audio: Fix mixer ctl regression of Native Instrument devices Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 17/67] ALSA: timer: Harden slave timer list handling Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 18/67] ALSA: hda - fix the headset mic detection problem for a Dell laptop Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 19/67] ALSA: timer: Fix race among timer ioctls Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 20/67] ALSA: timer: Fix double unlink of active_list Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 21/67] ALSA: hda - Add fixup for Dell Latitidue E6540 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 22/67] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 23/67] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Greg Kroah-Hartman
2016-01-27 18:12 ` Greg Kroah-Hartman [this message]
2016-01-27 18:12 ` [PATCH 4.4 25/67] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 26/67] ALSA: hda - Fix bass pin fixup for ASUS N550JX Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 27/67] ALSA: hda - Fix missing module loading with model=generic option Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 28/67] ALSA: hda - Flush the pending probe work at remove Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 29/67] ALSA: timer: Handle disconnection more safely Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 30/67] ASoC: wm5110: Fix PGA clear when disabling DRE Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 31/67] ASoC: compress: Fix compress device direction check Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 32/67] rtlwifi: fix memory leak for USB device Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 33/67] USB: cp210x: add ID for ELV Marble Sound Board 1 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 34/67] usb: core: lpm: fix usb3_hardware_lpm sysfs node Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 35/67] xhci: refuse loading if nousb is used Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 36/67] unix: properly account for FDs passed over unix sockets Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 37/67] vxlan: fix test which detect duplicate vxlan iface Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 38/67] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 39/67] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 40/67] tcp_yeah: dont set ssthresh below 2 Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 41/67] sched,cls_flower: set key address type when present Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 42/67] net: pktgen: fix null ptr deref in skb allocation Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 43/67] udp: disallow UFO for sockets with SO_NO_CHECK option Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 44/67] net: preserve IP control block during GSO segmentation Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 45/67] bonding: Prevent IPv6 link local address on enslaved devices Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 46/67] dwc_eth_qos: Fix dma address for multi-fragment skbs Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 47/67] phonet: properly unshare skbs in phonet_rcv() Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 48/67] net: bpf: reject invalid shifts Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 49/67] ipv6: update skb->csum when CE mark is propagated Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 50/67] bridge: fix lockdep addr_list_lock false positive splat Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 51/67] net/mlx5_core: Fix trimming down IRQ number Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 52/67] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 53/67] batman-adv: Avoid recursive call_rcu for batadv_bla_claim Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 54/67] batman-adv: Avoid recursive call_rcu for batadv_nc_node Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 55/67] batman-adv: Drop immediate batadv_orig_ifinfo free function Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 56/67] batman-adv: Drop immediate batadv_neigh_node " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 57/67] batman-adv: Drop immediate neigh_ifinfo " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 58/67] batman-adv: Drop immediate batadv_hard_iface " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 59/67] batman-adv: Drop immediate orig_node " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 60/67] powerpc/tm: Check for already reclaimed tasks Greg Kroah-Hartman
2016-05-03 6:32 ` Jiri Slaby
2016-05-03 11:04 ` Michael Neuling
2016-05-03 18:19 ` Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 61/67] powerpc: Make value-returning atomics fully ordered Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 62/67] powerpc: Make {cmp}xchg* and their atomic_ versions " Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 63/67] scripts/recordmcount.pl: support data in text section on powerpc Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 64/67] powerpc/module: Handle R_PPC64_ENTRY relocations Greg Kroah-Hartman
2016-01-27 18:12 ` [PATCH 4.4 65/67] arm64: Clear out any singlestep state on a ptrace detach operation Greg Kroah-Hartman
2016-01-27 18:13 ` [PATCH 4.4 66/67] arm64: mm: ensure that the zero page is visible to the page table walker Greg Kroah-Hartman
2016-01-27 18:13 ` [PATCH 4.4 67/67] arm64: kernel: enforce pmuserenr_el0 initialization and restore Greg Kroah-Hartman
2016-01-27 23:28 ` [PATCH 4.4 00/67] 4.4.1-stable review Shuah Khan
2016-01-28 2:23 ` Guenter Roeck
2016-01-28 3:21 ` Guenter Roeck
2016-01-31 19:17 ` Greg Kroah-Hartman
2016-02-01 2:41 ` Guenter Roeck
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=20160127180910.783554969@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).