OSDN Git Service

uclinux-h8/linux.git
5 years agoALSA: bt87x: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:11 +0000 (23:24 +0200)]
ALSA: bt87x: Proper endian notations

The RISC data in bt87x is in little-endian, hence we should define it
with __le32 properly.

Spotted by sparse, a warning like:
  sound/pci/bt87x.c:240:17: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: echoaudio: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:10 +0000 (23:24 +0200)]
ALSA: echoaudio: Proper endian notations

Many data fields defined in echoaudio drivers are in little-endian,
hence they should be defined with __le16 or __le32.  This makes it
easier to catch the forgotten conversions.

Spotted by sparse, a warning like:
  sound/pci/echoaudio/echoaudio_dsp.c:990:36: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: maestro3: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:09 +0000 (23:24 +0200)]
ALSA: maestro3: Proper endian notations

The ASSP data passed to maestro3 driver is in little-endian format,
hence the data pointer should be with __le16.

Spotted by sparse, warnings like:
  sound/pci/maestro3.c:2128:35: warning: cast to restricted __le16

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: intel8x0m: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:08 +0000 (23:24 +0200)]
ALSA: intel8x0m: Proper endian notations

The BD address tables in intel8x0m driver are in little-endian, hence
they should be represented as __le32 instead u32.

Spotted by sparse, warnings like:
  sound/pci/intel8x0m.c:406:40: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: intel8x0: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:07 +0000 (23:24 +0200)]
ALSA: intel8x0: Proper endian notations

The BD address tables in intel8x0 driver are in little-endian, hence
they should be represented as __le32 instead u32.

Spotted by sparse, warnings like:
  sound/pci/intel8x0.c:688:40: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: lola: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:06 +0000 (23:24 +0200)]
ALSA: lola: Proper endian notations

The BDL entries in lola driver are little-endian while we code them as
u32.  This leads to sparse warnings like:
  sound/pci/lola/lola.c:105:40: warning: incorrect type in assignment (different base types)
  sound/pci/lola/lola.c:105:40:    expected unsigned int [unsigned] [usertype] <noident>
  sound/pci/lola/lola.c:105:40:    got restricted __le32 [usertype] <noident>

This patch fixes the declarations to the proper __le32 type.

Also, there was a typo in the original code, where __user was used
that was intended as __iomem.  This was caused also by sparse:
  sound/pci/lola/lola_mixer.c:132:27: warning: incorrect type in assignment (different address spaces)
Fixed in this patch as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: mixart: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:05 +0000 (23:24 +0200)]
ALSA: mixart: Proper endian notations

The miXart driver deals with big-endian values as raw data, while it
declares most of variables as u32.  This leads to sparse warnings like
  sound/pci/mixart/mixart.c:1203:23: warning: cast to restricted __be32

Fix them by properly defining the structs and add the explicit cast to
macros.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: riptide: Properly endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:04 +0000 (23:24 +0200)]
ALSA: riptide: Properly endian notations

The SG descriptor of Riptide contains the little-endian values, hence
we need to define with __le32 properly.  This fixes sparse warnings
like:
  sound/pci/riptide/riptide.c:1112:40: warning: cast to restricted __le32

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Proper endian notations for BDL pointers
Takashi Iwai [Wed, 25 Jul 2018 21:24:03 +0000 (23:24 +0200)]
ALSA: hda: Proper endian notations for BDL pointers

The BDL pointer used in snd_hdac_dsp_prepare() should be declared as
__le32, as warned by sparse:
  sound/hda/hdac_stream.c:655:47: warning: incorrect type in argument 4 (different base types)
  sound/hda/hdac_stream.c:655:47:    expected restricted __le32 [usertype] **bdlp
  sound/hda/hdac_stream.c:655:47:    got unsigned int [usertype] **<noident>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: trident: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:02 +0000 (23:24 +0200)]
ALSA: trident: Proper endian notations

The TLB entries in Trident driver are represented in little-endian,
hence they should be declared as __le32.

This patch fixes the sparse warnings like:
  sound/pci/trident/trident_memory.c:226:17: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: ymfpci: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:01 +0000 (23:24 +0200)]
ALSA: ymfpci: Proper endian notations

The bank values are all little-endians, so they should be defined with
__le32.  This fixes lots of sparse warnings like:
  sound/pci/ymfpci/ymfpci_main.c:315:23: warning: cast to restricted __le32
  sound/pci/ymfpci/ymfpci_main.c:342:32: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits
Takashi Iwai [Wed, 25 Jul 2018 21:19:45 +0000 (23:19 +0200)]
ALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits

The open codes with the bit shift in xen_snd_front_alsa.c give sparse
warnings as the PCM format type is with __bitwise.
There is already a standard macro to get the format bits, so let's use
it instead.

This fixes sparse warnings like:
  sound/xen/xen_snd_front_alsa.c:191:47: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: sb: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:44 +0000 (23:19 +0200)]
ALSA: sb: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_sb_csp_autoload() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/sb/sb16_csp.c:743:22: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: sb: Fix PCM format bit calculation
Takashi Iwai [Wed, 25 Jul 2018 21:19:43 +0000 (23:19 +0200)]
ALSA: sb: Fix PCM format bit calculation

The PCM format type in snd_pcm_format_t can't be treated as integer
implicitly since it's with __bitwise.  We have already a helper
function to get the bit index of the given type, and use it in each
place instead.

This fixes sparse warnings like:
  sound/isa/sb/sb16_main.c:61:44: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: wss: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:42 +0000 (23:19 +0200)]
ALSA: wss: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_wss_get_format() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/wss/wss_lib.c:551:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: asihpi: Fix PCM format notations
Takashi Iwai [Wed, 25 Jul 2018 21:19:41 +0000 (23:19 +0200)]
ALSA: asihpi: Fix PCM format notations

asihpi driver treats -1 as an own invalid PCM format, but this needs
a proper cast with __force prefix since PCM format type is __bitwise.
Define a constant with the proper type and use it allover.

This fixes sparse warnings like:
  sound/pci/asihpi/asihpi.c:315:9: warning: incorrect type in initializer (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: au88x0: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:40 +0000 (23:19 +0200)]
ALSA: au88x0: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of vortex_alsafmt_aspfmt() with the proper snd_pcm_format_t
type.

This fixes the sparse warning like:
  sound/pci/au88x0/au88x0_core.c:2778:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: ad1816a: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:39 +0000 (23:19 +0200)]
ALSA: ad1816a: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_ad1816a_get_format() with the proper snd_pcm_format_t
type.

This fixes the sparse warning like:
  sound/isa/ad1816a/ad1816a_lib.c:93:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: pcm: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:38 +0000 (23:19 +0200)]
ALSA: pcm: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, hence it needs the explicit
cast with __force.  It's ugly, but there is a reason for that cost...

This fixes the sparse warning:
  sound/core/oss/pcm_oss.c:1854:55: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: riptide: Fix PCM format type conversion
Takashi Iwai [Wed, 25 Jul 2018 21:19:37 +0000 (23:19 +0200)]
ALSA: riptide: Fix PCM format type conversion

The PCM format type is with __bitwise, hence it needs to be explicitly
declared as snd_pcm_format_t, as warned by sparse:
  sound/pci/riptide/riptide.c:1028:34: warning: incorrect type in argument 1 (different base types)
  sound/pci/riptide/riptide.c:1028:34:    expected restricted snd_pcm_format_t [usertype] format
  sound/pci/riptide/riptide.c:1028:34:    got unsigned char [unsigned] format

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Fix implicit PCM format type conversion
Takashi Iwai [Wed, 25 Jul 2018 21:19:36 +0000 (23:19 +0200)]
ALSA: hda: Fix implicit PCM format type conversion

The PCM format type is defined with __bitwise, hence it can't be
passed as integer but needs an explicit cast.  In this patch, instead
of the messy cast flood, define the format argument of
snd_hdac_calc_stream_format() to be the proper snd_pcm_format_t type.

This fixes sparse warnings like:
  sound/hda/hdac_device.c:760:38: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: trident: Suppress gcc string warning
Takashi Iwai [Thu, 26 Jul 2018 12:58:03 +0000 (14:58 +0200)]
ALSA: trident: Suppress gcc string warning

The meddlesome gcc warns about the possible shortname string in
trident driver code:
  sound/pci/trident/trident.c: In function ‘snd_trident_probe’:
  sound/pci/trident/trident.c:126:2: warning: ‘strcat’ accessing 17 or more bytes at offsets 36 and 20 may overlap 1 byte at offset 36 [-Wrestrict]
  strcat(card->shortname, card->driver);

It happens since gcc calculates the possible string size from
card->driver, but this can't be true since we did set the string just
before that, and they are much shorter.

For shutting it up, use the exactly same string set to card->driver
for strcat() to card->shortname, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast
Takashi Iwai [Wed, 25 Jul 2018 21:00:57 +0000 (23:00 +0200)]
ALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast

The cast between user-space and kernel-space needs an explicit __force
prefix, but it's missing in many places in emu10k1 driver code.

Spotted by sparse as a warning like:
  sound/pci/emu10k1/emufx.c:529:33: warning: cast removes address space of expression

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: korg1212: Add __force annotation to cast in user-copy callbacks
Takashi Iwai [Wed, 25 Jul 2018 21:00:56 +0000 (23:00 +0200)]
ALSA: korg1212: Add __force annotation to cast in user-copy callbacks

The user-copy callbacks in korg1212 driver contain the explicit cast
from a user pointer to a kernel pointer, but they missed __force
prefix.  It's mandatory for converting between them.

Spotted by sparse, a warning like:
  sound/pci/korg1212/korg1212.c:1329:33: warning: cast removes address space of expression

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: pcm: Use standard lower_32_bits() and upper_32_bits()
Takashi Iwai [Wed, 25 Jul 2018 21:00:55 +0000 (23:00 +0200)]
ALSA: pcm: Use standard lower_32_bits() and upper_32_bits()

Instead of open codes, use the standard macros for obtaining the lower
and upper 32bit values.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
Takashi Iwai [Wed, 25 Jul 2018 21:00:54 +0000 (23:00 +0200)]
ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()

The snd_pcm_lib_read() and snd_pcm_lib_write() inline functions have
the explicit cast from a user pointer to a kernel pointer, but they
lacks of __force prefix.

This fixes sparse warnings like:
  ./include/sound/pcm.h:1093:47: warning: cast removes address space of expression

Fixes: 68541213720d ("ALSA: pcm: Direct in-kernel read/write support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: usb-audio: Declare the common variable in header file
Takashi Iwai [Wed, 25 Jul 2018 21:00:53 +0000 (23:00 +0200)]
ALSA: usb-audio: Declare the common variable in header file

Declare snd_usb_feature_unit_ctl properly in mixer.h.  Otherwise it's
error-prone.

This fixes the sparse warning:
  sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static?

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: opl3: Declare common variables properly
Takashi Iwai [Wed, 25 Jul 2018 21:00:52 +0000 (23:00 +0200)]
ALSA: opl3: Declare common variables properly

Move the declarations of common variables into opl3_voice.h instead of
declaring at each file multiple times, which was error-prone.

This fixes sparse warnings like:
  sound/drivers/opl3/opl3_synth.c:51:6: warning: symbol 'snd_opl3_regmap' was not declared. Should it be static?

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t
Takashi Iwai [Wed, 25 Jul 2018 21:00:51 +0000 (23:00 +0200)]
ALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t

The knew->iface field is in snd_ctl_elem_iface_t, which is with
__bitwise, hence it can't be converted implicitly from integer.
Give an explicit cast for the invalid type.

Spotted by sparse:
  sound/pci/hda/hda_codec.c:3280:25: warning: restricted snd_ctl_elem_iface_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: msnd: Use NULL instead of 0
Takashi Iwai [Wed, 25 Jul 2018 21:00:50 +0000 (23:00 +0200)]
ALSA: msnd: Use NULL instead of 0

Fix a sparse warning:
  sound/isa/msnd/msnd_pinnacle.c:813:1: warning: Using plain integer as NULL pointer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Use NULL instead of 0
Takashi Iwai [Wed, 25 Jul 2018 21:00:49 +0000 (23:00 +0200)]
ALSA: hda/ca0132 - Use NULL instead of 0

Use NULL for initializing the snd_kcontrol_new.tlv field, instead of
0, as warned by sparse:
  sound/pci/hda/patch_ca0132.c:5519:22: warning: Using plain integer as NULL pointer

Also, the driver does the same initialization twice, once for
knew.tlv.c and another for knew.tlv.p while both point to the same
address (these are union).  Drop the latter superfluous one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: msnd: Fix the default sample sizes
Takashi Iwai [Wed, 25 Jul 2018 21:00:48 +0000 (23:00 +0200)]
ALSA: msnd: Fix the default sample sizes

The default sample sizes set by msnd driver are bogus; it sets ALSA
PCM format, not the actual bit width.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: msnd: Add missing __iomem annotations
Takashi Iwai [Wed, 25 Jul 2018 21:00:47 +0000 (23:00 +0200)]
ALSA: msnd: Add missing __iomem annotations

The io-mapped buffers used in msnd drivers need __iomem annotations.

This fixes sparse warnings like:
  sound/isa/msnd/msnd_pinnacle.c:172:45: warning: incorrect type in initializer (different address spaces)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
Takashi Iwai [Wed, 25 Jul 2018 21:00:46 +0000 (23:00 +0200)]
ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro

AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
for expanding idVendor and idProduct fields.  However, the latter
macro adds also match_flags and bInterfaceClass, which are different
from the values AU0828_DEVICE() macro sets after that.

For fixing them, just expand idVendor and idProduct fields manually in
AU0828_DEVICE().

This fixes sparse warnings like:
  sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: usb-audio: Add support for Encore mDSD USB DAC
Jeff Crukley [Wed, 25 Jul 2018 19:05:01 +0000 (15:05 -0400)]
ALSA: usb-audio: Add support for Encore mDSD USB DAC

This patch adds native DSD playback support for the Encore mDSD USB DAC by
specifying the vendor and product ID's

Signed-off-by: Jeff Crukley <jcrukley@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/i915: Allow delayed i915 audio component binding
Takashi Iwai [Wed, 11 Jul 2018 13:05:06 +0000 (15:05 +0200)]
ALSA: hda/i915: Allow delayed i915 audio component binding

Currently HD-audio i915 audio binding doesn't support any delayed
binding, and supposes that the i915 driver registers the component
immediately.  This has been OK, so far, but the work-in-progress
change in i915 may introduce the asynchronous binding, which
effectively delays the component registration.

For addressing it, implement a completion to be synced with the master
binding.  The timeout is set to 10 seconds which should be long enough
and hopefully be not too annoying if anyone boots up a debugging
session with i915 KMS turned off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Generic DSD detection for Thesycon-based implementations
Yue Wang [Mon, 23 Jul 2018 08:56:46 +0000 (01:56 -0700)]
ALSA: usb-audio: Generic DSD detection for Thesycon-based implementations

Thesycon provides solutions to XMOS chips, and has its own device
vendor id.

In this patch, we use generic method to detect DSD capability of
Thesycon-based UAC2 implementations in order to support a wide range
of current and future devices.

The patch will enable the SNDRV_PCM_FMTBIT_DSD_U32_BE bit for the DAC
hence enable native DSD playback up to DSD512 format.

Signed-off-by: Yue Wang <yuleopen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: timer: catch invalid timer object creation
Srikanth K H [Fri, 20 Jul 2018 05:43:51 +0000 (11:13 +0530)]
ALSA: timer: catch invalid timer object creation

A timer object for the classes SNDRV_TIMER_CLASS_CARD and
SNDRV_TIMER_CLASS_PCM has to be associated with a card object, but we
have no check at creation time.  Such a timer object with NULL card
causes various unexpected problems, e.g. NULL dereference at reading
the sound timer proc file.

So as preventive measure while the creating the sound timer object is
created the card information availability is checked for the mentioned
entries and returned error if its NULL.

Signed-off-by: Srikanth K H <srikanth.h@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'topic/drm_audio_component' into for-next
Takashi Iwai [Thu, 19 Jul 2018 18:48:06 +0000 (20:48 +0200)]
Merge branch 'topic/drm_audio_component' into for-next

Pull the generic drm_audio_component support, which will be used later
for AMD/ATI and other HD-audio HDMI codec drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Allow changing from a bad sample rate
Adam Goode [Wed, 18 Jul 2018 20:41:05 +0000 (16:41 -0400)]
ALSA: usb-audio: Allow changing from a bad sample rate

If the audio device is externally clocked and set to a rate that does
not match the external clock, the clock will never be valid and we cannot
set the rate successfully. To fix this, allow a rate change even if
the clock is initially invalid, and validate again after the rate is
changed.

This fixes problems with MOTU UltraLite AVB hardware over USB.

Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'topic/vga_switcheroo' into for-next
Takashi Iwai [Wed, 18 Jul 2018 15:42:34 +0000 (17:42 +0200)]
Merge branch 'topic/vga_switcheroo' into for-next

Pull the vga_switcheroo audio client fix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()
Takashi Iwai [Wed, 18 Jul 2018 05:40:53 +0000 (07:40 +0200)]
ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()

snd_pcm_lib_mmap_vmalloc() was supposed to be implemented with
somewhat special for vmalloc handling, but in the end, this turned to
just the default handler, i.e. NULL.  As the situation has never
changed over decades, let's rip it off.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: rawmidi: Use kvmalloc() for buffers
Takashi Iwai [Tue, 17 Jul 2018 21:12:33 +0000 (23:12 +0200)]
ALSA: rawmidi: Use kvmalloc() for buffers

The size of in-kernel rawmidi buffers may be big up to 1MB, and it can
be specified freely by user-space; which implies that user-space may
trigger kmalloc() errors frequently.

This patch replaces the buffer allocation via kvmalloc() for dealing
with bigger buffers gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: rawmidi: Minor code refactoring
Takashi Iwai [Tue, 17 Jul 2018 21:07:29 +0000 (23:07 +0200)]
ALSA: rawmidi: Minor code refactoring

Unify a few open codes with helper functions to improve the
readability.  Minor behavior changes (rather fixes) are:
- runtime->drain clearance is done within lock
- active_sensing is updated before resizing buffer in
  SNDRV_RAWMIDI_IOCTL_PARAMS ioctl.
Other than that, simply code cleanups.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: rawmidi: Simplify error paths
Takashi Iwai [Tue, 17 Jul 2018 20:45:50 +0000 (22:45 +0200)]
ALSA: rawmidi: Simplify error paths

Apply the standard idiom: rewrite the multiple unlocks in error paths
in the goto-error-and-single-unlock way.

Just a code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: rawmidi: Tidy up coding styles
Takashi Iwai [Tue, 17 Jul 2018 20:32:52 +0000 (22:32 +0200)]
ALSA: rawmidi: Tidy up coding styles

Just minor coding style fixes like removal of superfluous white space,
adding missing blank lines, etc.  No actual code changes at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Tue, 17 Jul 2018 20:26:54 +0000 (22:26 +0200)]
Merge branch 'for-linus' into for-next

Back-merge for further cleanup / improvements on rawmidi and HD-audio
stuff.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Make audio component support more generic
Takashi Iwai [Wed, 11 Jul 2018 14:23:16 +0000 (16:23 +0200)]
ALSA: hda: Make audio component support more generic

This is the final step for more generic support of DRM audio
component.  The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively.  The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.

Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively.  All these are optional,
but used in i915 implementation and also other later implementations.

A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init().  The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error.  Meanwhile the new function doesn't
synchronize but just leaves as is.  It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.

v1->v2: Fix missing NULL check in master_bind/unbind

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/i915: Associate audio component with devres
Takashi Iwai [Wed, 11 Jul 2018 13:48:18 +0000 (15:48 +0200)]
ALSA: hda/i915: Associate audio component with devres

The HD-audio i915 binding code contains a single pointer, hdac_acomp,
for allowing the access to audio component from the master bind/unbind
callbacks.  This was needed because the callbacks pass only the device
pointer and we can't guarantee the object type assigned to the drvdata
(which is free for each controller driver implementation).
And this implementation will be a problem if we support multiple
components for different DRM drivers, not only i915.

As a solution, allocate the audio component object via devres and
associate it with the given device, so that the component callbacks
can refer to it via devres_find().

The removal of the object is still done half-manually via
devres_destroy() to make the code consistent (although it may work
without the explicit call).

Also, the snd_hda_i915_register_notifier() had the reference to
hdac_acomp as well.  In this patch, the corresponding code is removed
by passing hdac_bus object to the function, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agodrm/i915: Split audio component to a generic type
Takashi Iwai [Wed, 11 Jul 2018 13:17:22 +0000 (15:17 +0200)]
drm/i915: Split audio component to a generic type

For allowing other drivers to use the DRM audio component, rename the
i915_audio_component_* with drm_audio_component_*, and split the
generic part into drm_audio_component.h.  The i915 specific stuff
remains in struct i915_audio_component, which contains
drm_audio_component as the base.

The license of drm_audio_component.h is kept to MIT as same as the the
original i915_component.h.

This is a preliminary change for further development, and no
functional changes by this patch itself, merely code-split and
renames.

v1->v2: Use SPDX for drm_audio_component.h, fix remaining i915
        argument in drm_audio_component.h

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: rawmidi: Change resized buffers atomically
Takashi Iwai [Tue, 17 Jul 2018 15:26:43 +0000 (17:26 +0200)]
ALSA: rawmidi: Change resized buffers atomically

The SNDRV_RAWMIDI_IOCTL_PARAMS ioctl may resize the buffers and the
current code is racy.  For example, the sequencer client may write to
buffer while it being resized.

As a simple workaround, let's switch to the resized buffer inside the
stream runtime lock.

Reported-by: syzbot+52f83f0ea8df16932f7f@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu8000: Use swap macro in snd_emu8000_sample_new
Gustavo A. R. Silva [Tue, 17 Jul 2018 15:06:10 +0000 (10:06 -0500)]
ALSA: emu8000: Use swap macro in snd_emu8000_sample_new

Make use of the swap macro and remove unnecessary variable *tmp*. This
makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu10k1_patch: Use swap macro in snd_emu10k1_sample_new
Gustavo A. R. Silva [Tue, 17 Jul 2018 15:00:43 +0000 (10:00 -0500)]
ALSA: emu10k1_patch: Use swap macro in snd_emu10k1_sample_new

Make use of the swap macro and remove unnecessary variable *tmp*. This
makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agovga_switcheroo: set audio client id according to bound GPU id
Jim Qu [Tue, 17 Jul 2018 08:20:50 +0000 (16:20 +0800)]
vga_switcheroo: set audio client id according to bound GPU id

On modern laptop, there are more and more platforms
have two GPUs, and each of them maybe have audio codec
for HDMP/DP output. For some dGPU which is no output,
audio codec usually is disabled.

In currect HDA audio driver, it will set all codec as
VGA_SWITCHEROO_DIS, the audio which is binded to UMA
will be suspended if user use debugfs to contorl power

In HDA driver side, it is difficult to know which GPU
the audio has binded to. So set the bound gpu pci dev
to vga_switcheroo.

if the audio client is not the third registration, audio
id will set in vga_switcheroo enable function. if the
audio client is the last registration when vga_switcheroo
_ready() get true, we should get audio client id from bound
GPU directly.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/realtek - Add Panasonic CF-SZ6 headset jack quirk
YOKOTA Hiroshi [Sun, 1 Jul 2018 09:30:01 +0000 (18:30 +0900)]
ALSA: hda/realtek - Add Panasonic CF-SZ6 headset jack quirk

This adds some required quirk when uses headset or headphone on
Panasonic CF-SZ6.

Signed-off-by: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: add mute led support for HP ProBook 455 G5
Po-Hsu Lin [Mon, 16 Jul 2018 07:50:08 +0000 (15:50 +0800)]
ALSA: hda: add mute led support for HP ProBook 455 G5

Audio mute led does not work on HP ProBook 455 G5,
this can be fixed by using CXT_FIXUP_MUTE_LED_GPIO to support it.

BugLink: https://bugs.launchpad.net/bugs/1781763
Reported-by: James Buren
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: use PCI_BASE_CLASS_DISPLAY to replace PCI_CLASS_DISPLAY_VGA
Jim Qu [Mon, 16 Jul 2018 06:06:34 +0000 (14:06 +0800)]
ALSA: hda: use PCI_BASE_CLASS_DISPLAY to replace PCI_CLASS_DISPLAY_VGA

Except PCI_CLASS_DISPLAY_VGA, some PCI class is sometimes
PCI_CLASS_DISPLAY_3D or PCI_CLASS_DISPLAY_OTHER.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Tidy up logic for Processing Unit min/max values
Jorge Sanjuan [Wed, 11 Jul 2018 12:37:55 +0000 (13:37 +0100)]
ALSA: usb-audio: Tidy up logic for Processing Unit min/max values

This patch refactors the processing units min/max calculation logic
for the mixer controls and fixes an issue where the Mode Select
checking of the Up/Down mixers doesn't differentiate between the
UAC1 and UAC2 Control Selector (0x02) and the UAC3 one which is
different (0x01).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Unify virtual type units type to UAC3 values
Jorge Sanjuan [Wed, 11 Jul 2018 12:37:54 +0000 (13:37 +0100)]
ALSA: usb-audio: Unify virtual type units type to UAC3 values

The Audio Control interface descriptor subtypes do not match
across all the UAC versions. That makes reusability of the
"virtual type" (Mixer, Processors, Selectors, etc) terminals
difficult. It also makes the mixer get the default names for
the virtual terminals wrong due to the overlap.

This patch proposes an unified approach by always using the most
comprehensive spec version to define them all (in this case UAC3).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add support for Processing Units in UAC3
Jorge Sanjuan [Wed, 11 Jul 2018 12:37:53 +0000 (13:37 +0100)]
ALSA: usb-audio: Add support for Processing Units in UAC3

This patch adds support for the Processig Units defined in
the UAC3 spec. The main difference with the previous specs
is the lack of on/off switches in the controls for these
units and the addiction of the new Multi Function Processing
Unit.

The current version of the UAC3 spec doesn't define any
useful controls for the new Multi Function Processing Unit
so no control will get created once this unit is parsed.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Processing Unit controls parsing in UAC2
Jorge Sanjuan [Wed, 11 Jul 2018 12:37:52 +0000 (13:37 +0100)]
ALSA: usb-audio: Processing Unit controls parsing in UAC2

Current support for UAC2 Processing Units does the parsing
as one control per bit in the bitmap. However, the UAC2 spec
defines the controls as bit pairs where b01 means read-only
and b11 means read/write control.

This patch fixes that and uses the helper functions for checking
controls readability/writability when the control is defined as
bit pairs (UAC2 and UAC3).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add support for Selector Units in UAC3
Jorge Sanjuan [Wed, 11 Jul 2018 12:37:51 +0000 (13:37 +0100)]
ALSA: usb-audio: Add support for Selector Units in UAC3

This patch add support for Selector Units and Clock Selector Units
defined in the new UAC3 spec.

Selector Units play a really important role in the new UAC3 spec as
Processing Units do not define an on/off switch control anymore.
This forces topology designers to add bypass paths in the topology
to enable/dissable the Processing Units.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: cs46xx: remove redundant pointer 'ins'
Colin Ian King [Mon, 16 Jul 2018 09:03:15 +0000 (10:03 +0100)]
ALSA: cs46xx: remove redundant pointer 'ins'

Pointer 'ins' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'ins' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: ali5451: remove redundant pointer 'codec'
Colin Ian King [Mon, 16 Jul 2018 08:57:38 +0000 (09:57 +0100)]
ALSA: ali5451: remove redundant pointer 'codec'

Pointer 'codec' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'codec' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sb8: remove redundant pointer runtime
Colin Ian King [Mon, 16 Jul 2018 08:52:56 +0000 (09:52 +0100)]
ALSA: sb8: remove redundant pointer runtime

Pointer runtime is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'runtime' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: gus: remove redundant pointer private_data
Colin Ian King [Mon, 16 Jul 2018 08:49:38 +0000 (09:49 +0100)]
ALSA: gus: remove redundant pointer private_data

Pointer private_data is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'private_data' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: es1688: remove redundant pointer chip
Colin Ian King [Mon, 16 Jul 2018 08:43:08 +0000 (09:43 +0100)]
ALSA: es1688: remove redundant pointer chip

Pointer chip is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'chip' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: opl3: remove redundant pointer opl3
Colin Ian King [Mon, 16 Jul 2018 08:34:51 +0000 (09:34 +0100)]
ALSA: opl3: remove redundant pointer opl3

Variable opl3 is being assigned but is never used hence it is
redundant and can be removed.

Cleans up several clang warnings:
warning: variable 'opl3' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoLinux 4.18-rc5 v4.18-rc5
Linus Torvalds [Sun, 15 Jul 2018 19:49:31 +0000 (12:49 -0700)]
Linux 4.18-rc5

6 years agoMerge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Linus Torvalds [Sun, 15 Jul 2018 16:49:21 +0000 (09:49 -0700)]
Merge tag 'armsoc-fixes' of git://git./linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Olof Johansson:

 - A fix for OMAP5 and DRA7 to make the branch predictor hardening
   settings take proper effect on secondary cores

 - Disable USB OTG on am3517 since current driver isn't working

 - Fix thermal sensor register settings on Armada 38x

 - Fix suspend/resume IRQs on pxa3xx

* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  ARM: dts: am3517.dtsi:  Disable reference to OMAP3 OTG controller
  ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores
  ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
  ARM: dts: armada-38x: use the new thermal binding

6 years agoMerge tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni...
Linus Torvalds [Sat, 14 Jul 2018 23:15:19 +0000 (16:15 -0700)]
Merge tag 'rtc-4.18-2' of git://git./linux/kernel/git/abelloni/linux

Pull RTC fixes from Alexandre Belloni:
 "Two fixes for 4.18:

   - an important core fix for RTCs using the core offsetting only one
     driver is affected

   - a fix for the error path of mrst"

* tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
  rtc: fix alarm read and set offset
  rtc: mrst: fix error code in probe()

6 years agoMerge tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux...
Olof Johansson [Sat, 14 Jul 2018 22:14:02 +0000 (15:14 -0700)]
Merge tag 'omap-for-v4.18/fixes-rc4-signed' of git://git./linux/kernel/git/tmlind/linux-omap into fixes

Two omap fixes for v4.18-rc cycle

Turns out the recent patches for ARM branch predictor hardening are
not working on omap5 and dra7 as planned because the secondary CPU
is parked to the bootrom code. We can't configure it in the bootloader.
So we must enable invalidates of BTB for omap5 and dra7 secondary
core in the kernel.

And there's a fix for reserved register access for am3517. The
usb otg module on am3517 is not the same as for other omap3.

* tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: dts: am3517.dtsi:  Disable reference to OMAP3 OTG controller
  ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores

Signed-off-by: Olof Johansson <olof@lixom.net>
6 years agoMerge tag 'mvebu-fixes-4.18-1' of git://git.infradead.org/linux-mvebu into fixes
Olof Johansson [Sat, 14 Jul 2018 22:12:24 +0000 (15:12 -0700)]
Merge tag 'mvebu-fixes-4.18-1' of git://git.infradead.org/linux-mvebu into fixes

mvebu fixes for 4.18 (part 1)

Use the new thermal binding on Armada 38x allowing to use a driver fix
which is already part of the kernel.

* tag 'mvebu-fixes-4.18-1' of git://git.infradead.org/linux-mvebu:
  ARM: dts: armada-38x: use the new thermal binding

Signed-off-by: Olof Johansson <olof@lixom.net>
6 years agoMerge tag 'pxa-fixes-4.18' of https://github.com/rjarzmik/linux into fixes
Olof Johansson [Sat, 14 Jul 2018 22:11:41 +0000 (15:11 -0700)]
Merge tag 'pxa-fixes-4.18' of https://github.com/rjarzmik/linux into fixes

This is the fixes set for v4.18 cycle.

This is a fix for suspending all pxa3xx platforms, where high
number interrupts are not reenabled.

* tag 'pxa-fixes-4.18' of https://github.com/rjarzmik/linux:
  ARM: pxa: irq: fix handling of ICMR registers in suspend/resume

Signed-off-by: Olof Johansson <olof@lixom.net>
6 years agoMerge tag 'for-linus-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 14 Jul 2018 19:30:13 +0000 (12:30 -0700)]
Merge tag 'for-linus-4.18-rc5-tag' of git://git./linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
 "Two related fixes for a boot failure of Xen PV guests"

* tag 'for-linus-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen: setup pv irq ops vector earlier
  xen: remove global bit from __default_kernel_pte_mask for pv guests

6 years agoMerge tag 'for-linus-20180713' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 14 Jul 2018 19:28:00 +0000 (12:28 -0700)]
Merge tag 'for-linus-20180713' of git://git.kernel.dk/linux-block

Pull block fix from Jens Axboe:
 "Just a single regression fix (from 4.17) for bsg, fixing an EINVAL
  return on non-data commands"

* tag 'for-linus-20180713' of git://git.kernel.dk/linux-block:
  bsg: fix bogus EINVAL on non-data commands

6 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Sat, 14 Jul 2018 18:14:33 +0000 (11:14 -0700)]
Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "11 fixes"

* emailed patches form Andrew Morton <akpm@linux-foundation.org>:
  reiserfs: fix buffer overflow with long warning messages
  checkpatch: fix duplicate invalid vsprintf pointer extension '%p<foo>' messages
  mm: do not bug_on on incorrect length in __mm_populate()
  mm/memblock.c: do not complain about top-down allocations for !MEMORY_HOTREMOVE
  fs, elf: make sure to page align bss in load_elf_library
  x86/purgatory: add missing FORCE to Makefile target
  net/9p/client.c: put refcount of trans_mod in error case in parse_opts()
  mm: allow arch to supply p??_free_tlb functions
  autofs: fix slab out of bounds read in getname_kernel()
  fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*
  mm: do not drop unused pages when userfaultd is running

6 years agoreiserfs: fix buffer overflow with long warning messages
Eric Biggers [Fri, 13 Jul 2018 23:59:27 +0000 (16:59 -0700)]
reiserfs: fix buffer overflow with long warning messages

ReiserFS prepares log messages into a 1024-byte buffer with no bounds
checks.  Long messages, such as the "unknown mount option" warning when
userspace passes a crafted mount options string, overflow this buffer.
This causes KASAN to report a global-out-of-bounds write.

Fix it by truncating messages to the buffer size.

Link: http://lkml.kernel.org/r/20180707203621.30922-1-ebiggers3@gmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+b890b3335a4d8c608963@syzkaller.appspotmail.com
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agocheckpatch: fix duplicate invalid vsprintf pointer extension '%p<foo>' messages
Joe Perches [Fri, 13 Jul 2018 23:59:23 +0000 (16:59 -0700)]
checkpatch: fix duplicate invalid vsprintf pointer extension '%p<foo>' messages

Multiline statements with invalid %p<foo> uses produce multiple
warnings.  Fix that.

e.g.:

$ cat t_block.c
void foo(void)
{
MY_DEBUG(drv->foo,
 "%pk",
 foo->boo);
}

$ ./scripts/checkpatch.pl -f t_block.c
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: t_block.c:1:
+void foo(void)

WARNING: Invalid vsprintf pointer extension '%pk'
#3: FILE: t_block.c:3:
+ MY_DEBUG(drv->foo,
+  "%pk",
+  foo->boo);

WARNING: Invalid vsprintf pointer extension '%pk'
#3: FILE: t_block.c:3:
+ MY_DEBUG(drv->foo,
+  "%pk",
+  foo->boo);

total: 0 errors, 3 warnings, 6 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

t_block.c has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Link: http://lkml.kernel.org/r/9e8341bbe4c9877d159cb512bb701043cbfbb10b.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Tobin C. Harding" <me@tobin.cc>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agomm: do not bug_on on incorrect length in __mm_populate()
Michal Hocko [Fri, 13 Jul 2018 23:59:20 +0000 (16:59 -0700)]
mm: do not bug_on on incorrect length in __mm_populate()

syzbot has noticed that a specially crafted library can easily hit
VM_BUG_ON in __mm_populate

  kernel BUG at mm/gup.c:1242!
  invalid opcode: 0000 [#1] SMP
  CPU: 2 PID: 9667 Comm: a.out Not tainted 4.18.0-rc3 #644
  Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
  RIP: 0010:__mm_populate+0x1e2/0x1f0
  Code: 55 d0 65 48 33 14 25 28 00 00 00 89 d8 75 21 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 75 18 f1 ff 0f 0b e8 6e 18 f1 ff <0f> 0b 31 db eb c9 e8 93 06 e0 ff 0f 1f 00 55 48 89 e5 53 48 89 fb
  Call Trace:
     vm_brk_flags+0xc3/0x100
     vm_brk+0x1f/0x30
     load_elf_library+0x281/0x2e0
     __ia32_sys_uselib+0x170/0x1e0
     do_fast_syscall_32+0xca/0x420
     entry_SYSENTER_compat+0x70/0x7f

The reason is that the length of the new brk is not page aligned when we
try to populate the it.  There is no reason to bug on that though.
do_brk_flags already aligns the length properly so the mapping is
expanded as it should.  All we need is to tell mm_populate about it.
Besides that there is absolutely no reason to to bug_on in the first
place.  The worst thing that could happen is that the last page wouldn't
get populated and that is far from putting system into an inconsistent
state.

Fix the issue by moving the length sanitization code from do_brk_flags
up to vm_brk_flags.  The only other caller of do_brk_flags is brk
syscall entry and it makes sure to provide the proper length so t here
is no need for sanitation and so we can use do_brk_flags without it.

Also remove the bogus BUG_ONs.

[osalvador@techadventures.net: fix up vm_brk_flags s@request@len@]
Link: http://lkml.kernel.org/r/20180706090217.GI32658@dhcp22.suse.cz
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reported-by: syzbot <syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com>
Tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Zi Yan <zi.yan@cs.rutgers.edu>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agomm/memblock.c: do not complain about top-down allocations for !MEMORY_HOTREMOVE
Michal Hocko [Fri, 13 Jul 2018 23:59:16 +0000 (16:59 -0700)]
mm/memblock.c: do not complain about top-down allocations for !MEMORY_HOTREMOVE

Mike Rapoport is converting architectures from bootmem to nobootmem
allocator.  While doing so for m68k Geert has noticed that he gets a
scary looking warning:

  WARNING: CPU: 0 PID: 0 at mm/memblock.c:230
  memblock_find_in_range_node+0x11c/0x1be
  memblock: bottom-up allocation failed, memory hotunplug may be affected
  Modules linked in:
  CPU: 0 PID: 0 Comm: swapper Not tainted
  4.18.0-rc3-atari-01343-gf2fb5f2e09a97a3c-dirty #7
  Call Trace: __warn+0xa8/0xc2
    kernel_pg_dir+0x0/0x1000
    netdev_lower_get_next+0x2/0x22
    warn_slowpath_fmt+0x2e/0x36
    memblock_find_in_range_node+0x11c/0x1be
    memblock_find_in_range_node+0x11c/0x1be
    memblock_find_in_range_node+0x0/0x1be
    vprintk_func+0x66/0x6e
    memblock_virt_alloc_internal+0xd0/0x156
    netdev_lower_get_next+0x2/0x22
    netdev_lower_get_next+0x2/0x22
    kernel_pg_dir+0x0/0x1000
    memblock_virt_alloc_try_nid_nopanic+0x58/0x7a
    netdev_lower_get_next+0x2/0x22
    kernel_pg_dir+0x0/0x1000
    kernel_pg_dir+0x0/0x1000
    EXPTBL+0x234/0x400
    EXPTBL+0x234/0x400
    alloc_node_mem_map+0x4a/0x66
    netdev_lower_get_next+0x2/0x22
    free_area_init_node+0xe2/0x29e
    EXPTBL+0x234/0x400
    paging_init+0x430/0x462
    kernel_pg_dir+0x0/0x1000
    printk+0x0/0x1a
    EXPTBL+0x234/0x400
    setup_arch+0x1b8/0x22c
    start_kernel+0x4a/0x40a
    _sinittext+0x344/0x9e8

The warning is basically saying that a top-down allocation can break
memory hotremove because memblock allocation is not movable.  But m68k
doesn't even support MEMORY_HOTREMOVE so there is no point to warn about
it.

Make the warning conditional only to configurations that care.

Link: http://lkml.kernel.org/r/20180706061750.GH32658@dhcp22.suse.cz
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: Sam Creasey <sammy@sammy.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agofs, elf: make sure to page align bss in load_elf_library
Oscar Salvador [Fri, 13 Jul 2018 23:59:13 +0000 (16:59 -0700)]
fs, elf: make sure to page align bss in load_elf_library

The current code does not make sure to page align bss before calling
vm_brk(), and this can lead to a VM_BUG_ON() in __mm_populate() due to
the requested lenght not being correctly aligned.

Let us make sure to align it properly.

Kees: only applicable to CONFIG_USELIB kernels: 32-bit and configured
for libc5.

Link: http://lkml.kernel.org/r/20180705145539.9627-1-osalvador@techadventures.net
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reported-by: syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com
Tested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agox86/purgatory: add missing FORCE to Makefile target
Philipp Rudo [Fri, 13 Jul 2018 23:59:09 +0000 (16:59 -0700)]
x86/purgatory: add missing FORCE to Makefile target

- Build the kernel without the fix
- Add some flag to the purgatories KBUILD_CFLAGS,I used
  -fno-asynchronous-unwind-tables
- Re-build the kernel

When you look at makes output you see that sha256.o is not re-build in the
last step.  Also readelf -S still shows the .eh_frame section for
sha256.o.

With the fix sha256.o is rebuilt in the last step.

Without FORCE make does not detect changes only made to the command line
options.  So object files might not be re-built even when they should be.
Fix this by adding FORCE where it is missing.

Link: http://lkml.kernel.org/r/20180704110044.29279-2-prudo@linux.ibm.com
Fixes: df6f2801f511 ("kernel/kexec_file.c: move purgatories sha256 to common code")
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@vger.kernel.org> [4.17+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agonet/9p/client.c: put refcount of trans_mod in error case in parse_opts()
piaojun [Fri, 13 Jul 2018 23:59:06 +0000 (16:59 -0700)]
net/9p/client.c: put refcount of trans_mod in error case in parse_opts()

In my testing, the second mount will fail after umounting successfully.
The reason is that we put refcount of trans_mod in the correct case
rather than the error case in parse_opts() at last.  That will cause the
refcount decrease to -1, and when we try to get trans_mod again in
try_module_get(), we could only increase refcount to 0 which will cause
failure as follows:

parse_opts
  v9fs_get_trans_by_name
    try_module_get : return NULL to caller which cause error

So we should put refcount of trans_mod in error case.

Link: http://lkml.kernel.org/r/5B3F39A0.2030509@huawei.com
Fixes: 9421c3e64137ec ("net/9p/client.c: fix potential refcnt problem of trans module")
Signed-off-by: Jun Piao <piaojun@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Dominique Martinet <dominique.martinet@cea.fr>
Tested-by: Dominique Martinet <dominique.martinet@cea.fr>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agomm: allow arch to supply p??_free_tlb functions
Nicholas Piggin [Fri, 13 Jul 2018 23:59:03 +0000 (16:59 -0700)]
mm: allow arch to supply p??_free_tlb functions

The mmu_gather APIs keep track of the invalidated address range
including the span covered by invalidated page table pages.  Ranges
covered by page tables but not ptes (and therefore no TLBs) still need
to be invalidated because some architectures (x86) can cache
intermediate page table entries, and invalidate those with normal TLB
invalidation instructions to be almost-backward-compatible.

Architectures which don't cache intermediate page table entries, or
which invalidate these caches separately from TLB invalidation, do not
require TLB invalidation range expanded over page tables.

Allow architectures to supply their own p??_free_tlb functions, which
can avoid the __tlb_adjust_range.

Link: http://lkml.kernel.org/r/20180703013131.2807-1-npiggin@gmail.com
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoautofs: fix slab out of bounds read in getname_kernel()
Tomas Bortoli [Fri, 13 Jul 2018 23:58:59 +0000 (16:58 -0700)]
autofs: fix slab out of bounds read in getname_kernel()

The autofs subsystem does not check that the "path" parameter is present
for all cases where it is required when it is passed in via the "param"
struct.

In particular it isn't checked for the AUTOFS_DEV_IOCTL_OPENMOUNT_CMD
ioctl command.

To solve it, modify validate_dev_ioctl(function to check that a path has
been provided for ioctl commands that require it.

Link: http://lkml.kernel.org/r/153060031527.26631.18306637892746301555.stgit@pluto.themaw.net
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Signed-off-by: Ian Kent <raven@themaw.net>
Reported-by: syzbot+60c837b428dc84e83a93@syzkaller.appspotmail.com
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agofs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*
Vlastimil Babka [Fri, 13 Jul 2018 23:58:56 +0000 (16:58 -0700)]
fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*

Thomas reports:
 "While looking around in /proc on my v4.14.52 system I noticed that all
  processes got a lot of "Locked" memory in /proc/*/smaps. A lot more
  memory than a regular user can usually lock with mlock().

  Commit 493b0e9d945f (in v4.14-rc1) seems to have changed the behavior
  of "Locked".

  Before that commit the code was like this. Notice the VM_LOCKED check.

           (vma->vm_flags & VM_LOCKED) ?
                (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);

  After that commit Locked is now the same as Pss:

  (unsigned long)(mss->pss >> (10 + PSS_SHIFT)));

  This looks like a mistake."

Indeed, the commit has added mss->pss_locked with the correct value that
depends on VM_LOCKED, but forgot to actually use it.  Fix it.

Link: http://lkml.kernel.org/r/ebf6c7fb-fec3-6a26-544f-710ed193c154@suse.cz
Fixes: 493b0e9d945f ("mm: add /proc/pid/smaps_rollup")
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Daniel Colascione <dancol@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agomm: do not drop unused pages when userfaultd is running
Christian Borntraeger [Fri, 13 Jul 2018 23:58:52 +0000 (16:58 -0700)]
mm: do not drop unused pages when userfaultd is running

KVM guests on s390 can notify the host of unused pages.  This can result
in pte_unused callbacks to be true for KVM guest memory.

If a page is unused (checked with pte_unused) we might drop this page
instead of paging it.  This can have side-effects on userfaultd, when
the page in question was already migrated:

The next access of that page will trigger a fault and a user fault
instead of faulting in a new and empty zero page.  As QEMU does not
expect a userfault on an already migrated page this migration will fail.

The most straightforward solution is to ignore the pte_unused hint if a
userfault context is active for this VMA.

Link: http://lkml.kernel.org/r/20180703171854.63981-1-borntraeger@de.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agomm: zero unavailable pages before memmap init
Pavel Tatashin [Sat, 14 Jul 2018 13:15:07 +0000 (09:15 -0400)]
mm: zero unavailable pages before memmap init

We must zero struct pages for memory that is not backed by physical
memory, or kernel does not have access to.

Recently, there was a change which zeroed all memmap for all holes in
e820.  Unfortunately, it introduced a bug that is discussed here:

  https://www.spinics.net/lists/linux-mm/msg156764.html

Linus, also saw this bug on his machine, and confirmed that reverting
commit 124049decbb1 ("x86/e820: put !E820_TYPE_RAM regions into
memblock.reserved") fixes the issue.

The problem is that we incorrectly zero some struct pages after they
were setup.

The fix is to zero unavailable struct pages prior to initializing of
struct pages.

A more detailed fix should come later that would avoid double zeroing
cases: one in __init_single_page(), the other one in
zero_resv_unavail().

Fixes: 124049decbb1 ("x86/e820: put !E820_TYPE_RAM regions into memblock.reserved")
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Fri, 13 Jul 2018 22:34:29 +0000 (15:34 -0700)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:

 - I2C core bugfix regarding bus recovery

 - driver bugfix for the tegra driver

 - typo correction

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: recovery: if possible send STOP with recovery pulses
  i2c: tegra: Fix NACK error handling
  i2c: stu300: use non-archaic spelling of failes

6 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 13 Jul 2018 20:36:36 +0000 (13:36 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull timer fixes from Ingo Molnar:
 "A clocksource driver fix and a revert"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource: arm_arch_timer: Set arch_mem_timer cpumask to cpu_possible_mask
  Revert "tick: Prefer a lower rating device only if it's CPU local device"

6 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 13 Jul 2018 20:33:09 +0000 (13:33 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf tool fixes from Ingo Molnar:
 "Misc tooling fixes: python3 related fixes, gcc8 fix, bashism fixes and
  some other smaller fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Use python-config --includes rather than --cflags
  perf script python: Fix dict reference counting
  perf stat: Fix --interval_clear option
  perf tools: Fix compilation errors on gcc8
  perf test shell: Prevent temporary editor files from being considered test scripts
  perf llvm-utils: Remove bashism from kernel include fetch script
  perf test shell: Make perf's inet_pton test more portable
  perf test shell: Replace '|&' with '2>&1 |' to work with more shells
  perf scripts python: Add Python 3 support to EventClass.py
  perf scripts python: Add Python 3 support to sched-migration.py
  perf scripts python: Add Python 3 support to Util.py
  perf scripts python: Add Python 3 support to SchedGui.py
  perf scripts python: Add Python 3 support to Core.py
  perf tools: Generate a Python script compatible with Python 2 and 3

6 years agoMerge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 13 Jul 2018 20:30:21 +0000 (13:30 -0700)]
Merge branch 'efi-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull EFI fix from Ingo Molnar:
 "Fix a UEFI mixed mode (64-bit kernel on 32-bit UEFI) reboot loop
  regression"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi/x86: Fix mixed mode reboot loop by removing pointless call to PciIo->Attributes()

6 years agoMerge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 13 Jul 2018 19:50:42 +0000 (12:50 -0700)]
Merge branch 'core-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull rseq fixes from Ingo Molnar:
 "Various rseq ABI fixes and cleanups: use get_user()/put_user(),
  validate parameters and use proper uapi types, etc"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  rseq/selftests: cleanup: Update comment above rseq_prepare_unload
  rseq: Remove unused types_32_64.h uapi header
  rseq: uapi: Declare rseq_cs field as union, update includes
  rseq: uapi: Update uapi comments
  rseq: Use get_user/put_user rather than __get_user/__put_user
  rseq: Use __u64 for rseq_cs fields, validate user inputs

6 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Linus Torvalds [Fri, 13 Jul 2018 19:42:14 +0000 (12:42 -0700)]
Merge tag 'for-linus' of git://git./linux/kernel/git/rdma/rdma

Pull rdma fixes from Jason Gunthorpe:
 "Things have been quite slow, only 6 RC patches have been sent to the
  list. Regression, user visible bugs, and crashing fixes:

   - cxgb4 could wrongly fail MR creation due to a typo

   - various crashes if the wrong QP type is mixed in with APIs that
     expect other types

   - syzkaller oops

   - using ERR_PTR and NULL together cases HFI1 to crash in some cases

   - mlx5 memory leak in error unwind"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path
  RDMA/uverbs: Don't fail in creation of multiple flows
  IB/hfi1: Fix incorrect mixing of ERR_PTR and NULL return values
  RDMA/uverbs: Fix slab-out-of-bounds in ib_uverbs_ex_create_flow
  RDMA/uverbs: Protect from attempts to create flows on unsupported QP
  iw_cxgb4: correctly enforce the max reg_mr depth

6 years agoMerge tag 'vfio-v4.18-rc5' of git://github.com/awilliam/linux-vfio
Linus Torvalds [Fri, 13 Jul 2018 19:37:45 +0000 (12:37 -0700)]
Merge tag 'vfio-v4.18-rc5' of git://github.com/awilliam/linux-vfio

Pull VFIO fix from Alex Williamson:
 "Fix deadlock in mbochs sample driver (Alexey Khoroshilov)"

* tag 'vfio-v4.18-rc5' of git://github.com/awilliam/linux-vfio:
  sample: vfio-mdev: avoid deadlock in mdev_access()

6 years agoMerge tag 'kbuild-fixes-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 13 Jul 2018 19:15:12 +0000 (12:15 -0700)]
Merge tag 'kbuild-fixes-v4.18-2' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - update Kbuild and Kconfig documents

 - sanitize -I compiler option handling

 - update extract-vmlinux script to recognize LZ4 and ZSTD

 - fix tools Makefiles

 - update tags.sh to handle __ro_after_init

 - suppress warnings in case getconf does not recognize LFS_* parameters

* tag 'kbuild-fixes-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: suppress warnings from 'getconf LFS_*'
  scripts/tags.sh: add __ro_after_init
  tools: build: Use HOSTLDFLAGS with fixdep
  tools: build: Fixup host c flags
  tools build: fix # escaping in .cmd files for future Make
  scripts: teach extract-vmlinux about LZ4 and ZSTD
  kbuild: remove duplicated comments about PHONY
  kbuild: .PHONY is not a variable, but PHONY is
  kbuild: do not drop -I without parameter
  kbuild: document the KBUILD_KCONFIG env. variable
  kconfig: update user kconfig tools doc.
  kbuild: delete INSTALL_FW_PATH from kbuild documentation
  kbuild: update ARCH alias info for sparc
  kbuild: update ARCH alias info for sh

6 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Linus Torvalds [Fri, 13 Jul 2018 18:48:34 +0000 (11:48 -0700)]
Merge tag 'arm64-fixes' of git://git./linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
 "Catalin's out enjoying the sunshine, so I'm sending the fixes for a
  couple of weeks (although there hopefully won't be any more!).

  We've got a revert of a previous fix because it broke the build with
  some distro toolchains and a preemption fix when detemining whether or
  not the SIMD unit is in use.

  Summary:

   - Revert back to the 'linux' target for LD, as 'elf' breaks some
     distributions

   - Fix preemption race when testing whether the vector unit is in use
     or not"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: neon: Fix function may_use_simd() return error status
  Revert "arm64: Use aarch64elf and aarch64elfb emulation mode variants"

6 years agoMerge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Fri, 13 Jul 2018 18:44:12 +0000 (11:44 -0700)]
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:
 "A couple of small fixes this time around from Steven for an
  interaction between ftrace and kernel read-only protection, and
  Vladimir for nommu"

* 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 8780/1: ftrace: Only set kernel memory back to read-only after boot
  ARM: 8775/1: NOMMU: Use instr_sync instead of plain isb in common code

6 years agoMerge tag 'trace-v4.18-rc3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rosted...
Linus Torvalds [Fri, 13 Jul 2018 18:40:11 +0000 (11:40 -0700)]
Merge tag 'trace-v4.18-rc3-3' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fixlet from Steven Rostedt:
 "Joel Fernandes asked to add a feature in tracing that Android had its
  own patch internally for. I took it back in 4.13. Now he realizes that
  he had a mistake, and swapped the values from what Android had. This
  means that the old Android tools will break when using a new kernel
  that has the new feature on it.

  The options are:

   1. To swap it back to what Android wants.
   2. Add a command line option or something to do the swap
   3. Just let Android carry a patch that swaps it back

  Since it requires setting a tracing option to enable this anyway, I
  doubt there are other users of this than Android. Thus, I've decided
  to take option 1. If someone else is actually depending on the order
  that is in the kernel, then we will have to revert this change and go
  to option 2 or 3"

* tag 'trace-v4.18-rc3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Reorder display of TGID to be after PID