openwrt/staging/blogic.git
11 years agoALSA: compress: Use kzalloc() for ioctls writing back data
Takashi Iwai [Mon, 22 Apr 2013 08:38:26 +0000 (10:38 +0200)]
ALSA: compress: Use kzalloc() for ioctls writing back data

Like the previous patch by Dan, we should clear the data to be
returned from certain compress ioctls, namely,
snd_compr_get_codec_caps() and snd_compr_get_params().
This time, we can simply replace kmalloc() with kzalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress: info leak in snd_compr_get_caps()
Dan Carpenter [Sun, 21 Apr 2013 11:07:29 +0000 (14:07 +0300)]
ALSA: compress: info leak in snd_compr_get_caps()

If the ->get_caps() function doesn't clear the buffer then there would
stack information leaked to userspace.  For example,
soc_compr_get_caps() can return success without clearing the buffer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Rework writes to use cumulative values
Charles Keepax [Thu, 18 Apr 2013 10:03:46 +0000 (11:03 +0100)]
ALSA: compress_core: Rework writes to use cumulative values

This patch reworks the writes to use cumulative values thus making the
app_pointer unecessary and removing it.

Only tested as far as build.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Remove unused hw_pointer
Charles Keepax [Thu, 18 Apr 2013 10:03:10 +0000 (11:03 +0100)]
ALSA: compress_core: Remove unused hw_pointer

Only tested as far as build.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoASoC: soc-compress: Deduce stream direction
Charles Keepax [Thu, 18 Apr 2013 10:02:38 +0000 (11:02 +0100)]
ASoC: soc-compress: Deduce stream direction

Previously we just hard coded all streams as playback streams, this
patch checks the DAI to see if it is a capture or playback stream. It is
worth noting that at this time only unidirectional streams are
supported.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Add support for capture streams
Charles Keepax [Thu, 18 Apr 2013 10:02:08 +0000 (11:02 +0100)]
ALSA: compress_core: Add support for capture streams

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Deconstify copy callback buffer
Charles Keepax [Thu, 18 Apr 2013 10:01:38 +0000 (11:01 +0100)]
ALSA: compress_core: Deconstify copy callback buffer

The buffer passed to the copy callback should not be const because the
copy callback can be used for capture and playback.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Calculate avail correctly for capture streams
Charles Keepax [Thu, 18 Apr 2013 10:01:03 +0000 (11:01 +0100)]
ALSA: compress_core: Calculate avail correctly for capture streams

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress_core: Update calc_avail to use cumulative values
Charles Keepax [Thu, 18 Apr 2013 09:59:23 +0000 (10:59 +0100)]
ALSA: compress_core: Update calc_avail to use cumulative values

The app_pointer is managed locally by the compress core for memory
mapped DSPs but for DSPs that are not memory mapped this would have to
be manually updated from within the DSP driver itself, which is hardly
very idiomatic.

This patch switches to using the cumulative values to calculate the
available buffer space because these are already gracefully passed out
of the DSP driver to the compress core and otherwise should be
functionally equivalent.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge tag 'asoc-v3.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Thu, 18 Apr 2013 14:24:31 +0000 (16:24 +0200)]
Merge tag 'asoc-v3.10-2' of git://git./linux/kernel/git/broonie/sound into for-next

ASoC: More updates for v3.10

The main additional change here is Lars-Peter's DMA work plus the
platform conversions which have been tested - getting this in mainline
will make life easier for development after the merge window.  These
factor a large chunk of code out of the drivers for the platforms using
dmaengine, greatly simplifying development.

11 years agoMerge remote-tracking branch 'asoc/topic/max98088' into asoc-next
Mark Brown [Thu, 18 Apr 2013 14:05:35 +0000 (15:05 +0100)]
Merge remote-tracking branch 'asoc/topic/max98088' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/fsl' into asoc-next
Mark Brown [Thu, 18 Apr 2013 14:05:33 +0000 (15:05 +0100)]
Merge remote-tracking branch 'asoc/topic/fsl' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/dma' into asoc-next
Mark Brown [Thu, 18 Apr 2013 14:05:30 +0000 (15:05 +0100)]
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/cs4271' into asoc-next
Mark Brown [Thu, 18 Apr 2013 14:05:28 +0000 (15:05 +0100)]
Merge remote-tracking branch 'asoc/topic/cs4271' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/core' into asoc-next
Mark Brown [Thu, 18 Apr 2013 14:05:25 +0000 (15:05 +0100)]
Merge remote-tracking branch 'asoc/topic/core' into asoc-next

11 years agoASoC: ux500: Use generic dmaengine PCM
Lars-Peter Clausen [Mon, 15 Apr 2013 17:20:04 +0000 (19:20 +0200)]
ASoC: ux500: Use generic dmaengine PCM

Use the generic dmaengine PCM driver instead of a custom implemention.  There is
a minor functional change, the ux500 PCM driver did not preallocate the audio
buffer, while the generic dmaengine PCM driver will do this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoALSA: snd-usb: add quirks handler for DSD streams
Daniel Mack [Tue, 16 Apr 2013 16:01:40 +0000 (00:01 +0800)]
ALSA: snd-usb: add quirks handler for DSD streams

Unfortunately, none of the UAC standards provides a way to identify DSD
(Direct Stream Digital) formats. Hence, this patch adds a quirks
handler to identify USB interfaces that are capable of handling DSD.

That quirks handler can augment the already parsed formats bit-field,
by any of the new SNDRV_PCM_FMTBIT_DSD_{U8_U16} and setting the dsd_dop
flag in the audio format, if the driver should take care for the DOP
byte stuffing.

The only devices that are known to work with this are the ones with
a 'Playback Designs' vendor id.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: snd-usb: add support for bit-reversed byte formats
Daniel Mack [Tue, 16 Apr 2013 16:01:39 +0000 (00:01 +0800)]
ALSA: snd-usb: add support for bit-reversed byte formats

There is quite some confusion around the bit-ordering in DSD samples,
and no general agreement that defines whether hardware is supposed to
expect the oldest sample in the MSB or the LSB of a byte.

ALSA will hence set the rule that on the software API layer, bytes
always carry the oldest bit in the most significant bit of a byte, and
the driver has to translate that at runtime in order to match the
hardware layout.

This patch adds support for this by adding a boolean flag to the
audio format struct.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: snd-usb: add support for DSD DOP stream transport
Daniel Mack [Tue, 16 Apr 2013 16:01:38 +0000 (00:01 +0800)]
ALSA: snd-usb: add support for DSD DOP stream transport

In order to provide a compatibility way for pushing DSD
samples through ordinary PCM channels, the "DoP open Standard" was
invented. See http://www.dsd-guide.com for the official document.

The host is required to stuff DSD marker bytes (0x05, 0xfa,
alternating) in the MSB of 24 bit wide samples on the bus, in addition
to the 16 bits of actual DSD sample payload.

To support this, the hardware and software stride logic in the driver
has to be tweaked a bit, as we make the userspace believe we're
operating on 16 bit samples, while we in fact push one more byte per
channel down to the hardware.

The DOP runtime information is stored in struct snd_usb_substream, so
we can keep track of our state across multiple calls to
prepare_playback_urb_dsd_dop().

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: snd-usb: use ep->stride from urb callbacks
Daniel Mack [Tue, 16 Apr 2013 16:01:37 +0000 (00:01 +0800)]
ALSA: snd-usb: use ep->stride from urb callbacks

For normal PCM transfer, this change has no effect, as the endpoint's
stride is always frame_bits/8. For DSD DOP streams, however, which is
added later, the hardware stride differs from the software stride, and
the endpoint has the correct information in these cases.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: add DSD formats
Daniel Mack [Tue, 16 Apr 2013 16:01:36 +0000 (00:01 +0800)]
ALSA: add DSD formats

This patch adds two formats for Direct Stream Digital (DSD), a
pulse-density encoding format which is described here:
https://en.wikipedia.org/wiki/Direct_Stream_Digital

DSD operates on 2.8, 5.6 or 11.2MHz sample rates and as a 1-bit
stream.

The two new types added by this patch describe streams that are capable
of handling DSD samples in DOP format as 8-bit or in 16-bit (or at a x8
or x16 data rate, respectively).

DSD itself specifies samples in *bit*, while DOP and ALSA handle them
as *bytes*. Hence, a factor of 8 or 16 has to be applied for the sample
rare configuration, according to the following table:

                                                  configured hardware
        176.4KHz   352.8kHz   705.6KHz     <----       sample rate

8-bit                2.8MHz     5.6MHz
16-bit    2.8Mhz     5.6MHz    11.2MHz

         `-----------------------------'
             actual DSD sample rates

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Disable the sanity check in snd_hda_add_pincfg()
Takashi Iwai [Thu, 18 Apr 2013 07:59:28 +0000 (09:59 +0200)]
ALSA: hda - Disable the sanity check in snd_hda_add_pincfg()

When pin default configs are overridden via patch option, these are
evaluated before fixups are applied.  Since some fixups change the
whole codec trees and/or add pins dynamically, this sanity check might
not pass when pins aren't present at the time the function is called.

We may reorder the execution, but an easier fix is simply to disable
this sanity check.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - fix error return code in patch_alc662()
Wei Yongjun [Thu, 18 Apr 2013 03:12:59 +0000 (11:12 +0800)]
ALSA: hda - fix error return code in patch_alc662()

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Don't call vmaster hook when bus->shutdown is set
Takashi Iwai [Wed, 17 Apr 2013 16:16:05 +0000 (18:16 +0200)]
ALSA: hda - Don't call vmaster hook when bus->shutdown is set

The flag bus->shutdown implies that the control elements might have
been already destroyed.  When a codec is resumed at this state and
tries to call vmaster hook (e.g. in snd_hda_gen_init()), it would
refer to a non-existing object, resulting in Oops in the end.

This patch just adds a check of the flag in the caller side for
avoiding such a crash.

Though, the best would be to clear hook->sw_kctl by the destructor of
the corresponding ctl element, but vmaster uses its own private_free,
it can't be done easily.  So let it be for a while.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoASoC: max98088: Fix logging of hardware revision.
Dylan Reid [Wed, 17 Apr 2013 03:02:34 +0000 (20:02 -0700)]
ASoC: max98088: Fix logging of hardware revision.

The hardware revision of the codec is based at 0x40.  Subtract that
before convering to ASCII.  The same as it is done for 98095.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
11 years agoASoC: define playback and capture streams in dummy codec
Stas Sergeev [Wed, 17 Apr 2013 12:34:06 +0000 (16:34 +0400)]
ASoC: define playback and capture streams in dummy codec

This patch adds a playback and capture streams to the dummy codec DAI
configuration. Most permissive set of sampling rates and formats is used.

This patch is needed for playback and capturing on a codec-less systems,
as otherwise the PCM device nodes are not even created.

Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: imx: Use generic dmaengine PCM
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:59 +0000 (19:19 +0200)]
ASoC: imx: Use generic dmaengine PCM

Use the generic dmaengine PCM driver instead of a custom implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: imx: Setup dma data in DAI probe
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:58 +0000 (19:19 +0200)]
ASoC: imx: Setup dma data in DAI probe

This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting imx to generic DMA engine PCM driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: dmaengine-pcm: Add support for platforms which can't report residue
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:55 +0000 (19:19 +0200)]
ASoC: dmaengine-pcm: Add support for platforms which can't report residue

Unfortunately there are still quite a few platforms with a dmaengine driver
which do not support reporting the number of bytes left to transfer. If we want
to support these platforms in the generic dmaengine PCM driver we have.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: tegra: Use generic dmaengine PCM
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:52 +0000 (19:19 +0200)]
ASoC: tegra: Use generic dmaengine PCM

Use the generic dmaengine PCM driver instead of a custom implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoMerge tag 'v3.9-rc7' into asoc-dma
Mark Brown [Wed, 17 Apr 2013 13:24:35 +0000 (14:24 +0100)]
Merge tag 'v3.9-rc7' into asoc-dma

Linux 3.9-rc7

11 years agoASoC: dmaengine_pcm: Add support for compat platforms
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:51 +0000 (19:19 +0200)]
ASoC: dmaengine_pcm: Add support for compat platforms

Add support for platforms which don't use devicetree yet or have to optionally
support a non-devicetree way to request the DMA channel. The patch adds the
compat_request_channel and compat_filter_fn callbacks to the
snd_dmaengine_pcm_config struct. If the compat_request_channel is implemented it
will be used to request the DMA channel. If not dma_request_channel with
compat_filter_fn as the filter function will be used to request the channel.

The patch also exports the snd_dmaengine_pcm_request_chan() function, since
compat platforms will want to use it to request their DMA channel.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: Add a generic dmaengine_pcm driver
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:50 +0000 (19:19 +0200)]
ASoC: Add a generic dmaengine_pcm driver

This patch adds a generic dmaengine PCM driver. It builds on top of the
dmaengine PCM library and adds the missing pieces like DMA channel management,
buffer management and channel configuration. It will be able to replace the
majority of the existing platform specific dmaengine based PCM drivers.
Devicetree is used to map the DMA channels to the PCM device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoASoC: Add snd_soc_{add, remove}_platform
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:49 +0000 (19:19 +0200)]
ASoC: Add snd_soc_{add, remove}_platform

snd_soc_{add,remove}_platform are similar to snd_soc_register_platform and
snd_soc_unregister_platform with the difference that they won't allocate and
free the snd_soc_platform structure.

Also add snd_soc_lookup_platform which looks up a platform by the device it has
been registered for.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoMerge branch 'topic/core' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Wed, 17 Apr 2013 13:18:06 +0000 (14:18 +0100)]
Merge branch 'topic/core' of git://git./linux/kernel/git/broonie/sound into asoc-dma

11 years agoASoC: dmaengine-pcm: Make requesting the DMA channel at PCM open optional
Lars-Peter Clausen [Mon, 15 Apr 2013 17:19:48 +0000 (19:19 +0200)]
ASoC: dmaengine-pcm: Make requesting the DMA channel at PCM open optional

Refactor the dmaengine PCM library to allow the DMA channel to be requested
before opening a PCM substream. snd_dmaengine_pcm_open() now expects a DMA
channel instead of a filter function and filter parameter as its parameters.
snd_dmaengine_pcm_close() is updated to not release the DMA channel. This allows
a dmaengine based PCM driver to request its channels before the substream is
opened.

The patch also introduces two new functions, snd_dmaengine_pcm_open_request_chan()
and snd_dmaengine_pcm_close_release_chan(), which have the same signature and
behaviour of the old snd_dmaengine_pcm_{open,close}() and internally use the new
variants of these functions. All users of snd_dmaengine_pcm_{open,close}() are
updated to use snd_dmaengine_pcm_open_request_chan() and
snd_dmaengine_pcm_close_release_chan().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoALSA: hda - fixup D3 pin and right channel mute on Haswell HDMI audio
David Henningsson [Wed, 10 Apr 2013 10:26:07 +0000 (12:26 +0200)]
ALSA: hda - fixup D3 pin and right channel mute on Haswell HDMI audio

When graphics initializes the HDMI chip, sometimes this leads to
pins going into D3 and right channel being muted. If the audio driver
finishes initialization before the graphic driver does, this situation
becomes permanent.

This is a workaround that checks for this situation and corrects it on
playback prepare. It has been verified working on at least one machine.

BugLink: https://bugs.launchpad.net/bugs/1167270
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Use the primary DAC for all aamix outputs
Takashi Iwai [Tue, 16 Apr 2013 12:16:54 +0000 (14:16 +0200)]
ALSA: hda - Use the primary DAC for all aamix outputs

When setting up the aamix output paths, use the primary DAC instead of
the individual DAC for each output as default.  Otherwise multiple
DACs will be turned on for a single aamix widget, which results in
doubly or more volumes, because the duplicated signals will be sent
through all these DACs for a single stream.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoASoC: fsl-ssi: Add SACNT definitions
Markus Pargmann [Sun, 14 Apr 2013 11:42:52 +0000 (13:42 +0200)]
ASoC: fsl-ssi: Add SACNT definitions

Add definitions for AC97 control register.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Timur Tabi <timur@tabi.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoALSA: hda - Fix aamix activation with loopback control on VIA codecs
Takashi Iwai [Tue, 16 Apr 2013 10:31:05 +0000 (12:31 +0200)]
ALSA: hda - Fix aamix activation with loopback control on VIA codecs

When we have a loopback mixer control, this should manage the state
whether the output paths include the aamix or not.  But the current
code blindly initializes the output paths with aamix = true, thus the
aamix is enabled unless the loopback mixer control is changed.

Also, update_aamix_paths() called by the loopback mixer control put
callback invokes snd_hda_activate_path() with aamix = true even for
disabling the mixing.  This leaves the aamix path even though the
loopback control is turned off.

This patch fixes these issues:
- Introduced aamix_default() helper to indicate whether with_aamix is
  true or false as default
- Fix the argument in update_aamix_paths() for disabling loopback

Reported-by: Lydia Wang <LydiaWang@viatech.com.cn>
Cc: <stable@vger.kernel.org> [v3.9+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add codec delay to the capture time stamp.
Dylan Reid [Mon, 15 Apr 2013 18:57:05 +0000 (11:57 -0700)]
ALSA: hda - Add codec delay to the capture time stamp.

For capture, the delay through the codec contributes to the time stamp
of the sample recorded at the A to D.  Rename the codec time stamp
function appropriately.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge tag 'asoc-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Mon, 15 Apr 2013 17:45:16 +0000 (19:45 +0200)]
Merge tag 'asoc-v3.10' of git://git./linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v3.10

A bunch of changes here, the most interesting one subsystem wise being
Morimoto-san's work to create snd_soc_component which doesn't do much
for now but will be pretty important going forwards:

 - Add a new component object type which will form the basis of moving
   to a more generic handling of SoC and off-SoC components, contributed
   by Kuninori Morimoto.
 - A fairly large set of cleanups for the dmaengine integration from
   Lars-Peter Clausen, starting to move towards being able to have a
   generic driver based on the library.
 - Performance optimisations to DAPM from Ryo Tsutsui.
 - Support for mixer control sharing in DAPM from Stephen Warren.
 - Multiplatform ARM cleanups from Arnd Bergmann.
 - New CODEC drivers for AK5385 and TAS5086 from Daniel Mack.

11 years agoALSA: usb-audio: disable autopm for MIDI devices
Clemens Ladisch [Mon, 15 Apr 2013 13:59:51 +0000 (15:59 +0200)]
ALSA: usb-audio: disable autopm for MIDI devices

Commit 88a8516a2128 (ALSA: usbaudio: implement USB autosuspend)
introduced autopm for all USB audio/MIDI devices.  However, many MIDI
devices, such as synthesizers, do not merely transmit MIDI messages but
use their MIDI inputs to control other functions.  With autopm, these
devices would get powered down as soon as the last MIDI port device is
closed on the host.

Even some plain MIDI interfaces could get broken: they automatically
send Active Sensing messages while powered up, but as soon as these
messages cease, the receiving device would interpret this as an
accidental disconnection.

Commit f5f165418cab (ALSA: usb-audio: Fix missing autopm for MIDI input)
introduced another regression: some devices (e.g. the Roland GAIA SH-01)
are self-powered but do a reset whenever the USB interface's power state
changes.

To work around all this, just disable autopm for all USB MIDI devices.

Reported-by: Laurens Holst
Cc: <stable@vger.kernel.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix headset mic support for Asus X101CH
David Henningsson [Mon, 15 Apr 2013 10:50:02 +0000 (12:50 +0200)]
ALSA: hda - Fix headset mic support for Asus X101CH

With this patch, a TRRS headset mic cannot be successfully detected
on the Asus X101CH, and we can also distinguish between headphone
and headset automatically.

Buglink: https://bugs.launchpad.net/bugs/1169138
Co-authored-by: Kailang <kailang@realtek.com>
Tested-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Implement headset jack functionality for some Dell hw
David Henningsson [Mon, 15 Apr 2013 13:44:14 +0000 (15:44 +0200)]
ALSA: hda - Implement headset jack functionality for some Dell hw

On some machines, there is a headset jack that can support both
headphone, headsets (of both CTIA and OMTP type) and mic-in.

On other machines, the headset jack supports headphone, headsets
(both CTIA and OMTP), but not mic-in.

This patch implements that functionality as different capture sources.

Buglink: https://bugs.launchpad.net/bugs/1169143
Tested-by: David Chen <david.chen@canonical.com>
Co-authored-by: Kailang <kailang@realtek.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoLinux 3.9-rc7
Linus Torvalds [Mon, 15 Apr 2013 00:45:16 +0000 (17:45 -0700)]
Linux 3.9-rc7

11 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 Apr 2013 18:13:24 +0000 (11:13 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mm: Flush lazy MMU when DEBUG_PAGEALLOC is set
  x86/mm/cpa/selftest: Fix false positive in CPA self test
  x86/mm/cpa: Convert noop to functional fix
  x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal
  x86, mm, paravirt: Fix vmalloc_fault oops during lazy MMU updates

11 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 Apr 2013 18:12:17 +0000 (11:12 -0700)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "Misc fixlets"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/cputime: Fix accounting on multi-threaded processes
  sched/debug: Fix sd->*_idx limit range avoiding overflow
  sched_clock: Prevent 64bit inatomicity on 32bit systems
  sched: Convert BUG_ON()s in try_to_wake_up_local() to WARN_ON_ONCE()s

11 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 Apr 2013 18:10:44 +0000 (11:10 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Misc fixlets"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf: Fix error return code
  ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()
  perf: Fix strncpy() use, use strlcpy() instead of strncpy()
  perf: Fix strncpy() use, always make sure it's NUL terminated
  perf: Fix ring_buffer perf_output_space() boundary calculation
  perf/x86: Fix uninitialized pt_regs in intel_pmu_drain_bts_buffer()

11 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Sun, 14 Apr 2013 17:55:20 +0000 (10:55 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "One fix for a hotplug locking regressions, and one fix for an oops if
  you unplug the monitor at an inopportune moment on the udl device."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/fb-helper: Fix locking in drm_fb_helper_hotplug_event
  udl: handle EDID failure properly.

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
Linus Torvalds [Sun, 14 Apr 2013 17:54:40 +0000 (10:54 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/gerg/m68knommu

Pull m68knommu fix from Greg Ungerer:
 "This contains only a single compilation fix for ColdFire m68k targets
  that use local non-GPIOLIB support."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: define a local gpio_request_one() function

11 years agoMerge git://www.linux-watchdog.org/linux-watchdog
Linus Torvalds [Sun, 14 Apr 2013 17:53:54 +0000 (10:53 -0700)]
Merge git://www.linux-watchdog.org/linux-watchdog

Pull watchdog fix from Wim Van Sebroeck:
 "It will fix compile errors for the at91rm9200_wdt driver"

* git://www.linux-watchdog.org/linux-watchdog:
  watchdog: Revert the AT91RM9200_WATCHDOG dependency

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Sun, 14 Apr 2013 17:52:54 +0000 (10:52 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/mason/linux-btrfs

Pull one more btrfs fix from Chris Mason:
 "This has a recent fix from Josef for our tree log replay code.  It
  fixes problems where the inode counter for the number of bytes in the
  file wasn't getting updated properly during fsync replay.

  The commit did get rebased this morning, but it was only to clean up
  the subject line.  The code hasn't changed."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: make sure nbytes are right after log replay

11 years agoMerge tag 'trace-fixes-v3.9-rc-v3' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 14 Apr 2013 17:50:55 +0000 (10:50 -0700)]
Merge tag 'trace-fixes-v3.9-rc-v3' of git://git./linux/kernel/git/rostedt/linux-trace

Pull ftrace fixes from Steven Rostedt:
 "Namhyung Kim found and fixed a bug that can crash the kernel by simply
  doing: echo 1234 | tee -a /sys/kernel/debug/tracing/set_ftrace_pid

  Luckily, this can only be done by root, but still is a nasty bug."

* tag 'trace-fixes-v3.9-rc-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  ftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section
  tracing: Fix possible NULL pointer dereferences

11 years agoAdd file_ns_capable() helper function for open-time capability checking
Linus Torvalds [Sun, 14 Apr 2013 17:06:31 +0000 (10:06 -0700)]
Add file_ns_capable() helper function for open-time capability checking

Nothing is using it yet, but this will allow us to delay the open-time
checks to use time, without breaking the normal UNIX permission
semantics where permissions are determined by the opener (and the file
descriptor can then be passed to a different process, or the process can
drop capabilities).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agowatchdog: Revert the AT91RM9200_WATCHDOG dependency
Nicolas Ferre [Wed, 10 Apr 2013 12:36:22 +0000 (14:36 +0200)]
watchdog: Revert the AT91RM9200_WATCHDOG dependency

Compiling the at91rm9200_wdt.c driver without at91rm9200
support was leading to several errors:

drivers/built-in.o: In function `at91_wdt_close':
at91_adc.c:(.text+0xc9fe4): undefined reference to `at91_st_base'
drivers/built-in.o: In function `at91_wdt_write':
at91_adc.c:(.text+0xca004): undefined reference to `at91_st_base'
drivers/built-in.o: In function `at91wdt_shutdown':
at91_adc.c:(.text+0xca01c): undefined reference to `at91_st_base'
drivers/built-in.o: In function `at91wdt_suspend':
at91_adc.c:(.text+0xca038): undefined reference to `at91_st_base'
drivers/built-in.o: In function `at91_wdt_open':
at91_adc.c:(.text+0xca0cc): undefined reference to `at91_st_base'
drivers/built-in.o:at91_adc.c:(.text+0xca2c8): more undefined references to
`at91_st_base' follow

So, reverting the modification of the "depends" Kconfig line
introduced by patch a6a1bcd37 (watchdog: at91rm9200: add DT support)
seems to be the good solution.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
11 years agovfs: Revert spurious fix to spinning prevention in prune_icache_sb
Suleiman Souhlal [Sat, 13 Apr 2013 23:03:06 +0000 (16:03 -0700)]
vfs: Revert spurious fix to spinning prevention in prune_icache_sb

Revert commit 62a3ddef6181 ("vfs: fix spinning prevention in prune_icache_sb").

This commit doesn't look right: since we are looking at the tail of the
list (sb->s_inode_lru.prev) if we want to skip an inode, we should put
it back at the head of the list instead of the tail, otherwise we will
keep spinning on it.

Discovered when investigating why prune_icache_sb came top in perf
reports of a swapping load.

Signed-off-by: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@vger.kernel.org # v3.2+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agokobject: fix kset_find_obj() race with concurrent last kobject_put()
Linus Torvalds [Sat, 13 Apr 2013 22:15:30 +0000 (15:15 -0700)]
kobject: fix kset_find_obj() race with concurrent last kobject_put()

Anatol Pomozov identified a race condition that hits module unloading
and re-loading.  To quote Anatol:

 "This is a race codition that exists between kset_find_obj() and
  kobject_put().  kset_find_obj() might return kobject that has refcount
  equal to 0 if this kobject is freeing by kobject_put() in other
  thread.

  Here is timeline for the crash in case if kset_find_obj() searches for
  an object tht nobody holds and other thread is doing kobject_put() on
  the same kobject:

    THREAD A (calls kset_find_obj())     THREAD B (calls kobject_put())
    splin_lock()
                                         atomic_dec_return(kobj->kref), counter gets zero here
                                         ... starts kobject cleanup ....
                                         spin_lock() // WAIT thread A in kobj_kset_leave()
    iterate over kset->list
    atomic_inc(kobj->kref) (counter becomes 1)
    spin_unlock()
                                         spin_lock() // taken
                                         // it does not know that thread A increased counter so it
                                         remove obj from list
                                         spin_unlock()
                                         vfree(module) // frees module object with containing kobj

    // kobj points to freed memory area!!
    kobject_put(kobj) // OOPS!!!!

  The race above happens because module.c tries to use kset_find_obj()
  when somebody unloads module.  The module.c code was introduced in
  commit 6494a93d55fa"

Anatol supplied a patch specific for module.c that worked around the
problem by simply not using kset_find_obj() at all, but rather than make
a local band-aid, this just fixes kset_find_obj() to be thread-safe
using the proper model of refusing the get a new reference if the
refcount has already dropped to zero.

See examples of this proper refcount handling not only in the kref
documentation, but in various other equivalent uses of this pattern by
grepping for atomic_inc_not_zero().

[ Side note: the module race does indicate that module loading and
  unloading is not properly serialized wrt sysfs information using the
  module mutex.  That may require further thought, but this is the
  correct fix at the kobject layer regardless. ]

Reported-analyzed-and-tested-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoBtrfs: make sure nbytes are right after log replay
Josef Bacik [Fri, 5 Apr 2013 20:50:09 +0000 (20:50 +0000)]
Btrfs: make sure nbytes are right after log replay

While trying to track down a tree log replay bug I noticed that fsck was always
complaining about nbytes not being right for our fsynced file.  That is because
the new fsync stuff doesn't wait for ordered extents to complete, so the inodes
nbytes are not necessarily updated properly when we log it.  So to fix this we
need to set nbytes to whatever it is on the inode that is on disk, so when we
replay the extents we can just add the bytes that are being added as we replay
the extent.  This makes it work for the case that we have the wrong nbytes or
the case that we logged everything and nbytes is actually correct.  With this
I'm no longer getting nbytes errors out of btrfsck.

Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoALSA: usb: Add quirk for 192KHz recording on E-Mu devices
Calvin Owens [Sat, 13 Apr 2013 03:33:59 +0000 (22:33 -0500)]
ALSA: usb: Add quirk for 192KHz recording on E-Mu devices

When recording at 176.2KHz or 192Khz, the device adds a 32-bit length
header to the capture packets, which obviously needs to be ignored for
recording to work properly.

Userspace expected:  L0 L1 L2 R0 R1 R2
...but actually got: R2 L0 L1 L2 R0 R1

Also, the last byte of the length header being interpreted as L0 of
the first sample caused spikes every 0.5ms, resulting in a loud 16KHz
tone (about the highest 'B' on a piano) being present throughout
captures.

Tested at all sample rates on an E-Mu 0404USB, and tested for
regressions on a generic USB headset.

Signed-off-by: Calvin Owens <jcalvinowens@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agox86-32: Fix possible incomplete TLB invalidate with PAE pagetables
Dave Hansen [Fri, 12 Apr 2013 23:23:54 +0000 (16:23 -0700)]
x86-32: Fix possible incomplete TLB invalidate with PAE pagetables

This patch attempts to fix:

https://bugzilla.kernel.org/show_bug.cgi?id=56461

The symptom is a crash and messages like this:

chrome: Corrupted page table at address 34a03000
*pdpt = 0000000000000000 *pde = 0000000000000000
Bad pagetable: 000f [#1] PREEMPT SMP

Ingo guesses this got introduced by commit 611ae8e3f520 ("x86/tlb:
enable tlb flush range support for x86") since that code started to free
unused pagetables.

On x86-32 PAE kernels, that new code has the potential to free an entire
PMD page and will clear one of the four page-directory-pointer-table
(aka pgd_t entries).

The hardware aggressively "caches" these top-level entries and invlpg
does not actually affect the CPU's copy.  If we clear one we *HAVE* to
do a full TLB flush, otherwise we might continue using a freed pmd page.
(note, we do this properly on the population side in pud_populate()).

This patch tracks whenever we clear one of these entries in the 'struct
mmu_gather', and ensures that we follow up with a full tlb flush.

BTW, I disassembled and checked that:

if (tlb->fullmm == 0)
and
if (!tlb->fullmm && !tlb->need_flush_all)

generate essentially the same code, so there should be zero impact there
to the !PAE case.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Artem S Tashkinov <t.artem@mailcity.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Linus Torvalds [Fri, 12 Apr 2013 22:26:42 +0000 (15:26 -0700)]
Merge git://git./linux/kernel/git/nab/target-pending

Pull SCSI target fixes from Nicholas Bellinger:
 "Here are remaining target-pending items for v3.9-rc7 code.

  The tcm_vhost patches are more than I'd usually include in a -rc7
  pull, but are changes required for v3.9 to work correctly with the
  pending vhost-scsi-pci QEMU upstream series merge.  (Paolo CC'ed)

  Plus Asias's conversion to use vhost_virtqueue->private_data + RCU for
  managing vhost-scsi endpoints has gotten alot of review + testing over
  the past weeks, and MST has ACKed the full series.

  Also, there is a target patch to fix a long-standing bug within
  control CDB handling with Standby/Offline/Transition ALUA port access
  states, that had been incorrectly rejecting the control CDBs required
  for LUN scan to work during these port group states.  CC'ing to
  stable."

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  target: Fix incorrect fallthrough of ALUA Standby/Offline/Transition CDBs
  tcm_vhost: Send bad target to guest when cmd fails
  tcm_vhost: Add vhost_scsi_send_bad_target() helper
  tcm_vhost: Fix tv_cmd leak in vhost_scsi_handle_vq
  tcm_vhost: Remove double check of response
  tcm_vhost: Initialize vq->last_used_idx when set endpoint
  tcm_vhost: Use vq->private_data to indicate if the endpoint is setup
  tcm_vhost: Use ACCESS_ONCE for vs->vs_tpg[target] access

11 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Fri, 12 Apr 2013 22:18:56 +0000 (15:18 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of ten bug fixes (and two consisting of copyright year
  update and version number change) pretty much all of which involve
  either a crash or a hang except the removal of the random sleep from
  the qla2xxx driver (which is a coding error so bad, we want it gone
  before anyone has a chance to copy it)."

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  [SCSI] lpfc: fix potential NULL pointer dereference in lpfc_sli4_rq_put()
  [SCSI] libsas: fix handling vacant phy in sas_set_ex_phy()
  [SCSI] ibmvscsi: Fix slave_configure deadlock
  [SCSI] qla2xxx: Update the driver version to 8.04.00.13-k.
  [SCSI] qla2xxx: Remove debug code that msleeps for random duration.
  [SCSI] qla2xxx: Update copyright dates information in LICENSE.qla2xxx file.
  [SCSI] qla2xxx: Fix crash during firmware dump procedure.
  [SCSI] Revert "qla2xxx: Add setting of driver version string for vendor application."
  [SCSI] ipr: dlpar failed when adding an adapter back
  [SCSI] ipr: fix addition of abort command to HRRQ free queue
  [SCSI] st: Take additional queue ref in st_probe
  [SCSI] libsas: use right function to alloc smp response
  [SCSI] ipr: ipr_test_msi() fails when running with msi-x enabled adapter

11 years agoMerge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Fri, 12 Apr 2013 22:18:20 +0000 (15:18 -0700)]
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fix from Steve French:
 "Fixes a regression in cifs in which a password which begins with a
  comma is parsed incorrectly as a blank password"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Allow passwords which begin with a delimitor

11 years agoftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section
Steven Rostedt (Red Hat) [Fri, 12 Apr 2013 20:40:13 +0000 (16:40 -0400)]
ftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section

As ftrace_filter_lseek is now used with ftrace_pid_fops, it needs to
be moved out of the #ifdef CONFIG_DYNAMIC_FTRACE section as the
ftrace_pid_fops is defined when DYNAMIC_FTRACE is not.

Cc: stable@vger.kernel.org
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Fix possible NULL pointer dereferences
Namhyung Kim [Thu, 11 Apr 2013 06:55:01 +0000 (15:55 +0900)]
tracing: Fix possible NULL pointer dereferences

Currently set_ftrace_pid and set_graph_function files use seq_lseek
for their fops.  However seq_open() is called only for FMODE_READ in
the fops->open() so that if an user tries to seek one of those file
when she open it for writing, it sees NULL seq_file and then panic.

It can be easily reproduced with following command:

  $ cd /sys/kernel/debug/tracing
  $ echo 1234 | sudo tee -a set_ftrace_pid

In this example, GNU coreutils' tee opens the file with fopen(, "a")
and then the fopen() internally calls lseek().

Link: http://lkml.kernel.org/r/1365663302-2170-1-git-send-email-namhyung@kernel.org
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: stable@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoMerge tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Linus Torvalds [Fri, 12 Apr 2013 14:45:17 +0000 (07:45 -0700)]
Merge tag 'sound-3.9' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This contains a few small ASoC fixes (wm8903, wm5102, samsung-i2s,
  tegra, and soc-compress) and an endian fix for NI USB-audio devices,
  update for Mark's e-mail address.

  No scary changes, AFAIS."

* tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  MAINTAINERS: Update e-mail address
  ASoC: wm5102: Correct lookup of arizona struct in SYSCLK event
  ASoC: wm8903: Fix the bypass to HP/LINEOUT when no DAC or ADC is running
  ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_*
  ASoC: tegra: Don't claim to support PCM pause and resume
  ASoC: Samsung: set drvdata before adding secondary device
  ASoC: Samsung: return error if drvdata is not set
  ASoC: compress: Cancel delayed power down if needed
  ASoC: core: Fix to check return value of snd_soc_update_bits_locked()

11 years agoMerge remote-tracking branch 'asoc/topic/wm8994' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:31 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm8994' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/wm8960' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:29 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm8960' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/wm8903' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:28 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm8903' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/wm2000' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:27 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm2000' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/wm0010' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:26 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm0010' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/wm-hubs' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:25 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/wm-hubs' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/ux500' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:22 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/ux500' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/tegra' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:21 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/tas5086' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:19 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/tas5086' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/spear' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:17 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/spear' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/si476x' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:15 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/samsung' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:13 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/samsung' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/max98090' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:12 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/max98090' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/max98088' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:10 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/max98088' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/maintainers' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:08 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/maintainers' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/fsl' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:07 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/fsl' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/fsi' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:05 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/fsi' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/dma' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:04 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/davinci' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:03 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/davinci' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/dapm' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:02 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/cs42l73' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:57:00 +0000 (13:57 +0100)]
Merge remote-tracking branch 'asoc/topic/cs42l73' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/cs4271' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:59 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/cs4271' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/core' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:58 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/core' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/compress' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:57 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/compress' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/component' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:56 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/component' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/atmel' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:54 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/atmel' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/arizona' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:53 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/arizona' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/ak5386' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:52 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/ak5386' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/ak4104' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:51 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/ak4104' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/adsp' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:49 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/adsp' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/topic/adau1373' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:48 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/topic/adau1373' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/fix/wm8903' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:46 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/fix/wm8903' into asoc-next

11 years agoMerge remote-tracking branch 'asoc/fix/tegra' into asoc-next
Mark Brown [Fri, 12 Apr 2013 12:56:46 +0000 (13:56 +0100)]
Merge remote-tracking branch 'asoc/fix/tegra' into asoc-next