openwrt/staging/blogic.git
6 years agoALSA: usb-audio: Refactor clock finder helpers
Takashi Iwai [Tue, 3 Apr 2018 15:34:57 +0000 (17:34 +0200)]
ALSA: usb-audio: Refactor clock finder helpers

There are lots of open-coded functions to find a clock source,
selector and multiplier.  Now there are both v2 and v3, so six
variants.

This patch refactors the code to use a common helper for the main
loop, and define each validator function for each target.
There is no functional change.

Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Fix UAF at PCM release via PCM timer access
Takashi Iwai [Mon, 2 Apr 2018 20:41:43 +0000 (22:41 +0200)]
ALSA: pcm: Fix UAF at PCM release via PCM timer access

The PCM runtime object is created and freed dynamically at PCM stream
open / close time.  This is tracked via substream->runtime, and it's
cleared at snd_pcm_detach_substream().

The runtime object assignment is protected by PCM open_mutex, so for
all PCM operations, it's safely handled.  However, each PCM substream
provides also an ALSA timer interface, and user-space can access to
this while closing a PCM substream.  This may eventually lead to a
UAF, as snd_pcm_timer_resolution() tries to access the runtime while
clearing it in other side.

Fortunately, it's the only concurrent access from the PCM timer, and
it merely reads runtime->timer_resolution field.  So, we can avoid the
race by reordering kfree() and wrapping the substream->runtime
clearance with the corresponding timer lock.

Reported-by: syzbot+8e62ff4e07aa2ce87826@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge tag 'asoc-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Mon, 2 Apr 2018 17:51:39 +0000 (19:51 +0200)]
Merge tag 'asoc-v4.17' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.17

This is a *very* big release for ASoC.  Not much change in the core but
there s the transition of all the individual drivers over to components
which is intended to support further core work.  The goal is to make it
easier to do further core work by removing the need to special case all
the different driver classes in the core, many of the devices end up
being used in multiple roles in modern systems.

We also have quite a lot of new drivers added this month of all kinds,
quite a few for simple devices but also some more advanced ones with
more substantial code.

 - The biggest thing is the huge series from Morimoto-san which
   converted everything over to components.  This is a huge change by
   code volume but was fairly mechanical
 - Many fixes for some of the Realtek based Baytrail systems covering
   both the CODECs and the CPUs, contributed by Hans de Goode.
 - Lots of cleanups for Samsung based Odroid systems from Sylwester
   Nawrocki.
 - The Freescale SSI driver also got a lot of cleanups from Nicolin
   Chen.
 - The Blackfin drivers have been removed as part of the removal of the
   architecture.
 - New drivers for AKM AK4458 and AK5558, several AMD based machines,
   several Intel based machines, Maxim MAX9759, Motorola CPCAP,
   Socionext Uniphier SoCs, and TI PCM1789 and TDA7419

6 years agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 2 Apr 2018 17:50:41 +0000 (19:50 +0200)]
Merge branch 'for-next' into for-linus

Preparation for 4.17 merge.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: silence a static checker warning
Dan Carpenter [Thu, 29 Mar 2018 09:03:19 +0000 (12:03 +0300)]
ALSA: usb-audio: silence a static checker warning

We recently made "format" a u64 variable so now static checkers complain
that this shift will wrap around if format is more than 31.  I don't
think it makes a difference for runtime, but it's simple to silence the
warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge remote-tracking branch 'asoc/topic/zx_aud96p22' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:32:03 +0000 (10:32 +0800)]
Merge remote-tracking branch 'asoc/topic/zx_aud96p22' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm9090', 'asoc/topic/wm9712', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:58 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm9090', 'asoc/topic/wm9712', 'asoc/topic/wm9713' and 'asoc/topic/wm_adsp' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:54 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic/wm8995', 'asoc/topic/wm8996' and 'asoc/topic/wm9081' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8978', 'asoc/topic/wm8983', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:49 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8978', 'asoc/topic/wm8983', 'asoc/topic/wm8985', 'asoc/topic/wm8988' and 'asoc/topic/wm8990' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8960', 'asoc/topic/wm8961', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:44 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8960', 'asoc/topic/wm8961', 'asoc/topic/wm8962', 'asoc/topic/wm8971' and 'asoc/topic/wm8974' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8900', 'asoc/topic/wm8903', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:39 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8900', 'asoc/topic/wm8903', 'asoc/topic/wm8904', 'asoc/topic/wm8940' and 'asoc/topic/wm8955' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8753', 'asoc/topic/wm8770', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:34 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8753', 'asoc/topic/wm8770', 'asoc/topic/wm8776', 'asoc/topic/wm8782' and 'asoc/topic/wm8804' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:30 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8737', 'asoc/topic/wm8741' and 'asoc/topic/wm8750' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm8523', 'asoc/topic/wm8524', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:25 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm8523', 'asoc/topic/wm8524', 'asoc/topic/wm8580', 'asoc/topic/wm8711' and 'asoc/topic/wm8727' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/wm2200', 'asoc/topic/wm5100', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:31:20 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/wm2200', 'asoc/topic/wm5100', 'asoc/topic/wm8350', 'asoc/topic/wm8400' and 'asoc/topic/wm8510' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/vc4_hdmi', 'asoc/topic/wl1273', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:31:15 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/vc4_hdmi', 'asoc/topic/wl1273', 'asoc/topic/wm0010', 'asoc/topic/wm1250-ev1' and 'asoc/topic/wm2000' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/twl4030', 'asoc/topic/twl6040', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:31:10 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/twl4030', 'asoc/topic/twl6040', 'asoc/topic/uda134x', 'asoc/topic/uda1380' and 'asoc/topic/uniphier' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x...
Mark Brown [Wed, 28 Mar 2018 02:31:04 +0000 (10:31 +0800)]
Merge remote-tracking branches 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x', 'asoc/topic/tlv320dac33', 'asoc/topic/topology' and 'asoc/topic/tscs42xx' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/tda7419', 'asoc/topic/tfa9879', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:59 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/tda7419', 'asoc/topic/tfa9879', 'asoc/topic/tlv320aic23', 'asoc/topic/tlv320aic26' and 'asoc/topic/tlv320aic31xx' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:54 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc/topic/tas571x', 'asoc/topic/tas5720' and 'asoc/topic/tas6424' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/sta529', 'asoc/topic/sti-sas', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:30:49 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/sta529', 'asoc/topic/sti-sas', 'asoc/topic/stm32', 'asoc/topic/sun4i' and 'asoc/topic/sun8i' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:45 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/ssm4567', 'asoc/topic/sta32x' and 'asoc/topic/sta350' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/sirf-audio', 'asoc/topic/sn95031', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:40 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/sirf-audio', 'asoc/topic/sn95031', 'asoc/topic/soc-dapm', 'asoc/topic/spdif_receiver' and 'asoc/topic/spdif_transmitter' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/rt5670', 'asoc/topic/sgtl5000', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:35 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/rt5670', 'asoc/topic/sgtl5000', 'asoc/topic/si476x' and 'asoc/topic/sirf' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5651', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:30:29 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5651', 'asoc/topic/rt5659' and 'asoc/topic/rt5660' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/rt298', 'asoc/topic/rt5514', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:30:24 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/rt298', 'asoc/topic/rt5514', 'asoc/topic/rt5616', 'asoc/topic/rt5631' and 'asoc/topic/rt5640' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/pistachio', 'asoc/topic/pxa', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:30:19 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/pistachio', 'asoc/topic/pxa', 'asoc/topic/rsnd', 'asoc/topic/rt274' and 'asoc/topic/rt286' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/msm8916-wcd-digital', 'asoc/topic/mtk...
Mark Brown [Wed, 28 Mar 2018 02:30:13 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/msm8916-wcd-digital', 'asoc/topic/mtk', 'asoc/topic/nau8540', 'asoc/topic/nau8810' and 'asoc/topic/nau8824' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/max98927', 'asoc/topic/mc13783', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:07 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/max98927', 'asoc/topic/mc13783', 'asoc/topic/mediatek', 'asoc/topic/ml26124' and 'asoc/topic/msm8916-wcd-analog' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/max9850', 'asoc/topic/max9860', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:30:01 +0000 (10:30 +0800)]
Merge remote-tracking branches 'asoc/topic/max9850', 'asoc/topic/max9860', 'asoc/topic/max9867', 'asoc/topic/max98925' and 'asoc/topic/max98926' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:56 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/max98357a', 'asoc/topic/max98371' and 'asoc/topic/max98373' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/isabelle', 'asoc/topic/jz4740', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:50 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/isabelle', 'asoc/topic/jz4740', 'asoc/topic/lm49453', 'asoc/topic/max9759' and 'asoc/topic/max98088' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/hdmi-codec', 'asoc/topic/ics43432', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:46 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/hdmi-codec', 'asoc/topic/ics43432', 'asoc/topic/imx-wm8962' and 'asoc/topic/inno_rk3036' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/fsl_esai', 'asoc/topic/fsl_ssi', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:40 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/fsl_esai', 'asoc/topic/fsl_ssi', 'asoc/topic/fsl_utils', 'asoc/topic/generic-dmaengine' and 'asoc/topic/gtm601' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:29:36 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134', 'asoc/topic/es8316', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/da7219', 'asoc/topic/da732x', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:29:31 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/da7219', 'asoc/topic/da732x', 'asoc/topic/da9055' and 'asoc/topic/dmic' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/cx20442', 'asoc/topic/cygnus', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:29:26 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/cx20442', 'asoc/topic/cygnus', 'asoc/topic/da7210', 'asoc/topic/da7213' and 'asoc/topic/da7218' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/cs42xx8', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:21 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/cs42xx8', 'asoc/topic/cs43130', 'asoc/topic/cs4349' and 'asoc/topic/cs53l30' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs42l42', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:29:16 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs42l42', 'asoc/topic/cs42l51', 'asoc/topic/cs42l52' and 'asoc/topic/cs42l56' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/cs35l33', 'asoc/topic/cs35l34', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:11 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/cs35l33', 'asoc/topic/cs35l34', 'asoc/topic/cs35l35', 'asoc/topic/cs4265' and 'asoc/topic/cs4270' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/cpcap', 'asoc/topic/cq93vc' and 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:29:07 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/cpcap', 'asoc/topic/cq93vc' and 'asoc/topic/cs35l32' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:29:01 +0000 (10:29 +0800)]
Merge remote-tracking branches 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/bd28623', 'asoc/topic/blackfin' and 'asoc/topic/bt-sco' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/ak5386', 'asoc/topic/ak5558', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:28:55 +0000 (10:28 +0800)]
Merge remote-tracking branches 'asoc/topic/ak5386', 'asoc/topic/ak5558', 'asoc/topic/alc5623', 'asoc/topic/alc5632' and 'asoc/topic/amd' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/ak4554', 'asoc/topic/ak4613', 'asoc/topic...
Mark Brown [Wed, 28 Mar 2018 02:28:49 +0000 (10:28 +0800)]
Merge remote-tracking branches 'asoc/topic/ak4554', 'asoc/topic/ak4613', 'asoc/topic/ak4641', 'asoc/topic/ak4642' and 'asoc/topic/ak4671' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/ads117x', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:28:43 +0000 (10:28 +0800)]
Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/ads117x', 'asoc/topic/ak4104', 'asoc/topic/ak4458' and 'asoc/topic/ak4535' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/ad73311', 'asoc/topic/adau1373', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:28:38 +0000 (10:28 +0800)]
Merge remote-tracking branches 'asoc/topic/ad73311', 'asoc/topic/adau1373', 'asoc/topic/adau17x1', 'asoc/topic/adau1977' and 'asoc/topic/adau7002' into asoc-next

6 years agoMerge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/ab8500', 'asoc...
Mark Brown [Wed, 28 Mar 2018 02:28:30 +0000 (10:28 +0800)]
Merge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/ab8500', 'asoc/topic/ac97', 'asoc/topic/ad1836' and 'asoc/topic/ad193x' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/samsung' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:30 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/samsung' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/rt5665' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:28 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/rt5665' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm512x' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:26 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm512x' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm5102a' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:25 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm5102a' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:23 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm3008' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:21 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm3008' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm186x' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:19 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm186x' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm179x' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:17 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm179x' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm1789' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:15 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm1789' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm1681' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:13 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm1681' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/pcm' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:12 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/pcm' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/intel' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:09 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/intel' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/dapm' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:08 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/core' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:06 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/core' into asoc-next

6 years agoMerge remote-tracking branch 'asoc/topic/component-platform' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:26:03 +0000 (10:26 +0800)]
Merge remote-tracking branch 'asoc/topic/component-platform' into asoc-next

6 years agoMerge tag 'asoc-v4.16-4' into asoc-next
Mark Brown [Wed, 28 Mar 2018 02:23:30 +0000 (10:23 +0800)]
Merge tag 'asoc-v4.16-4' into asoc-next

ASoC: Updates for v4.16

With the merge window having been delayed for another week here's
another batch of updates that came in during that week.  There's a few
important fixes in here, mainly a fix for I/O on a number of devices
caused by some of the component rework and a fix for a potential issue
if more than one component in a link provides compressed operations.

# gpg: Signature made Mon 29 Jan 2018 20:40:13 HKT
# gpg:                using RSA key ADE668AA675718B59FE29FEA24D68B725D5487D0
# gpg:                issuer "broonie@kernel.org"
# gpg: key 0D9EACE2CD7BEEBC: no public key for trusted key - skipped
# gpg: key 0D9EACE2CD7BEEBC marked as ultimately trusted
# gpg: key CCB0A420AF88CD16: no public key for trusted key - skipped
# gpg: key CCB0A420AF88CD16 marked as ultimately trusted
# gpg: key 162614E316005C11: no public key for trusted key - skipped
# gpg: key 162614E316005C11 marked as ultimately trusted
# gpg: key A730C53A5621E907: no public key for trusted key - skipped
# gpg: key A730C53A5621E907 marked as ultimately trusted
# gpg: key 276568D75C6153AD: no public key for trusted key - skipped
# gpg: key 276568D75C6153AD marked as ultimately trusted
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@debian.org>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@kernel.org>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>" [ultimate]
# gpg:                 aka "Mark Brown <broonie@linaro.org>" [ultimate]
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>" [ultimate]

6 years agoMerge remote-tracking branches 'asoc/fix/mtk', 'asoc/fix/rt5659', 'asoc/fix/ssm2602...
Mark Brown [Wed, 28 Mar 2018 02:23:19 +0000 (10:23 +0800)]
Merge remote-tracking branches 'asoc/fix/mtk', 'asoc/fix/rt5659', 'asoc/fix/ssm2602' and 'asoc/fix/topology' into asoc-linus

6 years agoMerge remote-tracking branch 'asoc/fix/component' into asoc-linus
Mark Brown [Wed, 28 Mar 2018 02:23:16 +0000 (10:23 +0800)]
Merge remote-tracking branch 'asoc/fix/component' into asoc-linus

6 years agoASoC: tscs42xx: Remove owner assignment from i2c_driver
Fabio Estevam [Sat, 24 Mar 2018 15:17:17 +0000 (12:17 -0300)]
ASoC: tscs42xx: Remove owner assignment from i2c_driver

Structure i2c_driver does not need to set the owner field, as this will
be populated by the driver core.

Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mediatek: remove "simple-mfd" in the example
Ryder Lee [Tue, 27 Mar 2018 01:32:25 +0000 (09:32 +0800)]
ASoC: mediatek: remove "simple-mfd" in the example

Remove compatible string "simple-mfd" in the example as we have
already added devm_of_platform_populate() in the parent driver.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: cpcap: replace codec to component
Kuninori Morimoto [Wed, 28 Mar 2018 01:51:02 +0000 (01:51 +0000)]
ASoC: cpcap: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Intel: bytcr_rt5651: don't use codec anymore
Kuninori Morimoto [Wed, 28 Mar 2018 01:49:36 +0000 (01:49 +0000)]
ASoC: Intel: bytcr_rt5651: don't use codec anymore

commit aeec6cc08215 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before
using it") is using codec->dev, but codec is replaced to component.
Let's use component

Fixes: aeec6cc08215 ("ASoC: Intel: bytcr_rt5651: Configure PLL1 before using it")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: amd: don't use codec anymore
Kuninori Morimoto [Wed, 28 Mar 2018 01:48:07 +0000 (01:48 +0000)]
ASoC: amd: don't use codec anymore

commit c88d31153356 ("ASoC: amd: Enable da7219 master clock using common
clock framework") is using rtd->codec, but codec is replaced to component.
Let's use component

Fixes: c88d31153356 ("ASoC: amd: Enable da7219 master clock using common clock framework")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: usb-audio: fix memory leak on cval
Colin Ian King [Tue, 27 Mar 2018 14:30:01 +0000 (15:30 +0100)]
ALSA: usb-audio: fix memory leak on cval

With the current exit return path of the ctl_info allocation failure
cval is not being freed resulting in a memory leak. Fix this by kfree'ing
it on the return.

Detected by CoverityScan, CID#1466878 ("Resource Leak")

Fixes: 21e9b3e931f7 ("ALSA: usb-audio: fix uac control query argument")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Fix mutex unbalance in OSS emulation ioctls
Takashi Iwai [Tue, 27 Mar 2018 12:32:23 +0000 (14:32 +0200)]
ALSA: pcm: Fix mutex unbalance in OSS emulation ioctls

The previous fix 40cab6e88cb0 ("ALSA: pcm: Return -EBUSY for OSS
ioctls changing busy streams") introduced some mutex unbalance; the
check of runtime->oss.rw_ref was inserted in a wrong place after the
mutex lock.

This patch fixes the inconsistency by rewriting with the helper
functions to lock/unlock parameters with the stream check.

Fixes: 40cab6e88cb0 ("ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: potential uninitialized return values
Dan Carpenter [Tue, 27 Mar 2018 13:07:52 +0000 (16:07 +0300)]
ALSA: pcm: potential uninitialized return values

Smatch complains that "tmp" can be uninitialized if we do a zero size
write.

Fixes: 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Fix kcontrol name string handling
Liam Girdwood [Tue, 27 Mar 2018 11:04:04 +0000 (12:04 +0100)]
ASoC: topology: Fix kcontrol name string handling

Fix the topology kcontrol string handling so that string pointer
references are strdup()ed instead of being copied. This fixes issues
with kcontrol templates on the stack or ones that are freed. Remember
and free the strings too when topology is unloaded.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
6 years agoALSA: aloop: Mark paused device as inactive
Robert Rosengren [Mon, 26 Mar 2018 05:24:49 +0000 (07:24 +0200)]
ALSA: aloop: Mark paused device as inactive

Show paused ALSA aloop device as inactive, i.e. the control
"PCM Slave Active" set as false. Notification sent upon state change.

This makes it possible for client capturing from aloop device to know if
data is expected. Without it the client expects data even if playback
is paused.

Signed-off-by: Robert Rosengren <robert.rosengren@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()
Stefan Roese [Mon, 26 Mar 2018 14:10:21 +0000 (16:10 +0200)]
ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()

When trying to use the driver (e.g. aplay *.wav), the 4MiB DMA buffer
will get mmapp'ed in 16KiB chunks. But this fails with the 2nd 16KiB
area, as the page offset is outside of the VMA range (size), which is
currently used as size parameter in snd_pcm_lib_default_mmap(). By
using the DMA buffer size (dma_bytes) instead, the complete DMA buffer
can be mmapp'ed and the issue is fixed.

This issue was detected on an ARM platform (TI AM57xx) using the RME
HDSP MADI PCIe soundcard.

Fixes: 657b1989dacf ("ALSA: pcm - Use dma_mmap_coherent() if available")
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoLinux 4.16-rc7
Linus Torvalds [Sun, 25 Mar 2018 22:44:30 +0000 (12:44 -1000)]
Linux 4.16-rc7

6 years agoMerge tag 'dmaengine-fix-4.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 25 Mar 2018 17:45:10 +0000 (07:45 -1000)]
Merge tag 'dmaengine-fix-4.16-rc7' of git://git./linux/kernel/git/vkoul/slave-dma

Pull dmaengine fix from Vinod Koul:
 "One small fix for stm32-dmamux fixing buffer overflow"

* tag 'dmaengine-fix-4.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma:
  dmaengine: stm32-dmamux: fix a potential buffer overflow

6 years agoMerge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 25 Mar 2018 17:36:02 +0000 (07:36 -1000)]
Merge branch 'x86-pti-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 and PTI fixes from Ingo Molnar:
 "Misc fixes:

   - fix EFI pagetables freeing

   - fix vsyscall pagetable setting on Xen PV guests

   - remove ancient CONFIG_X86_PPRO_FENCE=y - x86 is TSO again

   - fix two binutils (ld) development version related incompatibilities

   - clean up breakpoint handling

   - fix an x86 self-test"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/entry/64: Don't use IST entry for #BP stack
  x86/efi: Free efi_pgd with free_pages()
  x86/vsyscall/64: Use proper accessor to update P4D entry
  x86/cpu: Remove the CONFIG_X86_PPRO_FENCE=y quirk
  x86/boot/64: Verify alignment of the LOAD segment
  x86/build/64: Force the linker to use 2MB page size
  selftests/x86/ptrace_syscall: Fix for yet more glibc interference

6 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Mar 2018 17:34:50 +0000 (07:34 -1000)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Make posix clock ID usage Spectre-safe"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  posix-timers: Protect posix clock array access against speculation

6 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Mar 2018 17:33:30 +0000 (07:33 -1000)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "Two sched debug output related fixes: a console output fix and
  formatting fixes"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/debug: Adjust newlines for better alignment
  sched/debug: Fix per-task line continuation for console output

6 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Mar 2018 17:27:32 +0000 (07:27 -1000)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Misc kernel side fixes.

  Generic:
   - cgroup events counting fix

  x86:
   - Intel PMU truncated-parameter fix

   - RDPMC fix

   - API naming fix/rename

   - uncore driver big-hardware PCI enumeration fix

   - uncore driver filter constraint fix"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/cgroup: Fix child event counting bug
  perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers
  perf/x86/intel: Rename confusing 'freerunning PEBS' API and implementation to 'large PEBS'
  perf/x86/intel/uncore: Add missing filter constraint for SKX CHA event
  perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period()
  perf/x86/intel: Disable userspace RDPMC usage for large PEBS

6 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Mar 2018 17:18:31 +0000 (07:18 -1000)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Ingo Molnar:
 "Two fixes: tighten up a jump-labels warning to not trigger on certain
  modules and fix confusing (and non-existent) mutex API documentation"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  jump_label: Disable jump labels in __exit code
  locking/mutex: Improve documentation

6 years agotty: vt: fix up tabstops properly
Linus Torvalds [Sat, 24 Mar 2018 09:43:26 +0000 (10:43 +0100)]
tty: vt: fix up tabstops properly

Tabs on a console with long lines do not wrap properly, so correctly
account for the line length when computing the tab placement location.

Reported-by: James Holderness <j4_james@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
Linus Torvalds [Sun, 25 Mar 2018 06:29:15 +0000 (23:29 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/ebiederm/user-namespace

Pull mqueuefs revert from Eric Biederman:
 "This fixes a regression that came in the merge window for v4.16.

  The problem is that the permissions for mounting and using the
  mqueuefs filesystem are broken. The necessary permission check is
  missing letting people who should not be able to mount mqueuefs mount
  mqueuefs. The field sb->s_user_ns is set incorrectly not allowing the
  mounter of mqueuefs to remount and otherwise have proper control over
  the filesystem.

  Al Viro and I see the path to the necessary fixes differently and I am
  not even certain at this point he actually sees all of the necessary
  fixes. Given a couple weeks we can probably work something out but I
  don't see the review being resolved in time for the final v4.16. I
  don't want v4.16 shipping with a nasty regression. So unfortunately I
  am sending a revert"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  Revert "mqueue: switch to on-demand creation of internal mount"

6 years agoRevert "mqueue: switch to on-demand creation of internal mount"
Eric W. Biederman [Sat, 24 Mar 2018 16:28:14 +0000 (11:28 -0500)]
Revert "mqueue: switch to on-demand creation of internal mount"

This reverts commit 36735a6a2b5e042db1af956ce4bcc13f3ff99e21.

Aleksa Sarai <asarai@suse.de> writes:
> [REGRESSION v4.16-rc6] [PATCH] mqueue: forbid unprivileged user access to internal mount
>
> Felix reported weird behaviour on 4.16.0-rc6 with regards to mqueue[1],
> which was introduced by 36735a6a2b5e ("mqueue: switch to on-demand
> creation of internal mount").
>
> Basically, the reproducer boils down to being able to mount mqueue if
> you create a new user namespace, even if you don't unshare the IPC
> namespace.
>
> Previously this was not possible, and you would get an -EPERM. The mount
> is the *host* mqueue mount, which is being cached and just returned from
> mqueue_mount(). To be honest, I'm not sure if this is safe or not (or if
> it was intentional -- since I'm not familiar with mqueue).
>
> To me it looks like there is a missing permission check. I've included a
> patch below that I've compile-tested, and should block the above case.
> Can someone please tell me if I'm missing something? Is this actually
> safe?
>
> [1]: https://github.com/docker/docker/issues/36674

The issue is a lot deeper than a missing permission check.  sb->s_user_ns
was is improperly set as well.  So in addition to the filesystem being
mounted when it should not be mounted, so things are not allow that should
be.

We are practically to the release of 4.16 and there is no agreement between
Al Viro and myself on what the code should looks like to fix things properly.
So revert the code to what it was before so that we can take our time
and discuss this properly.

Fixes: 36735a6a2b5e ("mqueue: switch to on-demand creation of internal mount")
Reported-by: Felix Abecassis <fabecassis@nvidia.com>
Reported-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
6 years agoMerge tag 'pinctrl-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
Linus Torvalds [Sat, 24 Mar 2018 16:50:12 +0000 (09:50 -0700)]
Merge tag 'pinctrl-v4.16-3' of git://git./linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:
 "Two fixes for pin control for v4.16:

   - Renesas SH-PFC: remove a duplicate clkout pin which was causing
     crashes

   - fix Samsung out of bounds exceptions"

* tag 'pinctrl-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: samsung: Validate alias coming from DT
  pinctrl: sh-pfc: r8a7795: remove duplicate of CLKOUT pin in pinmux_pins[]

6 years agoALSA: usb-audio: update clock valid control
Andrew Chant [Sat, 24 Mar 2018 02:25:24 +0000 (19:25 -0700)]
ALSA: usb-audio: update clock valid control

Make the "clock valid" control a global control instead of a mixer
so that it doesn't appear in mixer applications.

Additionally, remove the check for writeability prohibited by spec, and
Use common code to read the control value.

Tested with a UAC2 Audio device that presents a clock validity
control.  The control still shows up in /proc usbmixer but not
in alsamixer.

Signed-off-by: Andrew Chant <achant@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: UAC2 jack detection
Andrew Chant [Sat, 24 Mar 2018 02:25:23 +0000 (19:25 -0700)]
ALSA: usb-audio: UAC2 jack detection

This implements UAC2 jack detection support, presenting
jack status as a boolean read-only mono mixer.

The presence of any channel in the UAC2_TE_CONNECTOR
control for a terminal will result in the mixer saying
the jack is connected.

Mixer naming follows the convention in sound/core/ctljack.c,
terminating the mixer with " Jack".
For additional clues as to which jack is being presented,
the name is prefixed with " - Input Jack" or " - Output Jack"
depending on if it's an input or output terminal.

This is required because terminal names are ambiguous
between inputs and outputs and often duplicated -
Bidirectional terminal types (0x400 -> 0x4FF)
"... may be used separately for input only or output only.
These types require two Terminal descriptors. Both have the same type."
(quote from "USB Device Class Definition for Terminal Types")

Since bidirectional terminal types are common for headphone adapters,
this distinguishes between two otherwise identically-named
jack controls.

Tested with a UAC2 audio device with connector control capability.

Signed-off-by: Andrew Chant <achant@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge tag 'trace-v4.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Fri, 23 Mar 2018 22:34:18 +0000 (15:34 -0700)]
Merge tag 'trace-v4.16-rc4' of git://git./linux/kernel/git/rostedt/linux-trace

Pull kprobe fixes from Steven Rostedt:
 "The documentation for kprobe events says that symbol offets can take
  both a + and - sign to get to befor and after the symbol address.

  But in actuality, the code does not support the minus. This fixes that
  issue, and adds a few more selftests to kprobe events"

* tag 'trace-v4.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  selftests: ftrace: Add a testcase for probepoint
  selftests: ftrace: Add a testcase for string type with kprobe_event
  selftests: ftrace: Add probe event argument syntax testcase
  tracing: probeevent: Fix to support minus offset from symbol

6 years agoALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams
Takashi Iwai [Fri, 23 Mar 2018 07:03:26 +0000 (08:03 +0100)]
ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams

OSS PCM stream management isn't modal but it allows ioctls issued at
any time for changing the parameters.  In the previous hardening
patch ("ALSA: pcm: Avoid potential races between OSS ioctls and
read/write"), we covered these races and prevent the corruption by
protecting the concurrent accesses via params_lock mutex.  However,
this means that some ioctls that try to change the stream parameter
(e.g. channels or format) would be blocked until the read/write
finishes, and it may take really long.

Basically changing the parameter while reading/writing is an invalid
operation, hence it's even more user-friendly from the API POV if it
returns -EBUSY in such a situation.

This patch adds such checks in the relevant ioctls with the addition
of read/write access refcount.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Avoid potential races between OSS ioctls and read/write
Takashi Iwai [Thu, 22 Mar 2018 17:10:14 +0000 (18:10 +0100)]
ALSA: pcm: Avoid potential races between OSS ioctls and read/write

Although we apply the params_lock mutex to the whole read and write
operations as well as snd_pcm_oss_change_params(), we may still face
some races.

First off, the params_lock is taken inside the read and write loop.
This is intentional for avoiding the too long locking, but it allows
the in-between parameter change, which might lead to invalid
pointers.  We check the readiness of the stream and set up via
snd_pcm_oss_make_ready() at the beginning of read and write, but it's
called only once, by assuming that it remains ready in the rest.

Second, many ioctls that may change the actual parameters
(i.e. setting runtime->oss.params=1) aren't protected, hence they can
be processed in a half-baked state.

This patch is an attempt to plug these holes.  The stream readiness
check is moved inside the read/write inner loop, so that the stream is
always set up in a proper state before further processing.  Also, each
ioctl that may change the parameter is wrapped with the params_lock
for avoiding the races.

The issues were triggered by syzkaller in a few different scenarios,
particularly the one below appearing as GPF in loopback_pos_update.

Reported-by: syzbot+c4227aec125487ec3efa@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Integrate native DSD support for ITF-USB based DACs.
Nobutaka Okabe [Fri, 23 Mar 2018 10:21:13 +0000 (19:21 +0900)]
ALSA: usb-audio: Integrate native DSD support for ITF-USB based DACs.

Integrate the native DSD support quirk codes of "ITF-USB DSD" based DACs.

Now, "is_itf_usb_dsd_2alts_dac()" and "is_itf_usb_dsd_3alts_dac()" is
integrated into one function "is_itf_usb_dsd_dac()".
So, remove the logic to distinguish UD-501 and UD-501V2 by the
"Product Name".

The integration is possible by changing the following two functions.

- snd_usb_select_mode_quirk():
Change the determination condition of the DSD mode switch command,
from the altset number being used, to the audio format being played.
Actually, this operation is same as playback using ASIO driver in
Windows environment.

- snd_usb_interface_dsd_format_quirk():
To which altset supports native DSD is determined by the number of altsets.
Previously, it's a constant "2" or "3".

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: FIX native DSD support for TEAC UD-501 DAC
Nobutaka Okabe [Fri, 23 Mar 2018 10:20:00 +0000 (19:20 +0900)]
ALSA: usb-audio: FIX native DSD support for TEAC UD-501 DAC

There are two versions of TEAC UD-501, the normal version and
the vendor updated version(UD-501V2).

They have the same VID/PID, but the num of the altsetting is different,
UD-501 has 2 altsets for stream, and UD-501V2 has 3.

So, add the logic to distinguish them by the Product Name, not by the PID.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add native DSD support for Luxman DA-06
Nobutaka Okabe [Fri, 23 Mar 2018 10:18:22 +0000 (19:18 +0900)]
ALSA: usb-audio: Add native DSD support for Luxman DA-06

Add native DSD support quirk for Luxman DA-06 DAC, by adding the
PID/VID 1852:5065.

Rename "is_marantz_denon_dac()" function to "is_itf_usb_dsd_2alts_dac()"
to cover broader device family sharing the same USB audio
implementation(*).
For the same reason, rename "is_teac_dsd_dac()" function to
"is_itf_usb_dsd_3alts_dac()".

(*)
These devices have the same USB controller "ITF-USB DSD", supplied by
INTERFACE Co., Ltd.
"ITF-USB DSD" USB controller has two patterns,

Pattern 1. (2 altsets version)
- Altset 0: for control
- Altset 1: for stream (S32)
- Altset 2: for stream (S32, DSD_U32)

Pattern 2. (3 altsets version)
- Altset 0: for control
- Altset 1: for stream (S16)
- Altset 2: for stream (S32)
- Altset 3: for stream (S32, DSD_U32)

"is_itf_usb_dsd_2alts_dac()" returns true, if the DAC has "Pattern 1"
USB controller, and "is_itf_usb_dsd_3alts_dac()" returns true, if
"Pattern2".

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Fri, 23 Mar 2018 21:02:24 +0000 (22:02 +0100)]
Merge branch 'for-linus' into for-next

Back-merge for applying more series of fixes for USB DSD support.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add native DSD support for TEAC UD-301
Nobutaka Okabe [Fri, 23 Mar 2018 10:49:44 +0000 (19:49 +0900)]
ALSA: usb-audio: Add native DSD support for TEAC UD-301

Add native DSD support quirk for TEAC UD-301 DAC,
by adding the PID/VID 0644:804a.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agox86/entry/64: Don't use IST entry for #BP stack
Andy Lutomirski [Thu, 23 Jul 2015 22:37:48 +0000 (15:37 -0700)]
x86/entry/64: Don't use IST entry for #BP stack

There's nothing IST-worthy about #BP/int3.  We don't allow kprobes
in the small handful of places in the kernel that run at CPL0 with
an invalid stack, and 32-bit kernels have used normal interrupt
gates for #BP forever.

Furthermore, we don't allow kprobes in places that have usergs while
in kernel mode, so "paranoid" is also unnecessary.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
6 years agox86/efi: Free efi_pgd with free_pages()
Waiman Long [Thu, 22 Mar 2018 19:18:53 +0000 (15:18 -0400)]
x86/efi: Free efi_pgd with free_pages()

The efi_pgd is allocated as PGD_ALLOCATION_ORDER pages and therefore must
also be freed as PGD_ALLOCATION_ORDER pages with free_pages().

Fixes: d9e9a6418065 ("x86/mm/pti: Allocate a separate user PGD")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1521746333-19593-1-git-send-email-longman@redhat.com
6 years agoMerge tag 'mips_fixes_4.16_5' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan...
Linus Torvalds [Fri, 23 Mar 2018 18:30:52 +0000 (11:30 -0700)]
Merge tag 'mips_fixes_4.16_5' of git://git./linux/kernel/git/jhogan/mips

Pull MIPS fixes from James Hogan:
 "Another miscellaneous pile of MIPS fixes for 4.16:

   - lantiq: fixes for clocks and Amazon SE (4.14)

   - ralink: fix booting on MT7621 (4.5)

   - ralink: fix halt (3.9)"

* tag 'mips_fixes_4.16_5' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips:
  MIPS: ralink: Fix booting on MT7621
  MIPS: ralink: Remove ralink_halt()
  MIPS: lantiq: ase: Enable MFD_SYSCON
  MIPS: lantiq: Enable AHB Bus for USB
  MIPS: lantiq: Fix Danube USB clock