All of lore.kernel.org
 help / color / mirror / Atom feed
* [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review
@ 2016-01-06 10:35 Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 001/126] iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock Luis Henriques
                   ` (125 more replies)
  0 siblings, 126 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Luis Henriques

This is the start of the review cycle for the Linux 3.16.7-ckt22 stable kernel.

This version contains 126 new patches, summarized below.  The new patches are
posted as replies to this message and also available in this git branch:

http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.16.y-review

git://kernel.ubuntu.com/ubuntu/linux.git  linux-3.16.y-review

The review period for version 3.16.7-ckt22 will be open for the next three days.
To report a problem, please reply to the relevant follow-up patch message.

For more information about the Linux 3.16.y-ckt extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Luis

--
 MAINTAINERS                                     |   2 +-
 arch/arc/kernel/unwind.c                        |  37 +----
 arch/arm/boot/dts/kirkwood-ts219.dtsi           |   2 +-
 arch/arm64/include/asm/kvm_emulate.h            |   8 +-
 arch/arm64/kernel/setup.c                       |   4 +
 arch/arm64/kernel/suspend.c                     |  10 ++
 arch/arm64/kvm/inject_fault.c                   |   2 +-
 arch/mips/kvm/kvm_locore.S                      |  16 +-
 arch/mips/kvm/kvm_mips.c                        |   5 +-
 arch/mips/kvm/kvm_mips_emul.c                   |   2 +-
 arch/parisc/include/uapi/asm/mman.h             |  10 --
 arch/powerpc/include/asm/reg.h                  |   1 +
 arch/powerpc/kernel/process.c                   |  18 +++
 arch/powerpc/kernel/signal_32.c                 |  14 +-
 arch/powerpc/kernel/signal_64.c                 |   4 +
 arch/x86/kernel/cpu/common.c                    |   3 +-
 arch/x86/kernel/signal.c                        |  17 +-
 arch/x86/kernel/xsave.c                         |  11 +-
 arch/x86/kvm/x86.c                              |   8 +-
 block/blk-core.c                                |  21 +--
 block/partitions/mac.c                          |  10 +-
 drivers/crypto/nx/nx-aes-ccm.c                  |   2 +-
 drivers/crypto/nx/nx-aes-gcm.c                  |   2 +-
 drivers/crypto/talitos.c                        |   4 +-
 drivers/gpu/drm/drm_fops.c                      |  84 ++++++----
 drivers/gpu/drm/drm_stub.c                      |   5 +
 drivers/gpu/drm/i915/i915_gem.c                 |   8 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |  48 +++++-
 drivers/gpu/drm/i915/i915_reg.h                 |   2 +
 drivers/gpu/drm/i915/intel_display.c            |   3 +
 drivers/gpu/drm/radeon/radeon_pm.c              |   3 +-
 drivers/gpu/drm/radeon/rv730_dpm.c              |   2 +-
 drivers/gpu/drm/radeon/rv770_dpm.c              |   4 +-
 drivers/iio/adc/ad7793.c                        |   2 +-
 drivers/iio/adc/xilinx-xadc-core.c              |   1 +
 drivers/iio/dac/ad5064.c                        |  91 +++++++----
 drivers/isdn/hisax/config.c                     |   2 +-
 drivers/isdn/hisax/hfc_pci.c                    |   2 +-
 drivers/isdn/hisax/hfc_sx.c                     |   2 +-
 drivers/isdn/hisax/q931.c                       |   6 +-
 drivers/md/dm-mpath.c                           |   2 +-
 drivers/md/dm-thin.c                            |   1 +
 drivers/md/dm.c                                 |   2 +-
 drivers/mmc/card/block.c                        |  11 +-
 drivers/net/can/sja1000/sja1000.c               |   3 +
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   7 +-
 drivers/net/ethernet/marvell/mvneta.c           |   6 +-
 drivers/net/ethernet/mellanox/mlx4/main.c       |   8 +-
 drivers/net/ethernet/renesas/sh_eth.c           |   4 +-
 drivers/net/macvlan.c                           |   2 +
 drivers/net/phy/broadcom.c                      |   2 +-
 drivers/net/ppp/pptp.c                          |   6 +
 drivers/net/usb/qmi_wwan.c                      |   1 +
 drivers/net/wan/x25_asy.c                       |   6 +-
 drivers/remoteproc/remoteproc_debugfs.c         |   2 +-
 drivers/scsi/hosts.c                            |  11 ++
 drivers/staging/iio/adc/lpc32xx_adc.c           |   4 +-
 drivers/target/iscsi/iscsi_target.c             |  13 +-
 drivers/target/iscsi/iscsi_target_nego.c        |   1 +
 drivers/target/target_core_sbc.c                |  17 +-
 drivers/target/target_core_transport.c          |  14 +-
 drivers/usb/chipidea/debug.c                    |   2 +
 drivers/usb/class/usblp.c                       |   2 +-
 drivers/usb/dwc3/gadget.c                       |  23 ++-
 drivers/usb/host/xhci-hub.c                     |  15 +-
 drivers/usb/host/xhci.c                         |  10 ++
 drivers/usb/musb/musb_core.c                    |  10 +-
 drivers/usb/serial/option.c                     |  11 ++
 drivers/usb/serial/qcserial.c                   |  94 +++++++++---
 drivers/usb/serial/ti_usb_3410_5052.c           |   2 +
 drivers/usb/serial/ti_usb_3410_5052.h           |   4 +
 drivers/xen/gntdev.c                            |   2 +-
 fs/btrfs/file.c                                 |  11 +-
 fs/cachefiles/rdwr.c                            |   2 +-
 fs/fat/dir.c                                    |  16 +-
 fs/nfs/inode.c                                  |   6 +-
 fs/nfs/nfs4client.c                             |   2 +-
 fs/ocfs2/namei.c                                |   2 +
 fs/splice.c                                     |   8 +
 fs/sysv/inode.c                                 |  10 +-
 fs/xfs/xfs_mount.c                              |   4 +-
 fs/xfs/xfs_super.c                              |  20 ++-
 fs/xfs/xfs_super.h                              |   4 +-
 include/drm/drmP.h                              |   6 +
 include/linux/blkdev.h                          |   1 -
 include/linux/ipv6.h                            |   2 +-
 include/linux/lockdep.h                         |   5 +
 include/linux/signal.h                          |   1 -
 include/net/af_unix.h                           |   1 +
 include/net/ip6_tunnel.h                        |   3 +-
 include/net/ip_tunnels.h                        |   3 +-
 include/net/ipv6.h                              |  22 ++-
 include/net/sock.h                              |   3 +
 include/target/target_core_base.h               |   2 +-
 kernel/sched/core.c                             |   9 +-
 kernel/signal.c                                 |   2 +-
 kernel/trace/ring_buffer.c                      |  12 +-
 net/ax25/af_ax25.c                              |   3 +
 net/bluetooth/sco.c                             |   3 +
 net/core/neighbour.c                            |   4 +-
 net/core/scm.c                                  |   2 +
 net/core/skbuff.c                               |   3 +-
 net/core/sock.c                                 |   2 -
 net/dccp/ipv6.c                                 |  33 ++--
 net/decnet/af_decnet.c                          |   3 +
 net/ipv4/af_inet.c                              |   3 +
 net/ipv4/igmp.c                                 |   5 +-
 net/ipv4/ipmr.c                                 |  15 +-
 net/ipv4/netfilter/ipt_rpfilter.c               |   4 +-
 net/ipv4/tcp_input.c                            |   1 +
 net/ipv4/tcp_ipv4.c                             |   3 +-
 net/ipv6/af_inet6.c                             |  16 +-
 net/ipv6/datagram.c                             |   4 +-
 net/ipv6/exthdrs.c                              |   3 +-
 net/ipv6/inet6_connection_sock.c                |  11 +-
 net/ipv6/ip6_gre.c                              |   8 +-
 net/ipv6/ip6mr.c                                |  17 +-
 net/ipv6/ipv6_sockglue.c                        |  36 +++--
 net/ipv6/mcast.c                                |   2 -
 net/ipv6/netfilter/ip6t_SYNPROXY.c              |  18 ++-
 net/ipv6/netfilter/nf_conntrack_reasm.c         |   5 +-
 net/ipv6/raw.c                                  |   8 +-
 net/ipv6/reassembly.c                           |  10 +-
 net/ipv6/syncookies.c                           |   2 +-
 net/ipv6/tcp_ipv6.c                             |  28 ++--
 net/ipv6/udp.c                                  |   8 +-
 net/irda/af_irda.c                              |   3 +
 net/l2tp/l2tp_ip6.c                             |   8 +-
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/mesh_pathtbl.c                     |   8 +-
 net/mac80211/scan.c                             |   8 +-
 net/netfilter/nf_tables_api.c                   |   4 +-
 net/packet/af_packet.c                          |  86 ++++++-----
 net/rds/connection.c                            |   6 -
 net/rds/send.c                                  |   4 +-
 net/sctp/auth.c                                 |   4 +-
 net/sctp/ipv6.c                                 |   8 +
 net/sctp/sm_make_chunk.c                        |   4 +-
 net/sctp/socket.c                               |  12 +-
 net/unix/af_unix.c                              | 196 ++++++++++++++++++++----
 security/keys/keyctl.c                          |  18 +--
 sound/pci/hda/patch_realtek.c                   |  22 +++
 sound/pci/hda/patch_sigmatel.c                  |  45 ++++--
 sound/soc/codecs/wm8962.c                       |   4 +-
 sound/usb/midi.c                                |  46 ++++++
 sound/usb/quirks-table.h                        |  11 ++
 sound/usb/quirks.c                              |   1 +
 sound/usb/usbaudio.h                            |   1 +
 tools/net/Makefile                              |   7 +-
 149 files changed, 1178 insertions(+), 524 deletions(-)

Aaro Koskinen (1):
      broadcom: fix PHY_ID_BCM5481 entry in the id table

Al Viro (1):
      fix sysvfs symlinks

Aleksander Morgado (1):
      USB: serial: option: add support for Novatel MiFi USB620L

Alex Deucher (3):
      drm/radeon: unconditionally set sysfs_initialized
      drm/radeon: make rv770_set_sw_state failures non-fatal
      drm/radeon: make some dpm errors debug only

Andrew Cooper (1):
      x86/cpu: Fix SMAP check in PVOPS environments

Andrew Honig (1):
      KVM: x86: Reload pit counters for all channels when restoring state

Andrew Lunn (1):
      ipv4: igmp: Allow removing groups from a removed interface

Antonio Quartulli (1):
      mac80211: do not actively scan DFS channels

Arnd Bergmann (1):
      remoteproc: avoid stack overflow in debugfs file

Bart Van Assche (1):
      Fix a memory leak in scsi_host_dev_release()

Ben McCauley (1):
      usb: dwc3: gadget: let us set lower max_speed

Benjamin Coddington (1):
      nfs4: start callback_ident at idr 1

Bjørn Mork (3):
      USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem
      USB: option: add XS Stick W100-2 from 4G Systems
      net: qmi_wwan: add XS Stick W100-2 from 4G Systems

Boris Ostrovsky (1):
      xen/gntdev: Grant maps should not be subject to NUMA balancing

Chris Wilson (1):
      drm/i915: Disable PSMI sleep messages on all rings around context switches

Christoph Biedl (1):
      isdn: Partially revert debug format string usage clean up

Clemens Ladisch (3):
      ALSA: usb-audio: add packet size quirk for the Medeli DD305
      ALSA: usb-audio: prevent CH345 multiport output SysEx corruption
      ALSA: usb-audio: work around CH345 input SysEx corruption

Daniel Borkmann (6):
      packet: do skb_probe_transport_header when we actually have data
      packet: only allow extra vlan len on ethernet devices
      packet: fix tpacket_snd max frame len
      packet: always probe for transport header
      packet: infer protocol from ethernet header if unset
      net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds

Dave Hansen (1):
      x86/fpu: Fix 32-bit signal frame handling

David Gstir (2):
      crypto: nx - Fix timing leak in GCM and CCM decryption
      crypto: talitos - Fix timing leak in ESP ICV verification

David Howells (1):
      KEYS: Fix race between read and revoke

David S. Miller (1):
      bluetooth: Validate socket address length in sco_sock_bind().

David Sterba (1):
      btrfs: fix signed overflows in btrfs_sync_file

David Woodhouse (1):
      USB: ti_usb_3410_5052: Add Honeywell HGI80 ID

Dmitry V. Levin (1):
      x86/signal: Fix restart_syscall number for x32 tasks

Emmanuel Grumbach (1):
      mac80211: ensure we don't update tx power on a non-running sdata

Eric Dumazet (5):
      tcp: md5: fix lockdep annotation
      tcp: initialize tp->copied_seq in case of cross SYN connection
      ipv6: add complete rcu protection around np->opt
      ipv6: sctp: implement sctp_v6_destroy_sock()
      ipv6: sctp: clone options to avoid use after free

Eric Sandeen (1):
      xfs: allow inode allocations in post-growfs disk space

Geert Uytterhoeven (1):
      FS-Cache: Add missing initialization of ret in cachefiles_write_page()

Hannes Frederic Sowa (1):
      net: add validation for the socket syscall protocol argument

Hannes Reinecke (1):
      block: Always check queue limits for cloned requests

Helge Deller (1):
      parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h

Helmut Klein (1):
      ARM: dts: Kirkwood: Fix QNAP TS219 power-off

Hui Wang (1):
      ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3

Imre Deak (1):
      drm/i915: get runtime PM reference around GEM set_caching IOCTL

James Hogan (3):
      MIPS: KVM: Fix ASID restoration logic
      MIPS: KVM: Fix CACHE immediate offset sign extension
      MIPS: KVM: Uninit VCPU in vcpu_create error path

Jan Engelhardt (1):
      target: fix COMPARE_AND_WRITE non zero SGL offset data corruption

Jan Kara (2):
      vfs: Make sendfile(2) killable even better
      vfs: Avoid softlockups with sendfile(2)

Jani Nikula (1):
      drm/i915: quirk backlight present on Macbook 4, 1

Jason A. Donenfeld (1):
      ip_tunnel: disable preemption when updating per-cpu tstats

Jeff Layton (1):
      nfs: if we have no valid attrs, then don't declare the attribute cache valid

Jiri Slaby (1):
      usblp: do not set TASK_INTERRUPTIBLE before lock

Johannes Berg (1):
      mac80211: mesh: fix call_rcu() usage

Junichi Nomura (1):
      dm: fix ioctl retry termination with signal

Junxiao Bi (1):
      ocfs2: fix umask ignored issue

Kamal Mostafa (1):
      tools/net: Use include/uapi with __EXPORTED_HEADERS__

Kees Cook (1):
      mac: validate mac_partition is within sector

Konstantin Khlebnikov (1):
      net/neighbour: fix crash at dumping device-agnostic proxy entries

Lars-Peter Clausen (2):
      iio: ad5064: Fix ad5629/ad5669 shift
      iio:ad7793: Fix ad7785 product ID

Li Jun (1):
      usb: chipidea: debug: disable usb irq while role switch

Lorenzo Pieralisi (1):
      arm64: kernel: pause/unpause function graph tracer in cpu_suspend()

Luca Porzio (1):
      mmc: remove bondage between REQ_META and reliable write

Marc Zyngier (1):
      arm64: KVM: Fix AArch32 to AArch64 register mapping

Marcelo Ricardo Leitner (2):
      sctp: use the same clock as if sock source timestamps were on
      sctp: update the netstamp_needed counter when copying sockets

Marcin Wojtas (3):
      net: mvneta: add configuration for MBUS windows access protection
      net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
      net: mvneta: fix bit assignment for RX packet irq enable

Mathias Nyman (1):
      xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices

Michael Hennerich (1):
      iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success

Michael Neuling (2):
      powerpc/tm: Block signal return setting invalid MSR state
      powerpc/tm: Check for already reclaimed tasks

Michal Kubeček (1):
      ipv6: distinguish frag queues by device for multicast and link-local packets

Mike Snitzer (1):
      dm thin: restore requested 'error_if_no_space' setting on OODS to WRITE transition

Mirek Kratochvil (1):
      netfilter: nf_tables: fix bogus warning in nft_data_uninit()

Mirza Krak (1):
      can: sja1000: clear interrupts on start

Neil Horman (1):
      snmp: Remove duplicate OUTMCAST stat increment

Nicholas Bellinger (2):
      iscsi-target: Fix rx_login_comp hang after login failure
      target: Fix race for SCF_COMPARE_AND_WRITE_POST checking

Nicolas Dichtel (1):
      gre6: allow to update all parameters via rtnl

Nikolay Aleksandrov (2):
      net: ipmr: fix static mfc/dev leaks on table destruction
      net: ip6mr: fix static mfc/dev leaks on table destruction

Noa Osherovich (1):
      net/mlx4_core: Avoid returning success in case of an error flow

OGAWA Hirofumi (1):
      fat: fix fake_offset handling on error path

Pavel Machek (1):
      atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation

Peter Hurley (2):
      wan/x25: Fix use-after-free in x25_asy_open_tty()
      locking: Add WARN_ON_ONCE lock assertion

Petr Štetiar (1):
      USB: qcserial: Add support for Quectel EC20 Mini PCIe module

Phil Sutter (1):
      netfilter: ip6t_SYNPROXY: fix NULL pointer dereference

Quentin Casasnovas (1):
      RDS: fix race condition when sending a message on unbound socket

Rainer Weikusat (2):
      unix: avoid use-after-free in ep_remove_wait_queue
      af_unix: Revert 'lock_interruptible' in stream receive code

Rajmohan Mani (1):
      xhci: Workaround to get Intel xHCI reset working more reliably

Richard Weinberger (1):
      kernel/signal.c: unexport sigsuspend()

Sabrina Dubroca (1):
      macvlan: fix leak in macvlan_handle_frame

Sachin Pandhare (1):
      ASoC: wm8962: correct addresses for HPF_C_0/1

Sasha Levin (1):
      sched/core: Remove false-positive warning from wake_up_process()

Sergei Shtylyov (1):
      sh_eth: fix kernel oops in skb_put()

Steven Rostedt (Red Hat) (1):
      ring-buffer: Update read stamp with first real commit on page

Takashi Iwai (3):
      ALSA: hda - Add fixup for Acer Aspire One Cloudbook 14
      ALSA: hda - Apply HP headphone fixups more generically
      ALSA: hda - Fix noise on Gigabyte Z170X mobo

Thomas Betker (1):
      iio: adc: xilinx: Fix VREFN scale

Thomas Hellstrom (1):
      drm: Fix an unwanted master inheritance v2

Uwe Kleine-König (1):
      usb: musb: core: fix order of arguments to ulpi write callback

Vineet Gupta (2):
      ARC: Fix silly typo in MAINTAINERS file
      ARC: dw2 unwind: Remove falllback linear search thru FDE entries

Vlad Yasevich (2):
      vlan: Fix untag operations of stacked vlans with REORDER_HEADER off
      skbuff: Fix offset error in skb_reorder_vlan_header

Vladimir Zapolskiy (1):
      iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock

WANG Cong (2):
      pptp: verify sockaddr_len in pptp_bind() and pptp_connect()
      ip6mr: call del_timer_sync() in ip6mr_free_table()

Xunlei Pang (1):
      sched/core: Clear the root_domain cpumasks in init_rootdomain()

Yang Shi (1):
      arm64: restore bogomips information in /proc/cpuinfo

lucien (2):
      sctp: translate host order to network order when setting a hmacid
      netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse

^ permalink raw reply	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 001/126] iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 002/126] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Luis Henriques
                   ` (124 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vladimir Zapolskiy, Jonathan Cameron, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vladimir Zapolskiy <vz@mleia.com>

commit 01bb70ae0b98d266fa3e860482c7ce22fa482a6e upstream.

If common clock framework is configured, the driver generates a warning,
which is fixed by this change:

    root@devkit3250:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 724 at drivers/clk/clk.c:727 clk_core_enable+0x2c/0xa4()
    Modules linked in: sc16is7xx snd_soc_uda1380
    CPU: 0 PID: 724 Comm: cat Not tainted 4.3.0-rc2+ #198
    Hardware name: LPC32XX SoC (Flattened Device Tree)
    Backtrace:
    [<>] (dump_backtrace) from [<>] (show_stack+0x18/0x1c)
    [<>] (show_stack) from [<>] (dump_stack+0x20/0x28)
    [<>] (dump_stack) from [<>] (warn_slowpath_common+0x90/0xb8)
    [<>] (warn_slowpath_common) from [<>] (warn_slowpath_null+0x24/0x2c)
    [<>] (warn_slowpath_null) from [<>] (clk_core_enable+0x2c/0xa4)
    [<>] (clk_core_enable) from [<>] (clk_enable+0x24/0x38)
    [<>] (clk_enable) from [<>] (lpc32xx_read_raw+0x38/0x80)
    [<>] (lpc32xx_read_raw) from [<>] (iio_read_channel_info+0x70/0x94)
    [<>] (iio_read_channel_info) from [<>] (dev_attr_show+0x28/0x4c)
    [<>] (dev_attr_show) from [<>] (sysfs_kf_seq_show+0x8c/0xf0)
    [<>] (sysfs_kf_seq_show) from [<>] (kernfs_seq_show+0x2c/0x30)
    [<>] (kernfs_seq_show) from [<>] (seq_read+0x1c8/0x440)
    [<>] (seq_read) from [<>] (kernfs_fop_read+0x38/0x170)
    [<>] (kernfs_fop_read) from [<>] (do_readv_writev+0x16c/0x238)
    [<>] (do_readv_writev) from [<>] (vfs_readv+0x50/0x58)
    [<>] (vfs_readv) from [<>] (default_file_splice_read+0x1a4/0x308)
    [<>] (default_file_splice_read) from [<>] (do_splice_to+0x78/0x84)
    [<>] (do_splice_to) from [<>] (splice_direct_to_actor+0xc8/0x1cc)
    [<>] (splice_direct_to_actor) from [<>] (do_splice_direct+0xa0/0xb8)
    [<>] (do_splice_direct) from [<>] (do_sendfile+0x1a8/0x30c)
    [<>] (do_sendfile) from [<>] (SyS_sendfile64+0x104/0x10c)
    [<>] (SyS_sendfile64) from [<>] (ret_fast_syscall+0x0/0x38)

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/lpc32xx_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c
index a876ce755351..22818550efd3 100644
--- a/drivers/staging/iio/adc/lpc32xx_adc.c
+++ b/drivers/staging/iio/adc/lpc32xx_adc.c
@@ -76,7 +76,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
 
 	if (mask == IIO_CHAN_INFO_RAW) {
 		mutex_lock(&indio_dev->mlock);
-		clk_enable(info->clk);
+		clk_prepare_enable(info->clk);
 		/* Measurement setup */
 		__raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm,
 			LPC32XX_ADC_SELECT(info->adc_base));
@@ -84,7 +84,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
 		__raw_writel(AD_PDN_CTRL | AD_STROBE,
 			LPC32XX_ADC_CTRL(info->adc_base));
 		wait_for_completion(&info->completion); /* set by ISR */
-		clk_disable(info->clk);
+		clk_disable_unprepare(info->clk);
 		*val = info->value;
 		mutex_unlock(&indio_dev->mlock);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 002/126] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 001/126] iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 003/126] iio: ad5064: Fix ad5629/ad5669 shift Luis Henriques
                   ` (123 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Hennerich, Lars-Peter Clausen, Jonathan Cameron, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Hennerich <michael.hennerich@analog.com>

commit 03fe472ef33b7f31fbd11d300dbb3fdab9c00fd4 upstream.

i2c_master_send() returns the number of bytes transferred on success while
the ad5064 driver expects that the write() callback returns 0 on success.
Fix that by translating any non negative return value of i2c_master_send()
to 0.

Fixes: commit 6a17a0768f77 ("iio:dac:ad5064: Add support for the ad5629r and ad5669r")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/dac/ad5064.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index f03b92fd3803..1b43069ca5f6 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -598,10 +598,16 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
 	unsigned int addr, unsigned int val)
 {
 	struct i2c_client *i2c = to_i2c_client(st->dev);
+	int ret;
 
 	st->data.i2c[0] = (cmd << 4) | addr;
 	put_unaligned_be16(val, &st->data.i2c[1]);
-	return i2c_master_send(i2c, st->data.i2c, 3);
+
+	ret = i2c_master_send(i2c, st->data.i2c, 3);
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int ad5064_i2c_probe(struct i2c_client *i2c,

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 003/126] iio: ad5064: Fix ad5629/ad5669 shift
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 001/126] iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 002/126] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 004/126] iio:ad7793: Fix ad7785 product ID Luis Henriques
                   ` (122 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Jonathan Cameron, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lars-Peter Clausen <lars@metafoo.de>

commit 5dcbe97bedd6ba4b0f574a96cc2e293d26f3d857 upstream.

The ad5629/ad5669 are the I2C variant of the ad5628/ad5668, which has a SPI
interface. They are mostly identical with the exception that the shift
factor is different. Currently the driver does not take care of this
difference which leads to incorrect DAC output values.

Fix this by introducing a custom channel spec for the ad5629/ad5669 with
the correct shift factor.

Fixes: commit 6a17a0768f77 ("iio:dac:ad5064: Add support for the ad5629r and ad5669r")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/dac/ad5064.c | 83 +++++++++++++++++++++++++++++++++---------------
 1 file changed, 57 insertions(+), 26 deletions(-)

diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 1b43069ca5f6..aac16fecdfa8 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -113,12 +113,16 @@ enum ad5064_type {
 	ID_AD5065,
 	ID_AD5628_1,
 	ID_AD5628_2,
+	ID_AD5629_1,
+	ID_AD5629_2,
 	ID_AD5648_1,
 	ID_AD5648_2,
 	ID_AD5666_1,
 	ID_AD5666_2,
 	ID_AD5668_1,
 	ID_AD5668_2,
+	ID_AD5669_1,
+	ID_AD5669_2,
 };
 
 static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
@@ -291,7 +295,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
 	{ },
 };
 
-#define AD5064_CHANNEL(chan, addr, bits) {			\
+#define AD5064_CHANNEL(chan, addr, bits, _shift) {		\
 	.type = IIO_VOLTAGE,					\
 	.indexed = 1,						\
 	.output = 1,						\
@@ -303,36 +307,39 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
 		.sign = 'u',					\
 		.realbits = (bits),				\
 		.storagebits = 16,				\
-		.shift = 20 - bits,				\
+		.shift = (_shift),				\
 	},							\
 	.ext_info = ad5064_ext_info,				\
 }
 
-#define DECLARE_AD5064_CHANNELS(name, bits) \
+#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
 const struct iio_chan_spec name[] = { \
-	AD5064_CHANNEL(0, 0, bits), \
-	AD5064_CHANNEL(1, 1, bits), \
-	AD5064_CHANNEL(2, 2, bits), \
-	AD5064_CHANNEL(3, 3, bits), \
-	AD5064_CHANNEL(4, 4, bits), \
-	AD5064_CHANNEL(5, 5, bits), \
-	AD5064_CHANNEL(6, 6, bits), \
-	AD5064_CHANNEL(7, 7, bits), \
+	AD5064_CHANNEL(0, 0, bits, shift), \
+	AD5064_CHANNEL(1, 1, bits, shift), \
+	AD5064_CHANNEL(2, 2, bits, shift), \
+	AD5064_CHANNEL(3, 3, bits, shift), \
+	AD5064_CHANNEL(4, 4, bits, shift), \
+	AD5064_CHANNEL(5, 5, bits, shift), \
+	AD5064_CHANNEL(6, 6, bits, shift), \
+	AD5064_CHANNEL(7, 7, bits, shift), \
 }
 
-#define DECLARE_AD5065_CHANNELS(name, bits) \
+#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
 const struct iio_chan_spec name[] = { \
-	AD5064_CHANNEL(0, 0, bits), \
-	AD5064_CHANNEL(1, 3, bits), \
+	AD5064_CHANNEL(0, 0, bits, shift), \
+	AD5064_CHANNEL(1, 3, bits, shift), \
 }
 
-static DECLARE_AD5064_CHANNELS(ad5024_channels, 12);
-static DECLARE_AD5064_CHANNELS(ad5044_channels, 14);
-static DECLARE_AD5064_CHANNELS(ad5064_channels, 16);
+static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
+static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
+static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
 
-static DECLARE_AD5065_CHANNELS(ad5025_channels, 12);
-static DECLARE_AD5065_CHANNELS(ad5045_channels, 14);
-static DECLARE_AD5065_CHANNELS(ad5065_channels, 16);
+static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
+static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
+static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
+
+static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
+static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
 
 static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
 	[ID_AD5024] = {
@@ -382,6 +389,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
 		.channels = ad5024_channels,
 		.num_channels = 8,
 	},
+	[ID_AD5629_1] = {
+		.shared_vref = true,
+		.internal_vref = 2500000,
+		.channels = ad5629_channels,
+		.num_channels = 8,
+	},
+	[ID_AD5629_2] = {
+		.shared_vref = true,
+		.internal_vref = 5000000,
+		.channels = ad5629_channels,
+		.num_channels = 8,
+	},
 	[ID_AD5648_1] = {
 		.shared_vref = true,
 		.internal_vref = 2500000,
@@ -418,6 +437,18 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
 		.channels = ad5064_channels,
 		.num_channels = 8,
 	},
+	[ID_AD5669_1] = {
+		.shared_vref = true,
+		.internal_vref = 2500000,
+		.channels = ad5669_channels,
+		.num_channels = 8,
+	},
+	[ID_AD5669_2] = {
+		.shared_vref = true,
+		.internal_vref = 5000000,
+		.channels = ad5669_channels,
+		.num_channels = 8,
+	},
 };
 
 static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -623,12 +654,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id ad5064_i2c_ids[] = {
-	{"ad5629-1", ID_AD5628_1},
-	{"ad5629-2", ID_AD5628_2},
-	{"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */
-	{"ad5669-1", ID_AD5668_1},
-	{"ad5669-2", ID_AD5668_2},
-	{"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */
+	{"ad5629-1", ID_AD5629_1},
+	{"ad5629-2", ID_AD5629_2},
+	{"ad5629-3", ID_AD5629_2}, /* similar enough to ad5629-2 */
+	{"ad5669-1", ID_AD5669_1},
+	{"ad5669-2", ID_AD5669_2},
+	{"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 004/126] iio:ad7793: Fix ad7785 product ID
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 003/126] iio: ad5064: Fix ad5629/ad5669 shift Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 005/126] x86/fpu: Fix 32-bit signal frame handling Luis Henriques
                   ` (121 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Jonathan Cameron, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lars-Peter Clausen <lars@metafoo.de>

commit 785171fd6cd7dcd7ada5a733b6a2d44ec566c3a0 upstream.

While the datasheet for the AD7785 lists 0xXB as the product ID the actual
product ID is 0xX3.

Fix the product ID otherwise the driver will reject the device due to non
matching IDs.

Fixes: e786cc26dcc5 ("staging:iio:ad7793: Implement stricter id checking")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/adc/ad7793.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index 4dddeabdfbb0..5da07546e182 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -101,7 +101,7 @@
 #define AD7795_CH_AIN1M_AIN1M	8 /* AIN1(-) - AIN1(-) */
 
 /* ID Register Bit Designations (AD7793_REG_ID) */
-#define AD7785_ID		0xB
+#define AD7785_ID		0x3
 #define AD7792_ID		0xA
 #define AD7793_ID		0xB
 #define AD7794_ID		0xF

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 005/126] x86/fpu: Fix 32-bit signal frame handling
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 004/126] iio:ad7793: Fix ad7785 product ID Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 006/126] iio: adc: xilinx: Fix VREFN scale Luis Henriques
                   ` (120 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Hansen, Andy Lutomirski, Borislav Petkov, Brian Gerst,
	Denys Vlasenko, H. Peter Anvin, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, dave, fenghua.yu, yu-cheng.yu, Ingo Molnar,
	Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Hansen <dave.hansen@linux.intel.com>

commit ab6b52947545a5355154f64f449f97af9d05845f upstream.

(This should have gone to LKML originally. Sorry for the extra
 noise, folks on the cc.)

Background:

Signal frames on x86 have two formats:

  1. For 32-bit executables (whether on a real 32-bit kernel or
     under 32-bit emulation on a 64-bit kernel) we have a
    'fpregset_t' that includes the "FSAVE" registers.

  2. For 64-bit executables (on 64-bit kernels obviously), the
     'fpregset_t' is smaller and does not contain the "FSAVE"
     state.

When creating the signal frame, we have to be aware of whether
we are running a 32 or 64-bit executable so we create the
correct format signal frame.

Problem:

save_xstate_epilog() uses 'fx_sw_reserved_ia32' whenever it is
called for a 32-bit executable.  This is for real 32-bit and
ia32 emulation.

But, fpu__init_prepare_fx_sw_frame() only initializes
'fx_sw_reserved_ia32' when emulation is enabled, *NOT* for real
32-bit kernels.

This leads to really wierd situations where 32-bit programs
lose their extended state when returning from a signal handler.
The kernel copies the uninitialized (zero) 'fx_sw_reserved_ia32'
out to userspace in save_xstate_epilog().  But when returning
from the signal, the kernel errors out in check_for_xstate()
when it does not see FP_XSTATE_MAGIC1 present (because it was
zeroed).  This leads to the FPU/XSAVE state being initialized.

For MPX, this leads to the most permissive state and means we
silently lose bounds violations.  I think this would also mean
that we could lose *ANY* FPU/SSE/AVX state.  I'm not sure why
no one has spotted this bug.

I believe this was broken by:

	72a671ced66d ("x86, fpu: Unify signal handling code paths for x86 and x86_64 kernels")

way back in 2012.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave@sr71.net
Cc: fenghua.yu@intel.com
Cc: yu-cheng.yu@intel.com
Link: http://lkml.kernel.org/r/20151111002354.A0799571@viggo.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ luis: backported to 3.16:
  - file and function rename:
    * arch/x86/kernel/fpu/signal.c -> arch/x86/kernel/xsave.c
    * fpu__init_prepare_fx_sw_frame() -> prepare_fx_sw_frame()
  - use 'i387_fsave_struct' instead of 'fregs_state'
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/xsave.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 7a09aca4b33a..beddb0344d52 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -429,20 +429,19 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
  */
 static void prepare_fx_sw_frame(void)
 {
-	int fsave_header_size = sizeof(struct i387_fsave_struct);
 	int size = xstate_size + FP_XSTATE_MAGIC2_SIZE;
 
-	if (config_enabled(CONFIG_X86_32))
-		size += fsave_header_size;
-
 	fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1;
 	fx_sw_reserved.extended_size = size;
 	fx_sw_reserved.xstate_bv = pcntxt_mask;
 	fx_sw_reserved.xstate_size = xstate_size;
 
-	if (config_enabled(CONFIG_IA32_EMULATION)) {
+	if (config_enabled(CONFIG_IA32_EMULATION) ||
+	    config_enabled(CONFIG_X86_32)) {
+		int fsave_header_size = sizeof(struct i387_fsave_struct);
+
 		fx_sw_reserved_ia32 = fx_sw_reserved;
-		fx_sw_reserved_ia32.extended_size += fsave_header_size;
+		fx_sw_reserved_ia32.extended_size = size + fsave_header_size;
 	}
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 006/126] iio: adc: xilinx: Fix VREFN scale
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 005/126] x86/fpu: Fix 32-bit signal frame handling Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 007/126] drm/i915: quirk backlight present on Macbook 4, 1 Luis Henriques
                   ` (119 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Betker, Jonathan Cameron, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Betker <thomas.betker@rohde-schwarz.com>

commit a57f8dac46fbac5ab0e31aef1a98b3f6eb30c079 upstream.

The scaling factor for VREFN is 3.0/4096 (not 1.0/4096), just as for
VREFP. This is not immediately obvious from the specification (Xilinx
UG480), but has been confirmed by Xilinx support.

Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index c7637716fa8f..53c80c73f128 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -857,6 +857,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev,
 			case XADC_REG_VCCINT:
 			case XADC_REG_VCCAUX:
 			case XADC_REG_VREFP:
+			case XADC_REG_VREFN:
 			case XADC_REG_VCCBRAM:
 			case XADC_REG_VCCPINT:
 			case XADC_REG_VCCPAUX:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 007/126] drm/i915: quirk backlight present on Macbook 4, 1
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 006/126] iio: adc: xilinx: Fix VREFN scale Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 008/126] USB: qcserial: Add support for Quectel EC20 Mini PCIe module Luis Henriques
                   ` (118 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jani Nikula, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jani Nikula <jani.nikula@intel.com>

commit 1b9448b071caa7d10bb2569fabe3020a2c25ae59 upstream.

Unsurprisingly macbooks have backlights, just the VBT doesn't seem to
know it in this case.

Reported-and-tested-by: Daniel Nicoletti <dantti12@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88325
Fixes: c675949ec58c ("drm/i915: do not setup backlight if not available according to VBT")
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446716999-1796-1-git-send-email-jani.nikula@intel.com
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c35353aadd02..b019c563a787 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11703,6 +11703,9 @@ static struct intel_quirk intel_quirks[] = {
 	/* Apple Macbook 2,1 (Core 2 T7400) */
 	{ 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
 
+	/* Apple Macbook 4,1 */
+	{ 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
+
 	/* Toshiba CB35 Chromebook (Celeron 2955U) */
 	{ 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 008/126] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 007/126] drm/i915: quirk backlight present on Macbook 4, 1 Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 009/126] USB: serial: option: add support for Novatel MiFi USB620L Luis Henriques
                   ` (117 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Petr Štetiar, Johan Hovold, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>

commit 9d5b5ed796d7afd7e8d2ac4b4fb77c6a49463f4b upstream.

It seems like this device has same vendor and product IDs as G2K
devices, but it has different number of interfaces(4 vs 5) and also
different interface layout which makes it currently unusable:

	usbcore: registered new interface driver qcserial
	usbserial: USB Serial support registered for Qualcomm USB modem
	usb 2-1.2: unknown number of interfaces: 5

lsusb output:

	Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless
	Device Descriptor:
	  bLength                18
	  bDescriptorType         1
	  bcdUSB               2.00
	  bDeviceClass            0 (Defined at Interface level)
	  bDeviceSubClass         0
	  bDeviceProtocol         0
	  bMaxPacketSize0        64
	  idVendor           0x05c6 Qualcomm, Inc.
	  idProduct          0x9215 Acer Gobi 2000 Wireless Modem
	  bcdDevice            2.32
	  iManufacturer           1 Quectel
	  iProduct                2 Quectel LTE Module
	  iSerial                 0
	  bNumConfigurations      1
	  Configuration Descriptor:
	    bLength                 9
	    bDescriptorType         2
	    wTotalLength          209
	    bNumInterfaces          5
	    bConfigurationValue     1
	    iConfiguration          0
	    bmAttributes         0xa0
	      (Bus Powered)
	      Remote Wakeup
	    MaxPower              500mA

Signed-off-by: Petr Štetiar <ynezz@true.cz>
[johan: rename define and add comment ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/qcserial.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index f49d262e926b..1d7a2a48552c 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -22,6 +22,8 @@
 #define DRIVER_AUTHOR "Qualcomm Inc"
 #define DRIVER_DESC "Qualcomm USB Serial driver"
 
+#define QUECTEL_EC20_PID	0x9215
+
 /* standard device layouts supported by this driver */
 enum qcserial_layouts {
 	QCSERIAL_G2K = 0,	/* Gobi 2000 */
@@ -169,6 +171,38 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
+static int handle_quectel_ec20(struct device *dev, int ifnum)
+{
+	int altsetting = 0;
+
+	/*
+	 * Quectel EC20 Mini PCIe LTE module layout:
+	 * 0: DM/DIAG (use libqcdm from ModemManager for communication)
+	 * 1: NMEA
+	 * 2: AT-capable modem port
+	 * 3: Modem interface
+	 * 4: NDIS
+	 */
+	switch (ifnum) {
+	case 0:
+		dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n");
+		break;
+	case 1:
+		dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n");
+		break;
+	case 2:
+	case 3:
+		dev_dbg(dev, "Quectel EC20 Modem port found\n");
+		break;
+	case 4:
+		/* Don't claim the QMI/net interface */
+		altsetting = -1;
+		break;
+	}
+
+	return altsetting;
+}
+
 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 {
 	struct usb_host_interface *intf = serial->interface->cur_altsetting;
@@ -237,6 +271,12 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 			altsetting = -1;
 		break;
 	case QCSERIAL_G2K:
+		/* handle non-standard layouts */
+		if (nintf == 5 && id->idProduct == QUECTEL_EC20_PID) {
+			altsetting = handle_quectel_ec20(dev, ifnum);
+			goto done;
+		}
+
 		/*
 		 * Gobi 2K+ USB layout:
 		 * 0: QMI/net

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 009/126] USB: serial: option: add support for Novatel MiFi USB620L
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 008/126] USB: qcserial: Add support for Quectel EC20 Mini PCIe module Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 010/126] USB: ti_usb_3410_5052: Add Honeywell HGI80 ID Luis Henriques
                   ` (116 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aleksander Morgado, Johan Hovold, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Aleksander Morgado <aleksander@aleksander.es>

commit e07af133c3e2716db25e3e1e1d9f10c2088e9c1a upstream.

Also known as Verizon U620L.

The device is modeswitched from 1410:9020 to 1410:9022 by selecting the
4th USB configuration:

 $ sudo usb_modeswitch –v 0x1410 –p 0x9020 –u 4

This configuration provides a ECM interface as well as TTYs ('Enterprise
Mode' according to the U620 Linux integration guide).

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 28e9bbeae8f7..fc49b8888789 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -162,6 +162,7 @@ static void option_instat_callback(struct urb *urb);
 #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED	0x9001
 #define NOVATELWIRELESS_PRODUCT_E362		0x9010
 #define NOVATELWIRELESS_PRODUCT_E371		0x9011
+#define NOVATELWIRELESS_PRODUCT_U620L		0x9022
 #define NOVATELWIRELESS_PRODUCT_G2		0xA010
 #define NOVATELWIRELESS_PRODUCT_MC551		0xB001
 
@@ -1067,6 +1068,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U620L, 0xff, 0x00, 0x00) },
 
 	{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
 	{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 010/126] USB: ti_usb_3410_5052: Add Honeywell HGI80 ID
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 009/126] USB: serial: option: add support for Novatel MiFi USB620L Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 011/126] drm/i915: get runtime PM reference around GEM set_caching IOCTL Luis Henriques
                   ` (115 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Woodhouse, Johan Hovold, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Woodhouse <dwmw2@infradead.org>

commit 1bcb49e663f88bccee35b8688e6a3da2bea31fd4 upstream.

The Honeywell HGI80 is a wireless interface to the evohome connected
thermostat. It uses a TI 3410 USB-serial port.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ti_usb_3410_5052.c | 2 ++
 drivers/usb/serial/ti_usb_3410_5052.h | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 3dd3ff8c50d3..7a1f446ab204 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -159,6 +159,7 @@ static const struct usb_device_id ti_id_table_3410[] = {
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) },
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
 	{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
+	{ USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
 	{ }	/* terminator */
 };
 
@@ -191,6 +192,7 @@ static const struct usb_device_id ti_id_table_combined[] = {
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
 	{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
+	{ USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
 	{ }	/* terminator */
 };
 
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index 4a2423e84d55..98f35c656c02 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -56,6 +56,10 @@
 #define ABBOTT_PRODUCT_ID		ABBOTT_STEREO_PLUG_ID
 #define ABBOTT_STRIP_PORT_ID		0x3420
 
+/* Honeywell vendor and product IDs */
+#define HONEYWELL_VENDOR_ID		0x10ac
+#define HONEYWELL_HGI80_PRODUCT_ID	0x0102  /* Honeywell HGI80 */
+
 /* Commands */
 #define TI_GET_VERSION			0x01
 #define TI_GET_PORT_STATUS		0x02

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 011/126] drm/i915: get runtime PM reference around GEM set_caching IOCTL
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 010/126] USB: ti_usb_3410_5052: Add Honeywell HGI80 ID Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 012/126] drm/radeon: unconditionally set sysfs_initialized Luis Henriques
                   ` (114 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Imre Deak, Jani Nikula, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Imre Deak <imre.deak@intel.com>

commit fd0fe6acf1dd88aabfbf383f7e4c16315387a7b7 upstream.

After Damien's D3 fix I started to get runtime suspend residency for the
first time and that revealed a breakage on the set_caching IOCTL path
that accesses the HW but doesn't take an RPM ref. Fix this up.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446665132-22491-1-git-send-email-imre.deak@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9d79e08d83f3..3b2bca469cd4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3757,6 +3757,7 @@ unlock:
 int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 			       struct drm_file *file)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_caching *args = data;
 	struct drm_i915_gem_object *obj;
 	enum i915_cache_level level;
@@ -3776,9 +3777,11 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
+	intel_runtime_pm_get(dev_priv);
+
 	ret = i915_mutex_lock_interruptible(dev);
 	if (ret)
-		return ret;
+		goto rpm_put;
 
 	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
 	if (&obj->base == NULL) {
@@ -3791,6 +3794,9 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,
 	drm_gem_object_unreference(&obj->base);
 unlock:
 	mutex_unlock(&dev->struct_mutex);
+rpm_put:
+	intel_runtime_pm_put(dev_priv);
+
 	return ret;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 012/126] drm/radeon: unconditionally set sysfs_initialized
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 011/126] drm/i915: get runtime PM reference around GEM set_caching IOCTL Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 013/126] USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem Luis Henriques
                   ` (113 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 24dd2f64c5a877392925202321c7c2c46c2b0ddf upstream.

Avoids spew on resume for systems where sysfs may
fail even on init.

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_pm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 17220e89dc30..98dcccacd678 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1404,8 +1404,7 @@ int radeon_pm_late_init(struct radeon_device *rdev)
 				ret = device_create_file(rdev->dev, &dev_attr_power_method);
 				if (ret)
 					DRM_ERROR("failed to create device file for power method\n");
-				if (!ret)
-					rdev->pm.sysfs_initialized = true;
+				rdev->pm.sysfs_initialized = true;
 			}
 
 			mutex_lock(&rdev->pm.mutex);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 013/126] USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 012/126] drm/radeon: unconditionally set sysfs_initialized Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 014/126] arm64: kernel: pause/unpause function graph tracer in cpu_suspend() Luis Henriques
                   ` (112 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Johan Hovold, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 59536da34513c594af2a6fd35ba65ea45b6960a1 upstream.

The DEVICE_HWI type was added under the faulty assumption that Huawei
devices based on Qualcomm chipsets and firmware use the static USB
interface numbering known from Gobi devices.  But this model does
not apply to Huawei devices like the HP branded lt4112 (Huawei me906e).
Huawei firmwares will dynamically assign interface numbers. Functions
are renumbered when the firmware is reconfigured.

Fix by changing the DEVICE_HWI type to use a simplified version
of Huawei's subclass + protocol scheme: Blacklisting known network
interface combinations and assuming the rest are serial.

Reported-and-tested-by: Muri Nicanor <muri+libqmi@immerda.ch>
Tested-by: Martin Hauke <mardnh@gmx.de>
Fixes: e7181d005e84 ("USB: qcserial: Add support for HP lt4112 LTE/HSPA+ Gobi 4G Modem")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/qcserial.c | 54 +++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 1d7a2a48552c..514fa91cf74e 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -212,6 +212,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 	__u8 ifnum;
 	int altsetting = -1;
 
+	/* we only support vendor specific functions */
+	if (intf->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
+		goto done;
+
 	nintf = serial->dev->actconfig->desc.bNumInterfaces;
 	dev_dbg(dev, "Num Interfaces = %d\n", nintf);
 	ifnum = intf->desc.bInterfaceNumber;
@@ -337,29 +341,39 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 		break;
 	case QCSERIAL_HWI:
 		/*
-		 * Huawei layout:
-		 * 0: AT-capable modem port
-		 * 1: DM/DIAG
-		 * 2: AT-capable modem port
-		 * 3: CCID-compatible PCSC interface
-		 * 4: QMI/net
-		 * 5: NMEA
+		 * Huawei devices map functions by subclass + protocol
+		 * instead of interface numbers. The protocol identify
+		 * a specific function, while the subclass indicate a
+		 * specific firmware source
+		 *
+		 * This is a blacklist of functions known to be
+		 * non-serial.  The rest are assumed to be serial and
+		 * will be handled by this driver
 		 */
-		switch (ifnum) {
-		case 0:
-		case 2:
-			dev_dbg(dev, "Modem port found\n");
-			break;
-		case 1:
-			dev_dbg(dev, "DM/DIAG interface found\n");
-			break;
-		case 5:
-			dev_dbg(dev, "NMEA GPS interface found\n");
-			break;
-		default:
-			/* don't claim any unsupported interface */
+		switch (intf->desc.bInterfaceProtocol) {
+			/* QMI combined (qmi_wwan) */
+		case 0x07:
+		case 0x37:
+		case 0x67:
+			/* QMI data (qmi_wwan) */
+		case 0x08:
+		case 0x38:
+		case 0x68:
+			/* QMI control (qmi_wwan) */
+		case 0x09:
+		case 0x39:
+		case 0x69:
+			/* NCM like (huawei_cdc_ncm) */
+		case 0x16:
+		case 0x46:
+		case 0x76:
 			altsetting = -1;
 			break;
+		default:
+			dev_dbg(dev, "Huawei type serial port found (%02x/%02x/%02x)\n",
+				intf->desc.bInterfaceClass,
+				intf->desc.bInterfaceSubClass,
+				intf->desc.bInterfaceProtocol);
 		}
 		break;
 	default:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 014/126] arm64: kernel: pause/unpause function graph tracer in cpu_suspend()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 013/126] USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 015/126] usb: dwc3: gadget: let us set lower max_speed Luis Henriques
                   ` (111 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lorenzo Pieralisi, Will Deacon, Catalin Marinas, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

commit de818bd4522c40ea02a81b387d2fa86f989c9623 upstream.

The function graph tracer adds instrumentation that is required to trace
both entry and exit of a function. In particular the function graph
tracer updates the "return address" of a function in order to insert
a trace callback on function exit.

Kernel power management functions like cpu_suspend() are called
upon power down entry with functions called "finishers" that are in turn
called to trigger the power down sequence but they may not return to the
kernel through the normal return path.

When the core resumes from low-power it returns to the cpu_suspend()
function through the cpu_resume path, which leaves the trace stack frame
set-up by the function tracer in an incosistent state upon return to the
kernel when tracing is enabled.

This patch fixes the issue by pausing/resuming the function graph
tracer on the thread executing cpu_suspend() (ie the function call that
subsequently triggers the "suspend finishers"), so that the function graph
tracer state is kept consistent across functions that enter power down
states and never return by effectively disabling graph tracer while they
are executing.

Fixes: 819e50e25d0c ("arm64: Add ftrace support")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/kernel/suspend.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 2d6b6065fe7f..23e35de789f7 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -1,3 +1,4 @@
+#include <linux/ftrace.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
@@ -92,6 +93,13 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
 	local_dbg_save(flags);
 
 	/*
+	 * Function graph tracer state gets incosistent when the kernel
+	 * calls functions that never return (aka suspend finishers) hence
+	 * disable graph tracing during their execution.
+	 */
+	pause_graph_tracing();
+
+	/*
 	 * mm context saved on the stack, it will be restored when
 	 * the cpu comes out of reset through the identity mapped
 	 * page tables, so that the thread address space is properly
@@ -128,6 +136,8 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
 			hw_breakpoint_restore(NULL);
 	}
 
+	unpause_graph_tracing();
+
 	/*
 	 * Restore pstate flags. OS lock and mdscr have been already
 	 * restored, so from this point onwards, debugging is fully

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 015/126] usb: dwc3: gadget: let us set lower max_speed
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (13 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 014/126] arm64: kernel: pause/unpause function graph tracer in cpu_suspend() Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 016/126] usb: chipidea: debug: disable usb irq while role switch Luis Henriques
                   ` (110 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben McCauley, Felipe Balbi, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben McCauley <ben.mccauley@garmin.com>

commit b9e51b2b1fda19143f48d182ed7a2943f21e1ae4 upstream.

In some SoCs, dwc3 is implemented as a USB2.0 only
core, meaning that it can't ever achieve SuperSpeed.

Currect driver always sets gadget.max_speed to
USB_SPEED_SUPER unconditionally. This can causes
issues to some Host stacks where the host will issue
a GetBOS() request and we will reply with a BOS
containing Superspeed Capability Descriptor.

At least Windows seems to be upset by this fact and
prints a warning that we should connect $this device
to another port.

[ balbi@ti.com : rewrote entire commit, including
source code comment to make a lot clearer what the
problem is ]

Signed-off-by: Ben McCauley <ben.mccauley@garmin.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - used dev_vdbg() instead of dwc3_trace() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/dwc3/gadget.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8946e34cef63..186a79d43250 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2786,12 +2786,33 @@ int dwc3_gadget_init(struct dwc3 *dwc)
 	}
 
 	dwc->gadget.ops			= &dwc3_gadget_ops;
-	dwc->gadget.max_speed		= USB_SPEED_SUPER;
 	dwc->gadget.speed		= USB_SPEED_UNKNOWN;
 	dwc->gadget.sg_supported	= true;
 	dwc->gadget.name		= "dwc3-gadget";
 
 	/*
+	 * FIXME We might be setting max_speed to <SUPER, however versions
+	 * <2.20a of dwc3 have an issue with metastability (documented
+	 * elsewhere in this driver) which tells us we can't set max speed to
+	 * anything lower than SUPER.
+	 *
+	 * Because gadget.max_speed is only used by composite.c and function
+	 * drivers (i.e. it won't go into dwc3's registers) we are allowing this
+	 * to happen so we avoid sending SuperSpeed Capability descriptor
+	 * together with our BOS descriptor as that could confuse host into
+	 * thinking we can handle super speed.
+	 *
+	 * Note that, in fact, we won't even support GetBOS requests when speed
+	 * is less than super speed because we don't have means, yet, to tell
+	 * composite.c that we are USB 2.0 + LPM ECN.
+	 */
+	if (dwc->revision < DWC3_REVISION_220A)
+		dev_vdbg(dwc->dev, "Changing max_speed on rev %08x\n",
+			 dwc->revision);
+
+	dwc->gadget.max_speed		= dwc->maximum_speed;
+
+	/*
 	 * Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize
 	 * on ep out.
 	 */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 016/126] usb: chipidea: debug: disable usb irq while role switch
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 015/126] usb: dwc3: gadget: let us set lower max_speed Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 017/126] xhci: Workaround to get Intel xHCI reset working more reliably Luis Henriques
                   ` (109 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Li Jun, Peter Chen, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Li Jun <jun.li@freescale.com>

commit 251b3c8b57481bcecd3f753108e36e7389ce12ac upstream.

Since the ci->role will be set after the host role start is complete, there
will be nobody cared irq during start host if usb irq enabled. This error
can be reproduced on i.mx6 sololite EVK board by:
1. disable otg id irq(IDIE) and disable all real otg properties of usbotg1
   in dts.
2. boot up the board with ID cable and usb device connected.
3. echo gadget > /sys/kernel/debug/ci_hdrc.0/role
4. echo host > /sys/kernel/debug/ci_hdrc.0/role
5. irq 212: nobody cared.

Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/chipidea/debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index 7cccab6ff308..09a54c731852 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -312,8 +312,10 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf,
 	if (role == CI_ROLE_END || role == ci->role)
 		return -EINVAL;
 
+	disable_irq(ci->irq);
 	ci_role_stop(ci);
 	ret = ci_role_start(ci, role);
+	enable_irq(ci->irq);
 
 	return ret ? ret : count;
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 017/126] xhci: Workaround to get Intel xHCI reset working more reliably
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 016/126] usb: chipidea: debug: disable usb irq while role switch Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 018/126] xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices Luis Henriques
                   ` (108 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rajmohan Mani, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rajmohan Mani <rajmohan.mani@intel.com>

commit a5964396190d0c40dd549c23848c282fffa5d1f2 upstream.

Existing Intel xHCI controllers require a delay of 1 mS,
after setting the CMD_RESET bit in command register, before
accessing any HC registers. This allows the HC to complete
the reset operation and be ready for HC register access.
Without this delay, the subsequent HC register access,
may result in a system hang, very rarely.

Verified CherryView / Braswell platforms go through over
5000 warm reboot cycles (which was not possible without
this patch), without any xHCI reset hang.

Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c71ee5ac6416..ddece5ecd6fb 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -176,6 +176,16 @@ int xhci_reset(struct xhci_hcd *xhci)
 	command |= CMD_RESET;
 	writel(command, &xhci->op_regs->command);
 
+	/* Existing Intel xHCI controllers require a delay of 1 mS,
+	 * after setting the CMD_RESET bit, and before accessing any
+	 * HC registers. This allows the HC to complete the
+	 * reset operation and be ready for HC register access.
+	 * Without this delay, the subsequent HC register access,
+	 * may result in a system hang very rarely.
+	 */
+	if (xhci->quirks & XHCI_INTEL_HOST)
+		udelay(1000);
+
 	ret = xhci_handshake(xhci, &xhci->op_regs->command,
 			CMD_RESET, 0, 10 * 1000 * 1000);
 	if (ret)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 018/126] xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 017/126] xhci: Workaround to get Intel xHCI reset working more reliably Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35   ` Luis Henriques
                   ` (107 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit dad67d5f3d0efe01d38c6cebcb6698280e51927b upstream.

Clear device initiated resume variables once device is fully up and running
in U0 state.

Resume needs to be signaled for 20ms for usb2 devices before they can be
moved to U0 state.

An interrupt is triggered if a device initiates resume. As we handle the
event in interrupt context we can not sleep for 20ms, so we instead set
a resume flag, a timestamp, and start the roothub polling.

The roothub code will later move the port to U0 when it finds a port in
resume state with the resume flag set, and timestamp passed by 20ms.

A host initiated resume is however not done in interrupt context, and
host initiated resume code will directly signal resume, wait 20ms and then
move the port to U0.

These two codepaths can race, if we are in the middle of a host initated
resume, while sleeping for 20ms, we may handle a port event and find the
port in resume state. The port event handling code will assume the resume
was device initiated and set the resume flag and timestamp.

Root hub code will however not catch the port in resume state again as the
host initated resume code has already moved the port to U0.
The resume flag and timestamp will remain set for this port preventing port
from suspending again  (LPM setting port to U3)

Fix this for now by always clearing the device initated resume parameters
once port is in U0

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-hub.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 514d5b8f15c1..625fdd8b3537 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -658,12 +658,15 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
 			status |= USB_PORT_STAT_SUSPEND;
 		}
 	}
-	if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0
-			&& (raw_port_status & PORT_POWER)
-			&& (bus_state->suspended_ports & (1 << wIndex))) {
-		bus_state->suspended_ports &= ~(1 << wIndex);
-		if (hcd->speed != HCD_USB3)
-			bus_state->port_c_suspend |= 1 << wIndex;
+	if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0 &&
+	    (raw_port_status & PORT_POWER)) {
+		if (bus_state->suspended_ports & (1 << wIndex)) {
+			bus_state->suspended_ports &= ~(1 << wIndex);
+			if (hcd->speed != HCD_USB3)
+				bus_state->port_c_suspend |= 1 << wIndex;
+		}
+		bus_state->resume_done[wIndex] = 0;
+		clear_bit(wIndex, &bus_state->resuming_ports);
 	}
 	if (raw_port_status & PORT_CONNECT) {
 		status |= USB_PORT_STAT_CONNECTION;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 019/126] x86/cpu: Fix SMAP check in PVOPS environments
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
@ 2016-01-06 10:35   ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 002/126] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Luis Henriques
                     ` (124 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrew Cooper, Rusty Russell, Konrad Rzeszutek Wilk,
	Boris Ostrovsky, lguest, Xen-devel, Thomas Gleixner,
	Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrew Cooper <andrew.cooper3@citrix.com>

commit 581b7f158fe0383b492acd1ce3fb4e99d4e57808 upstream.

There appears to be no formal statement of what pv_irq_ops.save_fl() is
supposed to return precisely.  Native returns the full flags, while lguest and
Xen only return the Interrupt Flag, and both have comments by the
implementations stating that only the Interrupt Flag is looked at.  This may
have been true when initially implemented, but no longer is.

To make matters worse, the Xen PVOP leaves the upper bits undefined, making
the BUG_ON() undefined behaviour.  Experimentally, this now trips for 32bit PV
guests on Broadwell hardware.  The BUG_ON() is consistent for an individual
build, but not consistent for all builds.  It has also been a sitting timebomb
since SMAP support was introduced.

Use native_save_fl() instead, which will obtain an accurate view of the AC
flag.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: <lguest@lists.ozlabs.org>
Cc: Xen-devel <xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/1433323874-6927-1-git-send-email-andrew.cooper3@citrix.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/cpu/common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8fc57acf86f4..3b12b4d1a560 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -282,10 +282,9 @@ __setup("nosmap", setup_disable_smap);
 
 static __always_inline void setup_smap(struct cpuinfo_x86 *c)
 {
-	unsigned long eflags;
+	unsigned long eflags = native_save_fl();
 
 	/* This should have been cleared long ago */
-	raw_local_save_flags(eflags);
 	BUG_ON(eflags & X86_EFLAGS_AC);
 
 	if (cpu_has(c, X86_FEATURE_SMAP)) {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 019/126] x86/cpu: Fix SMAP check in PVOPS environments
@ 2016-01-06 10:35   ` Luis Henriques
  0 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: lguest, Luis Henriques, Andrew Cooper, Rusty Russell, Xen-devel,
	Boris Ostrovsky, Thomas Gleixner

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrew Cooper <andrew.cooper3@citrix.com>

commit 581b7f158fe0383b492acd1ce3fb4e99d4e57808 upstream.

There appears to be no formal statement of what pv_irq_ops.save_fl() is
supposed to return precisely.  Native returns the full flags, while lguest and
Xen only return the Interrupt Flag, and both have comments by the
implementations stating that only the Interrupt Flag is looked at.  This may
have been true when initially implemented, but no longer is.

To make matters worse, the Xen PVOP leaves the upper bits undefined, making
the BUG_ON() undefined behaviour.  Experimentally, this now trips for 32bit PV
guests on Broadwell hardware.  The BUG_ON() is consistent for an individual
build, but not consistent for all builds.  It has also been a sitting timebomb
since SMAP support was introduced.

Use native_save_fl() instead, which will obtain an accurate view of the AC
flag.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: <lguest@lists.ozlabs.org>
Cc: Xen-devel <xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/1433323874-6927-1-git-send-email-andrew.cooper3@citrix.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/cpu/common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8fc57acf86f4..3b12b4d1a560 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -282,10 +282,9 @@ __setup("nosmap", setup_disable_smap);
 
 static __always_inline void setup_smap(struct cpuinfo_x86 *c)
 {
-	unsigned long eflags;
+	unsigned long eflags = native_save_fl();
 
 	/* This should have been cleared long ago */
-	raw_local_save_flags(eflags);
 	BUG_ON(eflags & X86_EFLAGS_AC);
 
 	if (cpu_has(c, X86_FEATURE_SMAP)) {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 020/126] arm64: restore bogomips information in /proc/cpuinfo
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2016-01-06 10:35   ` Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 021/126] USB: option: add XS Stick W100-2 from 4G Systems Luis Henriques
                   ` (105 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yang Shi, Catalin Marinas, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yang Shi <yang.shi@linaro.org>

commit 92e788b749862ebe9920360513a718e5dd4da7a9 upstream.

As previously reported, some userspace applications depend on bogomips
showed by /proc/cpuinfo. Although there is much less legacy impact on
aarch64 than arm, it does break libvirt.

This patch reverts commit 326b16db9f69 ("arm64: delay: don't bother
reporting bogomips in /proc/cpuinfo"), but with some tweak due to
context change and without the pr_info().

Fixes: 326b16db9f69 ("arm64: delay: don't bother reporting bogomips in /proc/cpuinfo")
Signed-off-by: Yang Shi <yang.shi@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[ luis: backported to 3.16:
  - file rename: cpuinfo.c -> setup.c
  - linux/delay.h is already included
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/kernel/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 37655ae949b5..5da0da6e7cf0 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -502,6 +502,10 @@ static int c_show(struct seq_file *m, void *v)
 		seq_printf(m, "processor\t: %d\n", i);
 #endif
 
+		seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
+			   loops_per_jiffy / (500000UL/HZ),
+			   loops_per_jiffy / (5000UL/HZ) % 100);
+
 		/*
 		 * Dump out the common processor features in a single line.
 		 * Userspace should read the hwcaps with getauxval(AT_HWCAP)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 021/126] USB: option: add XS Stick W100-2 from 4G Systems
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 020/126] arm64: restore bogomips information in /proc/cpuinfo Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 022/126] usblp: do not set TASK_INTERRUPTIBLE before lock Luis Henriques
                   ` (104 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 638148e20c7f8f6e95017fdc13bce8549a6925e0 upstream.

Thomas reports
"
4gsystems sells two total different LTE-surfsticks under the same name.
..
The newer version of XS Stick W100 is from "omega"
..
Under windows the driver switches to the same ID, and uses MI03\6 for
network and MI01\6 for modem.
..
echo "1c9e 9b01" > /sys/bus/usb/drivers/qmi_wwan/new_id
echo "1c9e 9b01" > /sys/bus/usb-serial/drivers/option1/new_id

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1c9e ProdID=9b01 Rev=02.32
S:  Manufacturer=USB Modem
S:  Product=USB Modem
S:  SerialNumber=
C:  #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

Now all important things are there:

wwp0s29f7u2i3 (net), ttyUSB2 (at), cdc-wdm0 (qmi), ttyUSB1 (at)

There is also ttyUSB0, but it is not usable, at least not for at.

The device works well with qmi and ModemManager-NetworkManager.
"

Reported-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index fc49b8888789..43a16471f851 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -357,6 +357,7 @@ static void option_instat_callback(struct urb *urb);
 /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
  * It seems to contain a Qualcomm QSC6240/6290 chipset            */
 #define FOUR_G_SYSTEMS_PRODUCT_W14		0x9603
+#define FOUR_G_SYSTEMS_PRODUCT_W100		0x9b01
 
 /* iBall 3.5G connect wireless modem */
 #define IBALL_3_5G_CONNECT			0x9605
@@ -530,6 +531,11 @@ static const struct option_blacklist_info four_g_w14_blacklist = {
 	.sendsetup = BIT(0) | BIT(1),
 };
 
+static const struct option_blacklist_info four_g_w100_blacklist = {
+	.sendsetup = BIT(1) | BIT(2),
+	.reserved = BIT(3),
+};
+
 static const struct option_blacklist_info alcatel_x200_blacklist = {
 	.sendsetup = BIT(0) | BIT(1),
 	.reserved = BIT(4),
@@ -1654,6 +1660,9 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
   	  .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
   	},
+	{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100),
+	  .driver_info = (kernel_ulong_t)&four_g_w100_blacklist
+	},
 	{ USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 022/126] usblp: do not set TASK_INTERRUPTIBLE before lock
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 021/126] USB: option: add XS Stick W100-2 from 4G Systems Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 023/126] fat: fix fake_offset handling on error path Luis Henriques
                   ` (103 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Slaby, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Slaby <jslaby@suse.cz>

commit 19cd80a214821f4b558560ebd76bfb2c38b4f3d8 upstream.

It is not permitted to set task state before lock. usblp_wwait sets
the state to TASK_INTERRUPTIBLE and calls mutex_lock_interruptible.
Upon return from that function, the state will be TASK_RUNNING again.

This is clearly a bug and a warning is generated with LOCKDEP too:
WARNING: CPU: 1 PID: 5109 at kernel/sched/core.c:7404 __might_sleep+0x7d/0x90()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffffa0c588d0>] usblp_wwait+0xa0/0x310 [usblp]
Modules linked in: ...
CPU: 1 PID: 5109 Comm: captmon Tainted: G        W       4.2.5-0.gef2823b-default #1
Hardware name: LENOVO 23252SG/23252SG, BIOS G2ET33WW (1.13 ) 07/24/2012
 ffffffff81a4edce ffff880236ec7ba8 ffffffff81716651 0000000000000000
 ffff880236ec7bf8 ffff880236ec7be8 ffffffff8106e146 0000000000000282
 ffffffff81a50119 000000000000028b 0000000000000000 ffff8802dab7c508
Call Trace:
...
 [<ffffffff8106e1c6>] warn_slowpath_fmt+0x46/0x50
 [<ffffffff8109a8bd>] __might_sleep+0x7d/0x90
 [<ffffffff8171b20f>] mutex_lock_interruptible_nested+0x2f/0x4b0
 [<ffffffffa0c588fc>] usblp_wwait+0xcc/0x310 [usblp]
 [<ffffffffa0c58bb2>] usblp_write+0x72/0x350 [usblp]
 [<ffffffff8121ed98>] __vfs_write+0x28/0xf0
...

Commit 7f477358e2384c54b190cc3b6ce28277050a041b (usblp: Implement the
ENOSPC convention) moved the set prior locking. So move it back after
the lock.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Fixes: 7f477358e2 ("usblp: Implement the ENOSPC convention")
Acked-By: Pete Zaitcev <zaitcev@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/class/usblp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 0924ee40a966..b9adc2ec49dd 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -869,11 +869,11 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
 
 	add_wait_queue(&usblp->wwait, &waita);
 	for (;;) {
-		set_current_state(TASK_INTERRUPTIBLE);
 		if (mutex_lock_interruptible(&usblp->mut)) {
 			rc = -EINTR;
 			break;
 		}
+		set_current_state(TASK_INTERRUPTIBLE);
 		rc = usblp_wtest(usblp, nonblock);
 		mutex_unlock(&usblp->mut);
 		if (rc <= 0)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 023/126] fat: fix fake_offset handling on error path
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 022/126] usblp: do not set TASK_INTERRUPTIBLE before lock Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 024/126] kernel/signal.c: unexport sigsuspend() Luis Henriques
                   ` (102 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Weinberger, OGAWA Hirofumi, Andrew Morton,
	Linus Torvalds, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

commit 928a477102c4fc6739883415b66987207e3502f4 upstream.

For the root directory, .  and ..  are faked (using dir_emit_dots()) and
ctx->pos is reset from 2 to 0.

A corrupted root directory could cause fat_get_entry() to fail, but
->iterate() (fat_readdir()) reports progress to the VFS (with ctx->pos
rewound to 0), so any following calls to ->iterate() continue to return
the same entries again and again.

The result is that userspace will never see the end of the directory,
causing e.g.  'ls' to hang in a getdents() loop.

[hirofumi@mail.parknet.co.jp: cleanup and make sure to correct fake_offset]
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Richard Weinberger <richard.weinberger@gmail.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fat/dir.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 3963ede84eb0..75bf5e717ed8 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -614,9 +614,9 @@ parse_record:
 		int status = fat_parse_long(inode, &cpos, &bh, &de,
 					    &unicode, &nr_slots);
 		if (status < 0) {
-			ctx->pos = cpos;
+			bh = NULL;
 			ret = status;
-			goto out;
+			goto end_of_dir;
 		} else if (status == PARSE_INVALID)
 			goto record_end;
 		else if (status == PARSE_NOT_LONGNAME)
@@ -658,8 +658,9 @@ parse_record:
 	fill_len = short_len;
 
 start_filldir:
-	if (!fake_offset)
-		ctx->pos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry);
+	ctx->pos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry);
+	if (fake_offset && ctx->pos < 2)
+		ctx->pos = 2;
 
 	if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME)) {
 		if (!dir_emit_dot(file, ctx))
@@ -685,14 +686,19 @@ record_end:
 	fake_offset = 0;
 	ctx->pos = cpos;
 	goto get_new;
+
 end_of_dir:
-	ctx->pos = cpos;
+	if (fake_offset && cpos < 2)
+		ctx->pos = 2;
+	else
+		ctx->pos = cpos;
 fill_failed:
 	brelse(bh);
 	if (unicode)
 		__putname(unicode);
 out:
 	mutex_unlock(&sbi->s_lock);
+
 	return ret;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 024/126] kernel/signal.c: unexport sigsuspend()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 023/126] fat: fix fake_offset handling on error path Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 025/126] ocfs2: fix umask ignored issue Luis Henriques
                   ` (101 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Weinberger, Andrew Morton, Linus Torvalds, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit 9d8a765211335cfdad464b90fb19f546af5706ae upstream.

sigsuspend() is nowhere used except in signal.c itself, so we can mark it
static do not pollute the global namespace.

But this patch is more than a boring cleanup patch, it fixes a real issue
on UserModeLinux.  UML has a special console driver to display ttys using
xterm, or other terminal emulators, on the host side.  Vegard reported
that sometimes UML is unable to spawn a xterm and he's facing the
following warning:

  WARNING: CPU: 0 PID: 908 at include/linux/thread_info.h:128 sigsuspend+0xab/0xc0()

It turned out that this warning makes absolutely no sense as the UML
xterm code calls sigsuspend() on the host side, at least it tries.  But
as the kernel itself offers a sigsuspend() symbol the linker choose this
one instead of the glibc wrapper.  Interestingly this code used to work
since ever but always blocked signals on the wrong side.  Some recent
kernel change made the WARN_ON() trigger and uncovered the bug.

It is a wonderful example of how much works by chance on computers. :-)

Fixes: 68f3f16d9ad0f1 ("new helper: sigsuspend()")
Signed-off-by: Richard Weinberger <richard@nod.at>
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/signal.h | 1 -
 kernel/signal.c        | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/signal.h b/include/linux/signal.h
index c9e65360c49a..aa2625788594 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -242,7 +242,6 @@ extern int sigprocmask(int, sigset_t *, sigset_t *);
 extern void set_current_blocked(sigset_t *);
 extern void __set_current_blocked(const sigset_t *);
 extern int show_unhandled_signals;
-extern int sigsuspend(sigset_t *);
 
 struct sigaction {
 #ifndef __ARCH_HAS_IRIX_SIGACTION
diff --git a/kernel/signal.c b/kernel/signal.c
index 720fad0817e4..6eb8466819b7 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3547,7 +3547,7 @@ SYSCALL_DEFINE0(pause)
 
 #endif
 
-int sigsuspend(sigset_t *set)
+static int sigsuspend(sigset_t *set)
 {
 	current->saved_sigmask = current->blocked;
 	set_current_blocked(set);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 025/126] ocfs2: fix umask ignored issue
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 024/126] kernel/signal.c: unexport sigsuspend() Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 026/126] parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h Luis Henriques
                   ` (100 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Junxiao Bi, Gang He, Mark Fasheh, Joel Becker, Andrew Morton,
	Linus Torvalds, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Junxiao Bi <junxiao.bi@oracle.com>

commit 8f1eb48758aacf6c1ffce18179295adbf3bd7640 upstream.

New created file's mode is not masked with umask, and this makes umask not
work for ocfs2 volume.

Fixes: 702e5bc ("ocfs2: use generic posix ACL infrastructure")
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Gang He <ghe@suse.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ocfs2/namei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index a997d7f40608..dbf21ca69ee8 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -361,6 +361,8 @@ static int ocfs2_mknod(struct inode *dir,
 		mlog_errno(status);
 		goto leave;
 	}
+	/* update inode->i_mode after mask with "umask". */
+	inode->i_mode = mode;
 
 	handle = ocfs2_start_trans(osb, ocfs2_mknod_credits(osb->sb,
 							    S_ISDIR(mode),

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 026/126] parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 025/126] ocfs2: fix umask ignored issue Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 027/126] mmc: remove bondage between REQ_META and reliable write Luis Henriques
                   ` (99 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Helge Deller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Helge Deller <deller@gmx.de>

commit dcbf0d299c00ed4f82ea8d6e359ad88a5182f9b8 upstream.

Drop the MADV_xxK_PAGES flags, which were never used and were from a proposed
API which was never integrated into the generic Linux kernel code.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/parisc/include/uapi/asm/mman.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 294d251ca7b2..2ae13ce592e8 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -46,16 +46,6 @@
 #define MADV_DONTFORK	10		/* don't inherit across fork */
 #define MADV_DOFORK	11		/* do inherit across fork */
 
-/* The range 12-64 is reserved for page size specification. */
-#define MADV_4K_PAGES   12              /* Use 4K pages  */
-#define MADV_16K_PAGES  14              /* Use 16K pages */
-#define MADV_64K_PAGES  16              /* Use 64K pages */
-#define MADV_256K_PAGES 18              /* Use 256K pages */
-#define MADV_1M_PAGES   20              /* Use 1 Megabyte pages */
-#define MADV_4M_PAGES   22              /* Use 4 Megabyte pages */
-#define MADV_16M_PAGES  24              /* Use 16 Megabyte pages */
-#define MADV_64M_PAGES  26              /* Use 64 Megabyte pages */
-
 #define MADV_MERGEABLE   65		/* KSM may merge identical pages */
 #define MADV_UNMERGEABLE 66		/* KSM may not merge identical pages */
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 027/126] mmc: remove bondage between REQ_META and reliable write
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 026/126] parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 028/126] tools/net: Use include/uapi with __EXPORTED_HEADERS__ Luis Henriques
                   ` (98 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bruce Ford, Luca Porzio, Ulf Hansson, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Luca Porzio <lporzio@micron.com>

commit d3df0465db00cf4ed9f90d0bfc3b827d32b9c796 upstream.

Anytime a write operation is performed with Reliable Write flag enabled,
the eMMC device is enforced to bypass the cache and do a write to the
underling NVM device by Jedec specification; this causes a performance
penalty since write operations can't be optimized by the device cache.

In our tests, we replayed a typical mobile daily trace pattern and found
~9% overall time reduction in trace replay by using this patch. Also the
write ops within 4KB~64KB chunk size range get a 40~60% performance
improvement by using the patch (as this range of write chunks are the ones
affected by REQ_META).

This patch has been discussed in the Mobile & Embedded Linux Storage Forum
and it's the results of feedbacks from many people. We also checked with
fsdevl and f2fs mailing list developers that this change in the usage of
REQ_META is not affecting FS behavior and we got positive feedbacks.
Reporting here the feedbacks:
http://comments.gmane.org/gmane.linux.file-systems/97219
http://thread.gmane.org/gmane.linux.file-systems.f2fs/3178/focus=3183

Signed-off-by: Bruce Ford <bford@micron.com>
Signed-off-by: Luca Porzio <lporzio@micron.com>
Fixes: ce39f9d17c14 ("mmc: support packed write command for eMMC4.5 devices")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mmc/card/block.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 96d2f08a2516..76efef5af670 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -62,8 +62,7 @@ MODULE_ALIAS("mmc:block");
 #define MMC_SANITIZE_REQ_TIMEOUT 240000
 #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
 
-#define mmc_req_rel_wr(req)	(((req->cmd_flags & REQ_FUA) || \
-				  (req->cmd_flags & REQ_META)) && \
+#define mmc_req_rel_wr(req)	((req->cmd_flags & REQ_FUA) && \
 				  (rq_data_dir(req) == WRITE))
 #define PACKED_CMD_VER	0x01
 #define PACKED_CMD_WR	0x02
@@ -1372,13 +1371,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
 
 	/*
 	 * Reliable writes are used to implement Forced Unit Access and
-	 * REQ_META accesses, and are supported only on MMCs.
-	 *
-	 * XXX: this really needs a good explanation of why REQ_META
-	 * is treated special.
+	 * are supported only on MMCs.
 	 */
-	bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
-			  (req->cmd_flags & REQ_META)) &&
+	bool do_rel_wr = (req->cmd_flags & REQ_FUA) &&
 		(rq_data_dir(req) == WRITE) &&
 		(md->flags & MMC_BLK_REL_WR);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 028/126] tools/net: Use include/uapi with __EXPORTED_HEADERS__
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 027/126] mmc: remove bondage between REQ_META and reliable write Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 029/126] packet: do skb_probe_transport_header when we actually have data Luis Henriques
                   ` (97 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kamal Mostafa, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kamal Mostafa <kamal@canonical.com>

commit d7475de58575c904818efa369c82e88c6648ce2e upstream.

Use the local uapi headers to keep in sync with "recently" added #define's
(e.g. SKF_AD_VLAN_TPID).  Refactored CFLAGS, and bpf_asm doesn't need -I.

Fixes: 3f356385e8a4 ("filter: bpf_asm: add minimal bpf asm tool")
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/net/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/net/Makefile b/tools/net/Makefile
index ee577ea03ba5..ddf888010652 100644
--- a/tools/net/Makefile
+++ b/tools/net/Makefile
@@ -4,6 +4,9 @@ CC = gcc
 LEX = flex
 YACC = bison
 
+CFLAGS += -Wall -O2
+CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
+
 %.yacc.c: %.y
 	$(YACC) -o $@ -d $<
 
@@ -12,15 +15,13 @@ YACC = bison
 
 all : bpf_jit_disasm bpf_dbg bpf_asm
 
-bpf_jit_disasm : CFLAGS = -Wall -O2 -DPACKAGE='bpf_jit_disasm'
+bpf_jit_disasm : CFLAGS += -DPACKAGE='bpf_jit_disasm'
 bpf_jit_disasm : LDLIBS = -lopcodes -lbfd -ldl
 bpf_jit_disasm : bpf_jit_disasm.o
 
-bpf_dbg : CFLAGS = -Wall -O2
 bpf_dbg : LDLIBS = -lreadline
 bpf_dbg : bpf_dbg.o
 
-bpf_asm : CFLAGS = -Wall -O2 -I.
 bpf_asm : LDLIBS =
 bpf_asm : bpf_asm.o bpf_exp.yacc.o bpf_exp.lex.o
 bpf_exp.lex.o : bpf_exp.yacc.c

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 029/126] packet: do skb_probe_transport_header when we actually have data
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 028/126] tools/net: Use include/uapi with __EXPORTED_HEADERS__ Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 030/126] packet: only allow extra vlan len on ethernet devices Luis Henriques
                   ` (96 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit efdfa2f7848f64517008136fb41f53c4a1faf93a upstream.

In tpacket_fill_skb() commit c1aad275b029 ("packet: set transport
header before doing xmit") and later on 40893fd0fd4e ("net: switch
to use skb_probe_transport_header()") was probing for a transport
header on the skb from a ring buffer slot, but at a time, where
the skb has _not even_ been filled with data yet. So that call into
the flow dissector is pretty useless. Lets do it after we've set
up the skb frags.

Fixes: c1aad275b029 ("packet: set transport header before doing xmit")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1f618bbce0ac..fc94622f755c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2127,8 +2127,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
 	skb_reserve(skb, hlen);
 	skb_reset_network_header(skb);
 
-	if (!packet_use_direct_xmit(po))
-		skb_probe_transport_header(skb, 0);
 	if (unlikely(po->tp_tx_has_off)) {
 		int off_min, off_max, off;
 		off_min = po->tp_hdrlen - sizeof(struct sockaddr_ll);
@@ -2212,6 +2210,9 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
 		len = ((to_write > len_max) ? len_max : to_write);
 	}
 
+	if (!packet_use_direct_xmit(po))
+		skb_probe_transport_header(skb, 0);
+
 	return tp_len;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 030/126] packet: only allow extra vlan len on ethernet devices
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 029/126] packet: do skb_probe_transport_header when we actually have data Luis Henriques
@ 2016-01-06 10:35 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 031/126] packet: fix tpacket_snd max frame len Luis Henriques
                   ` (95 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:35 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 3c70c132488794e2489ab045559b0ce0afcf17de upstream.

Packet sockets can be used by various net devices and are not
really restricted to ARPHRD_ETHER device types. However, when
currently checking for the extra 4 bytes that can be transmitted
in VLAN case, our assumption is that we generally probe on
ARPHRD_ETHER devices. Therefore, before looking into Ethernet
header, check the device type first.

This also fixes the issue where non-ARPHRD_ETHER devices could
have no dev->hard_header_len in TX_RING SOCK_RAW case, and thus
the check would test unfilled linear part of the skb (instead
of non-linear).

Fixes: 57f89bfa2140 ("network: Allow af_packet to transmit +4 bytes for VLAN packets.")
Fixes: 52f1454f629f ("packet: allow to transmit +4 byte in TX_RING slot for VLAN case")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 60 +++++++++++++++++++++-----------------------------
 1 file changed, 25 insertions(+), 35 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index fc94622f755c..92bb65796fb4 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1517,6 +1517,20 @@ static void fanout_release(struct sock *sk)
 	mutex_unlock(&fanout_mutex);
 }
 
+static bool packet_extra_vlan_len_allowed(const struct net_device *dev,
+					  struct sk_buff *skb)
+{
+	/* Earlier code assumed this would be a VLAN pkt, double-check
+	 * this now that we have the actual packet in hand. We can only
+	 * do this check on Ethernet devices.
+	 */
+	if (unlikely(dev->type != ARPHRD_ETHER))
+		return false;
+
+	skb_reset_mac_header(skb);
+	return likely(eth_hdr(skb)->h_proto == htons(ETH_P_8021Q));
+}
+
 static const struct proto_ops packet_ops;
 
 static const struct proto_ops packet_ops_spkt;
@@ -1678,18 +1692,10 @@ retry:
 		goto retry;
 	}
 
-	if (len > (dev->mtu + dev->hard_header_len + extra_len)) {
-		/* Earlier code assumed this would be a VLAN pkt,
-		 * double-check this now that we have the actual
-		 * packet in hand.
-		 */
-		struct ethhdr *ehdr;
-		skb_reset_mac_header(skb);
-		ehdr = eth_hdr(skb);
-		if (ehdr->h_proto != htons(ETH_P_8021Q)) {
-			err = -EMSGSIZE;
-			goto out_unlock;
-		}
+	if (len > (dev->mtu + dev->hard_header_len + extra_len) &&
+	    !packet_extra_vlan_len_allowed(dev, skb)) {
+		err = -EMSGSIZE;
+		goto out_unlock;
 	}
 
 	skb->protocol = proto;
@@ -2286,18 +2292,10 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
 		tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto,
 					  addr, hlen);
 		if (likely(tp_len >= 0) &&
-		    tp_len > dev->mtu + dev->hard_header_len) {
-			struct ethhdr *ehdr;
-			/* Earlier code assumed this would be a VLAN pkt,
-			 * double-check this now that we have the actual
-			 * packet in hand.
-			 */
+		    tp_len > dev->mtu + dev->hard_header_len &&
+		    !packet_extra_vlan_len_allowed(dev, skb))
+			tp_len = -EMSGSIZE;
 
-			skb_reset_mac_header(skb);
-			ehdr = eth_hdr(skb);
-			if (ehdr->h_proto != htons(ETH_P_8021Q))
-				tp_len = -EMSGSIZE;
-		}
 		if (unlikely(tp_len < 0)) {
 			if (po->tp_loss) {
 				__packet_set_status(po, ph,
@@ -2509,18 +2507,10 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
 
 	sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
 
-	if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
-		/* Earlier code assumed this would be a VLAN pkt,
-		 * double-check this now that we have the actual
-		 * packet in hand.
-		 */
-		struct ethhdr *ehdr;
-		skb_reset_mac_header(skb);
-		ehdr = eth_hdr(skb);
-		if (ehdr->h_proto != htons(ETH_P_8021Q)) {
-			err = -EMSGSIZE;
-			goto out_free;
-		}
+	if (!gso_type && (len > dev->mtu + reserve + extra_len) &&
+	    !packet_extra_vlan_len_allowed(dev, skb)) {
+		err = -EMSGSIZE;
+		goto out_free;
 	}
 
 	skb->protocol = proto;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 031/126] packet: fix tpacket_snd max frame len
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2016-01-06 10:35 ` [PATCH 3.16.y-ckt 030/126] packet: only allow extra vlan len on ethernet devices Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 032/126] sctp: translate host order to network order when setting a hmacid Luis Henriques
                   ` (94 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 5cfb4c8d05b4409c4044cb9c05b19705c1d9818b upstream.

Since it's introduction in commit 69e3c75f4d54 ("net: TX_RING and
packet mmap"), TX_RING could be used from SOCK_DGRAM and SOCK_RAW
side. When used with SOCK_DGRAM only, the size_max > dev->mtu +
reserve check should have reserve as 0, but currently, this is
unconditionally set (in it's original form as dev->hard_header_len).

I think this is not correct since tpacket_fill_skb() would then
take dev->mtu and dev->hard_header_len into account for SOCK_DGRAM,
the extra VLAN_HLEN could be possible in both cases. Presumably, the
reserve code was copied from packet_snd(), but later on missed the
check. Make it similar as we have it in packet_snd().

Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 92bb65796fb4..ede33f60991a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2263,12 +2263,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
 	if (unlikely(!(dev->flags & IFF_UP)))
 		goto out_put;
 
-	reserve = dev->hard_header_len + VLAN_HLEN;
+	if (po->sk.sk_socket->type == SOCK_RAW)
+		reserve = dev->hard_header_len;
 	size_max = po->tx_ring.frame_size
 		- (po->tp_hdrlen - sizeof(struct sockaddr_ll));
 
-	if (size_max > dev->mtu + reserve)
-		size_max = dev->mtu + reserve;
+	if (size_max > dev->mtu + reserve + VLAN_HLEN)
+		size_max = dev->mtu + reserve + VLAN_HLEN;
 
 	do {
 		ph = packet_current_frame(po, &po->tx_ring,
@@ -2292,7 +2293,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
 		tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto,
 					  addr, hlen);
 		if (likely(tp_len >= 0) &&
-		    tp_len > dev->mtu + dev->hard_header_len &&
+		    tp_len > dev->mtu + reserve &&
 		    !packet_extra_vlan_len_allowed(dev, skb))
 			tp_len = -EMSGSIZE;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 032/126] sctp: translate host order to network order when setting a hmacid
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 031/126] packet: fix tpacket_snd max frame len Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 033/126] net/mlx4_core: Avoid returning success in case of an error flow Luis Henriques
                   ` (93 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Xin Long, Marcelo Ricardo Leitner, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: lucien <lucien.xin@gmail.com>

commit ed5a377d87dc4c87fb3e1f7f698cba38cd893103 upstream.

now sctp auth cannot work well when setting a hmacid manually, which
is caused by that we didn't use the network order for hmacid, so fix
it by adding the transformation in sctp_auth_ep_set_hmacs.

even we set hmacid with the network order in userspace, it still
can't work, because of this condition in sctp_auth_ep_set_hmacs():

		if (id > SCTP_AUTH_HMAC_ID_MAX)
			return -EOPNOTSUPP;

so this wasn't working before and thus it won't break compatibility.

Fixes: 65b07e5d0d09 ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sctp/auth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index fb7976aee61c..603c3bbc5923 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -800,8 +800,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
 	if (!has_sha1)
 		return -EINVAL;
 
-	memcpy(ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0],
-		hmacs->shmac_num_idents * sizeof(__u16));
+	for (i = 0; i < hmacs->shmac_num_idents; i++)
+		ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]);
 	ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) +
 				hmacs->shmac_num_idents * sizeof(__u16));
 	return 0;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 033/126] net/mlx4_core: Avoid returning success in case of an error flow
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 032/126] sctp: translate host order to network order when setting a hmacid Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 034/126] usb: musb: core: fix order of arguments to ulpi write callback Luis Henriques
                   ` (92 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Noa Osherovich, Or Gerlitz, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Noa Osherovich <noaos@mellanox.com>

commit d49c2197fd70c37d57982804465268440a33183a upstream.

The err variable wasn't set with the correct error value in some cases.

Fixes: 47605df95398 ('mlx4: Modify proxy/tunnel QP mechanism [..]')
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 3bdc11e44ec3..a0c2155c47e8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -682,9 +682,10 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
 		dev->caps.qp1_proxy[i - 1] = func_cap.qp1_proxy_qpn;
 		dev->caps.port_mask[i] = dev->caps.port_type[i];
 		dev->caps.phys_port_id[i] = func_cap.phys_port_id;
-		if (mlx4_get_slave_pkey_gid_tbl_len(dev, i,
-						    &dev->caps.gid_table_len[i],
-						    &dev->caps.pkey_table_len[i]))
+		err = mlx4_get_slave_pkey_gid_tbl_len(dev, i,
+						      &dev->caps.gid_table_len[i],
+						      &dev->caps.pkey_table_len[i]);
+		if (err)
 			goto err_mem;
 	}
 
@@ -694,6 +695,7 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
 		mlx4_err(dev, "HCA reported UAR region size of 0x%x bigger than PCI resource 2 size of 0x%llx, aborting\n",
 			 dev->caps.uar_page_size * dev->caps.num_uars,
 			 (unsigned long long) pci_resource_len(dev->pdev, 2));
+		err = -ENOMEM;
 		goto err_mem;
 	}
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 034/126] usb: musb: core: fix order of arguments to ulpi write callback
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 033/126] net/mlx4_core: Avoid returning success in case of an error flow Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 035/126] FS-Cache: Add missing initialization of ret in cachefiles_write_page() Luis Henriques
                   ` (91 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Felipe Balbi, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit 705e63d2b29c8bbf091119084544d353bda70393 upstream.

There is a bit of a mess in the order of arguments to the ulpi write
callback. There is

	int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val)

in drivers/usb/common/ulpi.c;

	struct usb_phy_io_ops {
		...
		int (*write)(struct usb_phy *x, u32 val, u32 reg);
	}

in include/linux/usb/phy.h.

The callback registered by the musb driver has to comply to the latter,
but up to now had "offset" first which effectively made the function
broken for correct users. So flip the order and while at it also
switch to the parameter names of struct usb_phy_io_ops's write.

Fixes: ffb865b1e460 ("usb: musb: add ulpi access operations")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/musb/musb_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e2c34c83f409..28018270ec7d 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -132,7 +132,7 @@ static inline struct musb *dev_to_musb(struct device *dev)
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
-static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
+static int musb_ulpi_read(struct usb_phy *phy, u32 reg)
 {
 	void __iomem *addr = phy->io_priv;
 	int	i = 0;
@@ -151,7 +151,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
 	 * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM.
 	 */
 
-	musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset);
+	musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg);
 	musb_writeb(addr, MUSB_ULPI_REG_CONTROL,
 			MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR);
 
@@ -176,7 +176,7 @@ out:
 	return ret;
 }
 
-static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
+static int musb_ulpi_write(struct usb_phy *phy, u32 val, u32 reg)
 {
 	void __iomem *addr = phy->io_priv;
 	int	i = 0;
@@ -191,8 +191,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
 	power &= ~MUSB_POWER_SUSPENDM;
 	musb_writeb(addr, MUSB_POWER, power);
 
-	musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset);
-	musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data);
+	musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg);
+	musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)val);
 	musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ);
 
 	while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 035/126] FS-Cache: Add missing initialization of ret in cachefiles_write_page()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 034/126] usb: musb: core: fix order of arguments to ulpi write callback Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 036/126] macvlan: fix leak in macvlan_handle_frame Luis Henriques
                   ` (90 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geert Uytterhoeven, David Howells, Al Viro, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert@linux-m68k.org>

commit cf89752645e47d86ba8a4157f4b121fcb33434c5 upstream.

fs/cachefiles/rdwr.c: In function ‘cachefiles_write_page’:
fs/cachefiles/rdwr.c:882: warning: ‘ret’ may be used uninitialized in
this function

If the jump to label "error" is taken, "ret" will indeed be
uninitialized, and random stack data may be printed by the debug code.

Fixes: 102f4d900c9c8f5e ("FS-Cache: Handle a write to the page immediately beyond the EOF marker")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cachefiles/rdwr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 88483abe08d3..d2582ebce887 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -892,7 +892,7 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
 	loff_t pos, eof;
 	size_t len;
 	void *data;
-	int ret;
+	int ret = -ENOBUFS;
 
 	ASSERT(op != NULL);
 	ASSERT(page != NULL);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 036/126] macvlan: fix leak in macvlan_handle_frame
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 035/126] FS-Cache: Add missing initialization of ret in cachefiles_write_page() Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 037/126] ARC: Fix silly typo in MAINTAINERS file Luis Henriques
                   ` (89 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit e639b8d8a7a728f0b05ef2df6cb6b45dc3d4e556 upstream.

Reset pskb in macvlan_handle_frame in case skb_share_check returned a
clone.

Fixes: 8a4eb5734e8d ("net: introduce rx_handler results and logic around that")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/macvlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d4404e4cad41..bb33b0410a22 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -284,6 +284,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
 		skb = ip_check_defrag(skb, IP_DEFRAG_MACVLAN);
 		if (!skb)
 			return RX_HANDLER_CONSUMED;
+		*pskb = skb;
 		eth = eth_hdr(skb);
 		src = macvlan_hash_lookup(port, eth->h_source);
 		if (src && src->mode != MACVLAN_MODE_VEPA &&
@@ -319,6 +320,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
 	if (!skb)
 		goto out;
 
+	*pskb = skb;
 	skb->dev = dev;
 	skb->pkt_type = PACKET_HOST;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 037/126] ARC: Fix silly typo in MAINTAINERS file
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 036/126] macvlan: fix leak in macvlan_handle_frame Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 038/126] unix: avoid use-after-free in ep_remove_wait_queue Luis Henriques
                   ` (88 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vineet Gupta <vgupta@synopsys.com>

commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream.

Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e0b2f7c7f744..bfb8717ec735 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8752,7 +8752,7 @@ F:	include/linux/swiotlb.h
 
 SYNOPSYS ARC ARCHITECTURE
 M:	Vineet Gupta <vgupta@synopsys.com>
-L:	linux-snps-arc@lists.infraded.org
+L:	linux-snps-arc@lists.infradead.org
 S:	Supported
 F:	arch/arc/
 F:	Documentation/devicetree/bindings/arc/

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 038/126] unix: avoid use-after-free in ep_remove_wait_queue
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 037/126] ARC: Fix silly typo in MAINTAINERS file Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 039/126] packet: always probe for transport header Luis Henriques
                   ` (87 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rainer Weikusat, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rainer Weikusat <rweikusat@mobileactivedefense.com>

commit 7d267278a9ece963d77eefec61630223fce08c6c upstream.

Rainer Weikusat <rweikusat@mobileactivedefense.com> writes:
An AF_UNIX datagram socket being the client in an n:1 association with
some server socket is only allowed to send messages to the server if the
receive queue of this socket contains at most sk_max_ack_backlog
datagrams. This implies that prospective writers might be forced to go
to sleep despite none of the message presently enqueued on the server
receive queue were sent by them. In order to ensure that these will be
woken up once space becomes again available, the present unix_dgram_poll
routine does a second sock_poll_wait call with the peer_wait wait queue
of the server socket as queue argument (unix_dgram_recvmsg does a wake
up on this queue after a datagram was received). This is inherently
problematic because the server socket is only guaranteed to remain alive
for as long as the client still holds a reference to it. In case the
connection is dissolved via connect or by the dead peer detection logic
in unix_dgram_sendmsg, the server socket may be freed despite "the
polling mechanism" (in particular, epoll) still has a pointer to the
corresponding peer_wait queue. There's no way to forcibly deregister a
wait queue with epoll.

Based on an idea by Jason Baron, the patch below changes the code such
that a wait_queue_t belonging to the client socket is enqueued on the
peer_wait queue of the server whenever the peer receive queue full
condition is detected by either a sendmsg or a poll. A wake up on the
peer queue is then relayed to the ordinary wait queue of the client
socket via wake function. The connection to the peer wait queue is again
dissolved if either a wake up is about to be relayed or the client
socket reconnects or a dead peer is detected or the client socket is
itself closed. This enables removing the second sock_poll_wait from
unix_dgram_poll, thus avoiding the use-after-free, while still ensuring
that no blocked writer sleeps forever.

Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Fixes: ec0d215f9420 ("af_unix: fix 'poll for write'/connected DGRAM sockets")
Reviewed-by: Jason Baron <jbaron@akamai.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/af_unix.h |   1 +
 net/unix/af_unix.c    | 183 ++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 165 insertions(+), 19 deletions(-)

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index dfe4ddfbb43c..e830c3dff61a 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -63,6 +63,7 @@ struct unix_sock {
 #define UNIX_GC_CANDIDATE	0
 #define UNIX_GC_MAYBE_CYCLE	1
 	struct socket_wq	peer_wq;
+	wait_queue_t		peer_wake;
 };
 
 static inline struct unix_sock *unix_sk(struct sock *sk)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2ae4a5915aa7..9acfd79f0d13 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -316,6 +316,118 @@ found:
 	return s;
 }
 
+/* Support code for asymmetrically connected dgram sockets
+ *
+ * If a datagram socket is connected to a socket not itself connected
+ * to the first socket (eg, /dev/log), clients may only enqueue more
+ * messages if the present receive queue of the server socket is not
+ * "too large". This means there's a second writeability condition
+ * poll and sendmsg need to test. The dgram recv code will do a wake
+ * up on the peer_wait wait queue of a socket upon reception of a
+ * datagram which needs to be propagated to sleeping would-be writers
+ * since these might not have sent anything so far. This can't be
+ * accomplished via poll_wait because the lifetime of the server
+ * socket might be less than that of its clients if these break their
+ * association with it or if the server socket is closed while clients
+ * are still connected to it and there's no way to inform "a polling
+ * implementation" that it should let go of a certain wait queue
+ *
+ * In order to propagate a wake up, a wait_queue_t of the client
+ * socket is enqueued on the peer_wait queue of the server socket
+ * whose wake function does a wake_up on the ordinary client socket
+ * wait queue. This connection is established whenever a write (or
+ * poll for write) hit the flow control condition and broken when the
+ * association to the server socket is dissolved or after a wake up
+ * was relayed.
+ */
+
+static int unix_dgram_peer_wake_relay(wait_queue_t *q, unsigned mode, int flags,
+				      void *key)
+{
+	struct unix_sock *u;
+	wait_queue_head_t *u_sleep;
+
+	u = container_of(q, struct unix_sock, peer_wake);
+
+	__remove_wait_queue(&unix_sk(u->peer_wake.private)->peer_wait,
+			    q);
+	u->peer_wake.private = NULL;
+
+	/* relaying can only happen while the wq still exists */
+	u_sleep = sk_sleep(&u->sk);
+	if (u_sleep)
+		wake_up_interruptible_poll(u_sleep, key);
+
+	return 0;
+}
+
+static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
+{
+	struct unix_sock *u, *u_other;
+	int rc;
+
+	u = unix_sk(sk);
+	u_other = unix_sk(other);
+	rc = 0;
+	spin_lock(&u_other->peer_wait.lock);
+
+	if (!u->peer_wake.private) {
+		u->peer_wake.private = other;
+		__add_wait_queue(&u_other->peer_wait, &u->peer_wake);
+
+		rc = 1;
+	}
+
+	spin_unlock(&u_other->peer_wait.lock);
+	return rc;
+}
+
+static void unix_dgram_peer_wake_disconnect(struct sock *sk,
+					    struct sock *other)
+{
+	struct unix_sock *u, *u_other;
+
+	u = unix_sk(sk);
+	u_other = unix_sk(other);
+	spin_lock(&u_other->peer_wait.lock);
+
+	if (u->peer_wake.private == other) {
+		__remove_wait_queue(&u_other->peer_wait, &u->peer_wake);
+		u->peer_wake.private = NULL;
+	}
+
+	spin_unlock(&u_other->peer_wait.lock);
+}
+
+static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk,
+						   struct sock *other)
+{
+	unix_dgram_peer_wake_disconnect(sk, other);
+	wake_up_interruptible_poll(sk_sleep(sk),
+				   POLLOUT |
+				   POLLWRNORM |
+				   POLLWRBAND);
+}
+
+/* preconditions:
+ *	- unix_peer(sk) == other
+ *	- association is stable
+ */
+static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
+{
+	int connected;
+
+	connected = unix_dgram_peer_wake_connect(sk, other);
+
+	if (unix_recvq_full(other))
+		return 1;
+
+	if (connected)
+		unix_dgram_peer_wake_disconnect(sk, other);
+
+	return 0;
+}
+
 static inline int unix_writable(struct sock *sk)
 {
 	return (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf;
@@ -420,6 +532,8 @@ static void unix_release_sock(struct sock *sk, int embrion)
 			skpair->sk_state_change(skpair);
 			sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
 		}
+
+		unix_dgram_peer_wake_disconnect(sk, skpair);
 		sock_put(skpair); /* It may now die */
 		unix_peer(sk) = NULL;
 	}
@@ -653,6 +767,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock)
 	INIT_LIST_HEAD(&u->link);
 	mutex_init(&u->readlock); /* single task reading lock */
 	init_waitqueue_head(&u->peer_wait);
+	init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay);
 	unix_insert_socket(unix_sockets_unbound(sk), sk);
 out:
 	if (sk == NULL)
@@ -1020,6 +1135,8 @@ restart:
 	if (unix_peer(sk)) {
 		struct sock *old_peer = unix_peer(sk);
 		unix_peer(sk) = other;
+		unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer);
+
 		unix_state_double_unlock(sk, other);
 
 		if (other != old_peer)
@@ -1459,6 +1576,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
 	struct scm_cookie tmp_scm;
 	int max_level;
 	int data_len = 0;
+	int sk_locked;
 
 	if (NULL == siocb->scm)
 		siocb->scm = &tmp_scm;
@@ -1540,12 +1658,14 @@ restart:
 		goto out_free;
 	}
 
+	sk_locked = 0;
 	unix_state_lock(other);
+restart_locked:
 	err = -EPERM;
 	if (!unix_may_send(sk, other))
 		goto out_unlock;
 
-	if (sock_flag(other, SOCK_DEAD)) {
+	if (unlikely(sock_flag(other, SOCK_DEAD))) {
 		/*
 		 *	Check with 1003.1g - what should
 		 *	datagram error
@@ -1553,10 +1673,14 @@ restart:
 		unix_state_unlock(other);
 		sock_put(other);
 
+		if (!sk_locked)
+			unix_state_lock(sk);
+
 		err = 0;
-		unix_state_lock(sk);
 		if (unix_peer(sk) == other) {
 			unix_peer(sk) = NULL;
+			unix_dgram_peer_wake_disconnect_wakeup(sk, other);
+
 			unix_state_unlock(sk);
 
 			unix_dgram_disconnected(sk, other);
@@ -1582,21 +1706,38 @@ restart:
 			goto out_unlock;
 	}
 
-	if (unix_peer(other) != sk && unix_recvq_full(other)) {
-		if (!timeo) {
-			err = -EAGAIN;
-			goto out_unlock;
+	if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
+		if (timeo) {
+			timeo = unix_wait_for_peer(other, timeo);
+
+			err = sock_intr_errno(timeo);
+			if (signal_pending(current))
+				goto out_free;
+
+			goto restart;
 		}
 
-		timeo = unix_wait_for_peer(other, timeo);
+		if (!sk_locked) {
+			unix_state_unlock(other);
+			unix_state_double_lock(sk, other);
+		}
 
-		err = sock_intr_errno(timeo);
-		if (signal_pending(current))
-			goto out_free;
+		if (unix_peer(sk) != other ||
+		    unix_dgram_peer_wake_me(sk, other)) {
+			err = -EAGAIN;
+			sk_locked = 1;
+			goto out_unlock;
+		}
 
-		goto restart;
+		if (!sk_locked) {
+			sk_locked = 1;
+			goto restart_locked;
+		}
 	}
 
+	if (unlikely(sk_locked))
+		unix_state_unlock(sk);
+
 	if (sock_flag(other, SOCK_RCVTSTAMP))
 		__net_timestamp(skb);
 	maybe_add_creds(skb, sock, other);
@@ -1610,6 +1751,8 @@ restart:
 	return len;
 
 out_unlock:
+	if (sk_locked)
+		unix_state_unlock(sk);
 	unix_state_unlock(other);
 out_free:
 	kfree_skb(skb);
@@ -2269,14 +2412,16 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,
 		return mask;
 
 	writable = unix_writable(sk);
-	other = unix_peer_get(sk);
-	if (other) {
-		if (unix_peer(other) != sk) {
-			sock_poll_wait(file, &unix_sk(other)->peer_wait, wait);
-			if (unix_recvq_full(other))
-				writable = 0;
-		}
-		sock_put(other);
+	if (writable) {
+		unix_state_lock(sk);
+
+		other = unix_peer(sk);
+		if (other && unix_peer(other) != sk &&
+		    unix_recvq_full(other) &&
+		    unix_dgram_peer_wake_me(sk, other))
+			writable = 0;
+
+		unix_state_unlock(sk);
 	}
 
 	if (writable)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 039/126] packet: always probe for transport header
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 038/126] unix: avoid use-after-free in ep_remove_wait_queue Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 040/126] packet: infer protocol from ethernet header if unset Luis Henriques
                   ` (86 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 8fd6c80d9dd938ca338c70698533a7e304752846 upstream.

We concluded that the skb_probe_transport_header() should better be
called unconditionally. Avoiding the call into the flow dissector has
also not really much to do with the direct xmit mode.

While it seems that only virtio_net code makes use of GSO from non
RX/TX ring packet socket paths, we should probe for a transport header
nevertheless before they hit devices.

Reference: http://thread.gmane.org/gmane.linux.network/386173/
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ede33f60991a..e9ea7ff99bc0 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2216,8 +2216,7 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
 		len = ((to_write > len_max) ? len_max : to_write);
 	}
 
-	if (!packet_use_direct_xmit(po))
-		skb_probe_transport_header(skb, 0);
+	skb_probe_transport_header(skb, 0);
 
 	return tp_len;
 }
@@ -2540,8 +2539,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
 		len += vnet_hdr_len;
 	}
 
-	if (!packet_use_direct_xmit(po))
-		skb_probe_transport_header(skb, reserve);
+	skb_probe_transport_header(skb, reserve);
+
 	if (unlikely(extra_len == 4))
 		skb->no_fcs = 1;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 040/126] packet: infer protocol from ethernet header if unset
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 039/126] packet: always probe for transport header Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 041/126] ip_tunnel: disable preemption when updating per-cpu tstats Luis Henriques
                   ` (85 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit c72219b75fde768efccf7666342282fab7f9e4e7 upstream.

In case no struct sockaddr_ll has been passed to packet
socket's sendmsg() when doing a TX_RING flush run, then
skb->protocol is set to po->num instead, which is the protocol
passed via socket(2)/bind(2).

Applications only xmitting can go the path of allocating the
socket as socket(PF_PACKET, <mode>, 0) and do a bind(2) on the
TX_RING with sll_protocol of 0. That way, register_prot_hook()
is neither called on creation nor on bind time, which saves
cycles when there's no interest in capturing anyway.

That leaves us however with po->num 0 instead and therefore
the TX_RING flush run sets skb->protocol to 0 as well. Eric
reported that this leads to problems when using tools like
trafgen over bonding device. I.e. the bonding's hash function
could invoke the kernel's flow dissector, which depends on
skb->protocol being properly set. In the current situation, all
the traffic is then directed to a single slave.

Fix it up by inferring skb->protocol from the Ethernet header
when not set and we have ARPHRD_ETHER device type. This is only
done in case of SOCK_RAW and where we have a dev->hard_header_len
length. In case of ARPHRD_ETHER devices, this is guaranteed to
cover ETH_HLEN, and therefore being accessed on the skb after
the skb_store_bits().

Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e9ea7ff99bc0..b5c38ab3a93f 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2097,6 +2097,15 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
 	sock_wfree(skb);
 }
 
+static void tpacket_set_protocol(const struct net_device *dev,
+				 struct sk_buff *skb)
+{
+	if (dev->type == ARPHRD_ETHER) {
+		skb_reset_mac_header(skb);
+		skb->protocol = eth_hdr(skb)->h_proto;
+	}
+}
+
 static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
 		void *frame, struct net_device *dev, int size_max,
 		__be16 proto, unsigned char *addr, int hlen)
@@ -2182,6 +2191,8 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
 				dev->hard_header_len);
 		if (unlikely(err))
 			return err;
+		if (!skb->protocol)
+			tpacket_set_protocol(dev, skb);
 
 		data += dev->hard_header_len;
 		to_write -= dev->hard_header_len;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 041/126] ip_tunnel: disable preemption when updating per-cpu tstats
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 040/126] packet: infer protocol from ethernet header if unset Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 042/126] snmp: Remove duplicate OUTMCAST stat increment Luis Henriques
                   ` (84 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason A. Donenfeld, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Jason A. Donenfeld" <Jason@zx2c4.com>

commit b4fe85f9c9146f60457e9512fb6055e69e6a7a65 upstream.

Drivers like vxlan use the recently introduced
udp_tunnel_xmit_skb/udp_tunnel6_xmit_skb APIs. udp_tunnel6_xmit_skb
makes use of ip6tunnel_xmit, and ip6tunnel_xmit, after sending the
packet, updates the struct stats using the usual
u64_stats_update_begin/end calls on this_cpu_ptr(dev->tstats).
udp_tunnel_xmit_skb makes use of iptunnel_xmit, which doesn't touch
tstats, so drivers like vxlan, immediately after, call
iptunnel_xmit_stats, which does the same thing - calls
u64_stats_update_begin/end on this_cpu_ptr(dev->tstats).

While vxlan is probably fine (I don't know?), calling a similar function
from, say, an unbound workqueue, on a fully preemptable kernel causes
real issues:

[  188.434537] BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u8:0/6
[  188.435579] caller is debug_smp_processor_id+0x17/0x20
[  188.435583] CPU: 0 PID: 6 Comm: kworker/u8:0 Not tainted 4.2.6 #2
[  188.435607] Call Trace:
[  188.435611]  [<ffffffff8234e936>] dump_stack+0x4f/0x7b
[  188.435615]  [<ffffffff81915f3d>] check_preemption_disabled+0x19d/0x1c0
[  188.435619]  [<ffffffff81915f77>] debug_smp_processor_id+0x17/0x20

The solution would be to protect the whole
this_cpu_ptr(dev->tstats)/u64_stats_update_begin/end blocks with
disabling preemption and then reenabling it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/ip6_tunnel.h | 3 ++-
 include/net/ip_tunnels.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index a5593dab6af7..ef9557683fec 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -79,11 +79,12 @@ static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
 	err = ip6_local_out(skb);
 
 	if (net_xmit_eval(err) == 0) {
-		struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+		struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
 		u64_stats_update_begin(&tstats->syncp);
 		tstats->tx_bytes += pkt_len;
 		tstats->tx_packets++;
 		u64_stats_update_end(&tstats->syncp);
+		put_cpu_ptr(tstats);
 	} else {
 		stats->tx_errors++;
 		stats->tx_aborted_errors++;
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 8dd8cab88b87..6d953cc9b351 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -166,12 +166,13 @@ static inline void iptunnel_xmit_stats(int err,
 				       struct pcpu_sw_netstats __percpu *stats)
 {
 	if (err > 0) {
-		struct pcpu_sw_netstats *tstats = this_cpu_ptr(stats);
+		struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats);
 
 		u64_stats_update_begin(&tstats->syncp);
 		tstats->tx_bytes += err;
 		tstats->tx_packets++;
 		u64_stats_update_end(&tstats->syncp);
+		put_cpu_ptr(tstats);
 	} else if (err < 0) {
 		err_stats->tx_errors++;
 		err_stats->tx_aborted_errors++;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 042/126] snmp: Remove duplicate OUTMCAST stat increment
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 041/126] ip_tunnel: disable preemption when updating per-cpu tstats Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 043/126] net: qmi_wwan: add XS Stick W100-2 from 4G Systems Luis Henriques
                   ` (83 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neil Horman, Claus Jensen, David Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Neil Horman <nhorman@tuxdriver.com>

commit 41033f029e393a64e81966cbe34d66c6cf8a2e7e upstream.

the OUTMCAST stat is double incremented, getting bumped once in the mcast code
itself, and again in the common ip output path.  Remove the mcast bump, as its
not needed

Validated by the reporter, with good results

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Reported-by: Claus Jensen <claus.jensen@microsemi.com>
CC: Claus Jensen <claus.jensen@microsemi.com>
CC: David Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/mcast.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 2a6da3e5483f..e33349701050 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1647,7 +1647,6 @@ out:
 	if (!err) {
 		ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
 		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
-		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
 	} else {
 		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
 	}
@@ -2010,7 +2009,6 @@ out:
 	if (!err) {
 		ICMP6MSGOUT_INC_STATS(net, idev, type);
 		ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
-		IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, full_len);
 	} else
 		IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 043/126] net: qmi_wwan: add XS Stick W100-2 from 4G Systems
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 042/126] snmp: Remove duplicate OUTMCAST stat increment Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 044/126] tcp: md5: fix lockdep annotation Luis Henriques
                   ` (82 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 68242a5a1e2edce39b069385cbafb82304eac0f1 upstream.

Thomas reports
"
4gsystems sells two total different LTE-surfsticks under the same name.
..
The newer version of XS Stick W100 is from "omega"
..
Under windows the driver switches to the same ID, and uses MI03\6 for
network and MI01\6 for modem.
..
echo "1c9e 9b01" > /sys/bus/usb/drivers/qmi_wwan/new_id
echo "1c9e 9b01" > /sys/bus/usb-serial/drivers/option1/new_id

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1c9e ProdID=9b01 Rev=02.32
S:  Manufacturer=USB Modem
S:  Product=USB Modem
S:  SerialNumber=
C:  #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

Now all important things are there:

wwp0s29f7u2i3 (net), ttyUSB2 (at), cdc-wdm0 (qmi), ttyUSB1 (at)

There is also ttyUSB0, but it is not usable, at least not for at.

The device works well with qmi and ModemManager-NetworkManager.
"

Reported-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 9f3fc25050e3..c745fd79eb9e 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -770,6 +770,7 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x2357, 0x9000, 4)},	/* TP-LINK MA260 */
 	{QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},	/* Telit LE920 */
 	{QMI_FIXED_INTF(0x1bc7, 0x1201, 2)},	/* Telit LE920 */
+	{QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)},	/* XS Stick W100-2 from 4G Systems */
 	{QMI_FIXED_INTF(0x0b3c, 0xc000, 4)},	/* Olivetti Olicard 100 */
 	{QMI_FIXED_INTF(0x0b3c, 0xc001, 4)},	/* Olivetti Olicard 120 */
 	{QMI_FIXED_INTF(0x0b3c, 0xc002, 4)},	/* Olivetti Olicard 140 */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 044/126] tcp: md5: fix lockdep annotation
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 043/126] net: qmi_wwan: add XS Stick W100-2 from 4G Systems Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 045/126] tcp: initialize tp->copied_seq in case of cross SYN connection Luis Henriques
                   ` (81 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 1b8e6a01e19f001e9f93b39c32387961c91ed3cc upstream.

When a passive TCP is created, we eventually call tcp_md5_do_add()
with sk pointing to the child. It is not owner by the user yet (we
will add this socket into listener accept queue a bit later anyway)

But we do own the spinlock, so amend the lockdep annotation to avoid
following splat :

[ 8451.090932] net/ipv4/tcp_ipv4.c:923 suspicious rcu_dereference_protected() usage!
[ 8451.090932]
[ 8451.090932] other info that might help us debug this:
[ 8451.090932]
[ 8451.090934]
[ 8451.090934] rcu_scheduler_active = 1, debug_locks = 1
[ 8451.090936] 3 locks held by socket_sockopt_/214795:
[ 8451.090936]  #0:  (rcu_read_lock){.+.+..}, at: [<ffffffff855c6ac1>] __netif_receive_skb_core+0x151/0xe90
[ 8451.090947]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff85618143>] ip_local_deliver_finish+0x43/0x2b0
[ 8451.090952]  #2:  (slock-AF_INET){+.-...}, at: [<ffffffff855acda5>] sk_clone_lock+0x1c5/0x500
[ 8451.090958]
[ 8451.090958] stack backtrace:
[ 8451.090960] CPU: 7 PID: 214795 Comm: socket_sockopt_

[ 8451.091215] Call Trace:
[ 8451.091216]  <IRQ>  [<ffffffff856fb29c>] dump_stack+0x55/0x76
[ 8451.091229]  [<ffffffff85123b5b>] lockdep_rcu_suspicious+0xeb/0x110
[ 8451.091235]  [<ffffffff8564544f>] tcp_md5_do_add+0x1bf/0x1e0
[ 8451.091239]  [<ffffffff85645751>] tcp_v4_syn_recv_sock+0x1f1/0x4c0
[ 8451.091242]  [<ffffffff85642b27>] ? tcp_v4_md5_hash_skb+0x167/0x190
[ 8451.091246]  [<ffffffff85647c78>] tcp_check_req+0x3c8/0x500
[ 8451.091249]  [<ffffffff856451ae>] ? tcp_v4_inbound_md5_hash+0x11e/0x190
[ 8451.091253]  [<ffffffff85647170>] tcp_v4_rcv+0x3c0/0x9f0
[ 8451.091256]  [<ffffffff85618143>] ? ip_local_deliver_finish+0x43/0x2b0
[ 8451.091260]  [<ffffffff856181b6>] ip_local_deliver_finish+0xb6/0x2b0
[ 8451.091263]  [<ffffffff85618143>] ? ip_local_deliver_finish+0x43/0x2b0
[ 8451.091267]  [<ffffffff85618d38>] ip_local_deliver+0x48/0x80
[ 8451.091270]  [<ffffffff85618510>] ip_rcv_finish+0x160/0x700
[ 8451.091273]  [<ffffffff8561900e>] ip_rcv+0x29e/0x3d0
[ 8451.091277]  [<ffffffff855c74b7>] __netif_receive_skb_core+0xb47/0xe90

Fixes: a8afca0329988 ("tcp: md5: protects md5sig_info with RCU")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_ipv4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b68fd0d65411..0fd3c84ffaf8 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -992,7 +992,8 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
 	}
 
 	md5sig = rcu_dereference_protected(tp->md5sig_info,
-					   sock_owned_by_user(sk));
+					   sock_owned_by_user(sk) ||
+					   lockdep_is_held(&sk->sk_lock.slock));
 	if (!md5sig) {
 		md5sig = kmalloc(sizeof(*md5sig), gfp);
 		if (!md5sig)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 045/126] tcp: initialize tp->copied_seq in case of cross SYN connection
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 044/126] tcp: md5: fix lockdep annotation Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 046/126] net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds Luis Henriques
                   ` (80 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 142a2e7ece8d8ac0e818eb2c91f99ca894730e2a upstream.

Dmitry provided a syzkaller (http://github.com/google/syzkaller)
generated program that triggers the WARNING at
net/ipv4/tcp.c:1729 in tcp_recvmsg() :

WARN_ON(tp->copied_seq != tp->rcv_nxt &&
        !(flags & (MSG_PEEK | MSG_TRUNC)));

His program is specifically attempting a Cross SYN TCP exchange,
that we support (for the pleasure of hackers ?), but it looks we
lack proper tcp->copied_seq initialization.

Thanks again Dmitry for your report and testings.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e3d40a303b8f..43404d3f9da8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5549,6 +5549,7 @@ discard:
 		}
 
 		tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
+		tp->copied_seq = tp->rcv_nxt;
 		tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1;
 
 		/* RFC1323: The window in SYN & SYN/ACK segments is

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 046/126] net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 045/126] tcp: initialize tp->copied_seq in case of cross SYN connection Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 047/126] net: ipmr: fix static mfc/dev leaks on table destruction Luis Henriques
                   ` (79 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: PaX Team, Emese Revfy, Brad Spengler, Wei Yongjun, Eric Dumazet,
	Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 6900317f5eff0a7070c5936e5383f589e0de7a09 upstream.

David and HacKurx reported a following/similar size overflow triggered
in a grsecurity kernel, thanks to PaX's gcc size overflow plugin:

(Already fixed in later grsecurity versions by Brad and PaX Team.)

[ 1002.296137] PAX: size overflow detected in function scm_detach_fds net/core/scm.c:314
               cicus.202_127 min, count: 4, decl: msg_controllen; num: 0; context: msghdr;
[ 1002.296145] CPU: 0 PID: 3685 Comm: scm_rights_recv Not tainted 4.2.3-grsec+ #7
[ 1002.296149] Hardware name: Apple Inc. MacBookAir5,1/Mac-66F35F19FE2A0D05, [...]
[ 1002.296153]  ffffffff81c27366 0000000000000000 ffffffff81c27375 ffffc90007843aa8
[ 1002.296162]  ffffffff818129ba 0000000000000000 ffffffff81c27366 ffffc90007843ad8
[ 1002.296169]  ffffffff8121f838 fffffffffffffffc fffffffffffffffc ffffc90007843e60
[ 1002.296176] Call Trace:
[ 1002.296190]  [<ffffffff818129ba>] dump_stack+0x45/0x57
[ 1002.296200]  [<ffffffff8121f838>] report_size_overflow+0x38/0x60
[ 1002.296209]  [<ffffffff816a979e>] scm_detach_fds+0x2ce/0x300
[ 1002.296220]  [<ffffffff81791899>] unix_stream_read_generic+0x609/0x930
[ 1002.296228]  [<ffffffff81791c9f>] unix_stream_recvmsg+0x4f/0x60
[ 1002.296236]  [<ffffffff8178dc00>] ? unix_set_peek_off+0x50/0x50
[ 1002.296243]  [<ffffffff8168fac7>] sock_recvmsg+0x47/0x60
[ 1002.296248]  [<ffffffff81691522>] ___sys_recvmsg+0xe2/0x1e0
[ 1002.296257]  [<ffffffff81693496>] __sys_recvmsg+0x46/0x80
[ 1002.296263]  [<ffffffff816934fc>] SyS_recvmsg+0x2c/0x40
[ 1002.296271]  [<ffffffff8181a3ab>] entry_SYSCALL_64_fastpath+0x12/0x85

Further investigation showed that this can happen when an *odd* number of
fds are being passed over AF_UNIX sockets.

In these cases CMSG_LEN(i * sizeof(int)) and CMSG_SPACE(i * sizeof(int)),
where i is the number of successfully passed fds, differ by 4 bytes due
to the extra CMSG_ALIGN() padding in CMSG_SPACE() to an 8 byte boundary
on 64 bit. The padding is used to align subsequent cmsg headers in the
control buffer.

When the control buffer passed in from the receiver side *lacks* these 4
bytes (e.g. due to buggy/wrong API usage), then msg->msg_controllen will
overflow in scm_detach_fds():

  int cmlen = CMSG_LEN(i * sizeof(int));  <--- cmlen w/o tail-padding
  err = put_user(SOL_SOCKET, &cm->cmsg_level);
  if (!err)
    err = put_user(SCM_RIGHTS, &cm->cmsg_type);
  if (!err)
    err = put_user(cmlen, &cm->cmsg_len);
  if (!err) {
    cmlen = CMSG_SPACE(i * sizeof(int));  <--- cmlen w/ 4 byte extra tail-padding
    msg->msg_control += cmlen;
    msg->msg_controllen -= cmlen;         <--- iff no tail-padding space here ...
  }                                            ... wrap-around

F.e. it will wrap to a length of 18446744073709551612 bytes in case the
receiver passed in msg->msg_controllen of 20 bytes, and the sender
properly transferred 1 fd to the receiver, so that its CMSG_LEN results
in 20 bytes and CMSG_SPACE in 24 bytes.

In case of MSG_CMSG_COMPAT (scm_detach_fds_compat()), I haven't seen an
issue in my tests as alignment seems always on 4 byte boundary. Same
should be in case of native 32 bit, where we end up with 4 byte boundaries
as well.

In practice, passing msg->msg_controllen of 20 to recvmsg() while receiving
a single fd would mean that on successful return, msg->msg_controllen is
being set by the kernel to 24 bytes instead, thus more than the input
buffer advertised. It could f.e. become an issue if such application later
on zeroes or copies the control buffer based on the returned msg->msg_controllen
elsewhere.

Maximum number of fds we can send is a hard upper limit SCM_MAX_FD (253).

Going over the code, it seems like msg->msg_controllen is not being read
after scm_detach_fds() in scm_recv() anymore by the kernel, good!

Relevant recvmsg() handler are unix_dgram_recvmsg() (unix_seqpacket_recvmsg())
and unix_stream_recvmsg(). Both return back to their recvmsg() caller,
and ___sys_recvmsg() places the updated length, that is, new msg_control -
old msg_control pointer into msg->msg_controllen (hence the 24 bytes seen
in the example).

Long time ago, Wei Yongjun fixed something related in commit 1ac70e7ad24a
("[NET]: Fix function put_cmsg() which may cause usr application memory
overflow").

RFC3542, section 20.2. says:

  The fields shown as "XX" are possible padding, between the cmsghdr
  structure and the data, and between the data and the next cmsghdr
  structure, if required by the implementation. While sending an
  application may or may not include padding at the end of last
  ancillary data in msg_controllen and implementations must accept both
  as valid. On receiving a portable application must provide space for
  padding at the end of the last ancillary data as implementations may
  copy out the padding at the end of the control message buffer and
  include it in the received msg_controllen. When recvmsg() is called
  if msg_controllen is too small for all the ancillary data items
  including any trailing padding after the last item an implementation
  may set MSG_CTRUNC.

Since we didn't place MSG_CTRUNC for already quite a long time, just do
the same as in 1ac70e7ad24a to avoid an overflow.

Btw, even man-page author got this wrong :/ See db939c9b26e9 ("cmsg.3: Fix
error in SCM_RIGHTS code sample"). Some people must have copied this (?),
thus it got triggered in the wild (reported several times during boot by
David and HacKurx).

No Fixes tag this time as pre 2002 (that is, pre history tree).

Reported-by: David Sterba <dave@jikos.cz>
Reported-by: HacKurx <hackurx@gmail.com>
Cc: PaX Team <pageexec@freemail.hu>
Cc: Emese Revfy <re.emese@gmail.com>
Cc: Brad Spengler <spender@grsecurity.net>
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Eric Dumazet <edumazet@google.com>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/scm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/scm.c b/net/core/scm.c
index b442e7e25e60..d30eb057fa7b 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -306,6 +306,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
 			err = put_user(cmlen, &cm->cmsg_len);
 		if (!err) {
 			cmlen = CMSG_SPACE(i*sizeof(int));
+			if (msg->msg_controllen < cmlen)
+				cmlen = msg->msg_controllen;
 			msg->msg_control += cmlen;
 			msg->msg_controllen -= cmlen;
 		}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 047/126] net: ipmr: fix static mfc/dev leaks on table destruction
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (45 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 046/126] net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 048/126] net: ip6mr: " Luis Henriques
                   ` (78 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nikolay Aleksandrov, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

commit 0e615e9601a15efeeb8942cf7cd4dadba0c8c5a7 upstream.

When destroying an mrt table the static mfc entries and the static
devices are kept, which leads to devices that can never be destroyed
(because of refcnt taken) and leaked memory, for example:
unreferenced object 0xffff880034c144c0 (size 192):
  comm "mfc-broken", pid 4777, jiffies 4320349055 (age 46001.964s)
  hex dump (first 32 bytes):
    98 53 f0 34 00 88 ff ff 98 53 f0 34 00 88 ff ff  .S.4.....S.4....
    ef 0a 0a 14 01 02 03 04 00 00 00 00 01 00 00 00  ................
  backtrace:
    [<ffffffff815c1b9e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811ea6e0>] kmem_cache_alloc+0x190/0x300
    [<ffffffff815931cb>] ip_mroute_setsockopt+0x5cb/0x910
    [<ffffffff8153d575>] do_ip_setsockopt.isra.11+0x105/0xff0
    [<ffffffff8153e490>] ip_setsockopt+0x30/0xa0
    [<ffffffff81564e13>] raw_setsockopt+0x33/0x90
    [<ffffffff814d1e14>] sock_common_setsockopt+0x14/0x20
    [<ffffffff814d0b51>] SyS_setsockopt+0x71/0xc0
    [<ffffffff815cdbf6>] entry_SYSCALL_64_fastpath+0x16/0x7a
    [<ffffffffffffffff>] 0xffffffffffffffff

Make sure that everything is cleaned on netns destruction.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ipmr.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index ac7909c8c8d8..da9f18156ba9 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -136,7 +136,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
 			      struct mfc_cache *c, struct rtmsg *rtm);
 static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
 				 int cmd);
-static void mroute_clean_tables(struct mr_table *mrt);
+static void mroute_clean_tables(struct mr_table *mrt, bool all);
 static void ipmr_expire_process(unsigned long arg);
 
 #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
@@ -348,7 +348,7 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id)
 static void ipmr_free_table(struct mr_table *mrt)
 {
 	del_timer_sync(&mrt->ipmr_expire_timer);
-	mroute_clean_tables(mrt);
+	mroute_clean_tables(mrt, true);
 	kfree(mrt);
 }
 
@@ -1201,7 +1201,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,
  *	Close the multicast socket, and clear the vif tables etc
  */
 
-static void mroute_clean_tables(struct mr_table *mrt)
+static void mroute_clean_tables(struct mr_table *mrt, bool all)
 {
 	int i;
 	LIST_HEAD(list);
@@ -1210,8 +1210,9 @@ static void mroute_clean_tables(struct mr_table *mrt)
 	/* Shut down all active vif entries */
 
 	for (i = 0; i < mrt->maxvif; i++) {
-		if (!(mrt->vif_table[i].flags & VIFF_STATIC))
-			vif_delete(mrt, i, 0, &list);
+		if (!all && (mrt->vif_table[i].flags & VIFF_STATIC))
+			continue;
+		vif_delete(mrt, i, 0, &list);
 	}
 	unregister_netdevice_many(&list);
 
@@ -1219,7 +1220,7 @@ static void mroute_clean_tables(struct mr_table *mrt)
 
 	for (i = 0; i < MFC_LINES; i++) {
 		list_for_each_entry_safe(c, next, &mrt->mfc_cache_array[i], list) {
-			if (c->mfc_flags & MFC_STATIC)
+			if (!all && (c->mfc_flags & MFC_STATIC))
 				continue;
 			list_del_rcu(&c->list);
 			mroute_netlink_event(mrt, c, RTM_DELROUTE);
@@ -1254,7 +1255,7 @@ static void mrtsock_destruct(struct sock *sk)
 						    NETCONFA_IFINDEX_ALL,
 						    net->ipv4.devconf_all);
 			RCU_INIT_POINTER(mrt->mroute_sk, NULL);
-			mroute_clean_tables(mrt);
+			mroute_clean_tables(mrt, false);
 		}
 	}
 	rtnl_unlock();

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 048/126] net: ip6mr: fix static mfc/dev leaks on table destruction
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 047/126] net: ipmr: fix static mfc/dev leaks on table destruction Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 049/126] broadcom: fix PHY_ID_BCM5481 entry in the id table Luis Henriques
                   ` (77 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Thery, Nikolay Aleksandrov, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

commit 4c6980462f32b4f282c5d8e5f7ea8070e2937725 upstream.

Similar to ipv4, when destroying an mrt table the static mfc entries and
the static devices are kept, which leads to devices that can never be
destroyed (because of refcnt taken) and leaked memory. Make sure that
everything is cleaned up on netns destruction.

Fixes: 8229efdaef1e ("netns: ip6mr: enable namespace support in ipv6 multicast forwarding code")
CC: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ip6mr.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 77eede59b617..72f3baee76d9 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -120,7 +120,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc,
 			      int cmd);
 static int ip6mr_rtm_dumproute(struct sk_buff *skb,
 			       struct netlink_callback *cb);
-static void mroute_clean_tables(struct mr6_table *mrt);
+static void mroute_clean_tables(struct mr6_table *mrt, bool all);
 static void ipmr_expire_process(unsigned long arg);
 
 #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
@@ -337,7 +337,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)
 static void ip6mr_free_table(struct mr6_table *mrt)
 {
 	del_timer(&mrt->ipmr_expire_timer);
-	mroute_clean_tables(mrt);
+	mroute_clean_tables(mrt, true);
 	kfree(mrt);
 }
 
@@ -1536,7 +1536,7 @@ static int ip6mr_mfc_add(struct net *net, struct mr6_table *mrt,
  *	Close the multicast socket, and clear the vif tables etc
  */
 
-static void mroute_clean_tables(struct mr6_table *mrt)
+static void mroute_clean_tables(struct mr6_table *mrt, bool all)
 {
 	int i;
 	LIST_HEAD(list);
@@ -1546,8 +1546,9 @@ static void mroute_clean_tables(struct mr6_table *mrt)
 	 *	Shut down all active vif entries
 	 */
 	for (i = 0; i < mrt->maxvif; i++) {
-		if (!(mrt->vif6_table[i].flags & VIFF_STATIC))
-			mif6_delete(mrt, i, &list);
+		if (!all && (mrt->vif6_table[i].flags & VIFF_STATIC))
+			continue;
+		mif6_delete(mrt, i, &list);
 	}
 	unregister_netdevice_many(&list);
 
@@ -1556,7 +1557,7 @@ static void mroute_clean_tables(struct mr6_table *mrt)
 	 */
 	for (i = 0; i < MFC6_LINES; i++) {
 		list_for_each_entry_safe(c, next, &mrt->mfc6_cache_array[i], list) {
-			if (c->mfc_flags & MFC_STATIC)
+			if (!all && (c->mfc_flags & MFC_STATIC))
 				continue;
 			write_lock_bh(&mrt_lock);
 			list_del(&c->list);
@@ -1619,7 +1620,7 @@ int ip6mr_sk_done(struct sock *sk)
 						     net->ipv6.devconf_all);
 			write_unlock_bh(&mrt_lock);
 
-			mroute_clean_tables(mrt);
+			mroute_clean_tables(mrt, false);
 			err = 0;
 			break;
 		}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 049/126] broadcom: fix PHY_ID_BCM5481 entry in the id table
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 048/126] net: ip6mr: " Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 050/126] ipv6: distinguish frag queues by device for multicast and link-local packets Luis Henriques
                   ` (76 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aaro Koskinen, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Aaro Koskinen <aaro.koskinen@iki.fi>

commit 3c25a860d17b7378822f35d8c9141db9507e3beb upstream.

Commit fcb26ec5b18d ("broadcom: move all PHY_ID's to header")
updated broadcom_tbl to use PHY_IDs, but incorrectly replaced 0x0143bca0
with PHY_ID_BCM5482 (making a duplicate entry, and completely omitting
the original). Fix that.

Fixes: fcb26ec5b18d ("broadcom: move all PHY_ID's to header")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/phy/broadcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 34088d60da74..254a8f2fe235 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -796,7 +796,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
 	{ PHY_ID_BCM5421, 0xfffffff0 },
 	{ PHY_ID_BCM5461, 0xfffffff0 },
 	{ PHY_ID_BCM5464, 0xfffffff0 },
-	{ PHY_ID_BCM5482, 0xfffffff0 },
+	{ PHY_ID_BCM5481, 0xfffffff0 },
 	{ PHY_ID_BCM5482, 0xfffffff0 },
 	{ PHY_ID_BCM50610, 0xfffffff0 },
 	{ PHY_ID_BCM50610M, 0xfffffff0 },

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 050/126] ipv6: distinguish frag queues by device for multicast and link-local packets
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 049/126] broadcom: fix PHY_ID_BCM5481 entry in the id table Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 051/126] ipv6: add complete rcu protection around np->opt Luis Henriques
                   ` (75 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <mkubecek@suse.cz>

commit 264640fc2c5f4f913db5c73fa3eb1ead2c45e9d7 upstream.

If a fragmented multicast packet is received on an ethernet device which
has an active macvlan on top of it, each fragment is duplicated and
received both on the underlying device and the macvlan. If some
fragments for macvlan are processed before the whole packet for the
underlying device is reassembled, the "overlapping fragments" test in
ip6_frag_queue() discards the whole fragment queue.

To resolve this, add device ifindex to the search key and require it to
match reassembling multicast packets and packets to link-local
addresses.

Note: similar patch has been already submitted by Yoshifuji Hideaki in

  http://patchwork.ozlabs.org/patch/220979/

but got lost and forgotten for some reason.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/ipv6.h                      |  1 +
 net/ipv6/netfilter/nf_conntrack_reasm.c |  5 +++--
 net/ipv6/reassembly.c                   | 10 +++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 9b442a8d68ba..a73a6bb0134d 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -492,6 +492,7 @@ struct ip6_create_arg {
 	u32 user;
 	const struct in6_addr *src;
 	const struct in6_addr *dst;
+	int iif;
 	u8 ecn;
 };
 
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 0d5279fd852a..3e1c51756ddb 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -184,7 +184,7 @@ static void nf_ct_frag6_expire(unsigned long data)
 /* Creation primitives. */
 static inline struct frag_queue *fq_find(struct net *net, __be32 id,
 					 u32 user, struct in6_addr *src,
-					 struct in6_addr *dst, u8 ecn)
+					 struct in6_addr *dst, int iif, u8 ecn)
 {
 	struct inet_frag_queue *q;
 	struct ip6_create_arg arg;
@@ -194,6 +194,7 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id,
 	arg.user = user;
 	arg.src = src;
 	arg.dst = dst;
+	arg.iif = iif;
 	arg.ecn = ecn;
 
 	read_lock_bh(&nf_frags.lock);
@@ -602,7 +603,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)
 	local_bh_enable();
 
 	fq = fq_find(net, fhdr->identification, user, &hdr->saddr, &hdr->daddr,
-		     ip6_frag_ecn(hdr));
+		     skb->dev ? skb->dev->ifindex : 0, ip6_frag_ecn(hdr));
 	if (fq == NULL) {
 		pr_debug("Can't find and can't create new queue\n");
 		goto ret_orig;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index cc85a9ba5010..9c15250eac1d 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -111,7 +111,10 @@ bool ip6_frag_match(struct inet_frag_queue *q, void *a)
 	return	fq->id == arg->id &&
 		fq->user == arg->user &&
 		ipv6_addr_equal(&fq->saddr, arg->src) &&
-		ipv6_addr_equal(&fq->daddr, arg->dst);
+		ipv6_addr_equal(&fq->daddr, arg->dst) &&
+		(arg->iif == fq->iif ||
+		 !(ipv6_addr_type(arg->dst) & (IPV6_ADDR_MULTICAST |
+					       IPV6_ADDR_LINKLOCAL)));
 }
 EXPORT_SYMBOL(ip6_frag_match);
 
@@ -180,7 +183,7 @@ static void ip6_frag_expire(unsigned long data)
 
 static __inline__ struct frag_queue *
 fq_find(struct net *net, __be32 id, const struct in6_addr *src,
-	const struct in6_addr *dst, u8 ecn)
+	const struct in6_addr *dst, int iif, u8 ecn)
 {
 	struct inet_frag_queue *q;
 	struct ip6_create_arg arg;
@@ -190,6 +193,7 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src,
 	arg.user = IP6_DEFRAG_LOCAL_DELIVER;
 	arg.src = src;
 	arg.dst = dst;
+	arg.iif = iif;
 	arg.ecn = ecn;
 
 	read_lock(&ip6_frags.lock);
@@ -558,7 +562,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
 				 IPSTATS_MIB_REASMFAILS, evicted);
 
 	fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr,
-		     ip6_frag_ecn(hdr));
+		     skb->dev ? skb->dev->ifindex : 0, ip6_frag_ecn(hdr));
 	if (fq != NULL) {
 		int ret;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 051/126] ipv6: add complete rcu protection around np->opt
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 050/126] ipv6: distinguish frag queues by device for multicast and link-local packets Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 052/126] net/neighbour: fix crash at dumping device-agnostic proxy entries Luis Henriques
                   ` (74 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 45f6fad84cc305103b28d73482b344d7f5b76f39 upstream.

This patch addresses multiple problems :

UDP/RAW sendmsg() need to get a stable struct ipv6_txoptions
while socket is not locked : Other threads can change np->opt
concurrently. Dmitry posted a syzkaller
(http://github.com/google/syzkaller) program desmonstrating
use-after-free.

Starting with TCP/DCCP lockless listeners, tcp_v6_syn_recv_sock()
and dccp_v6_request_recv_sock() also need to use RCU protection
to dereference np->opt once (before calling ipv6_dup_options())

This patch adds full RCU protection to np->opt

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/ipv6.h             |  2 +-
 include/net/ipv6.h               | 21 ++++++++++++++++++++-
 net/dccp/ipv6.c                  | 33 +++++++++++++++++++++------------
 net/ipv6/af_inet6.c              | 13 +++++++++----
 net/ipv6/datagram.c              |  4 +++-
 net/ipv6/exthdrs.c               |  3 ++-
 net/ipv6/inet6_connection_sock.c | 11 ++++++++---
 net/ipv6/ipv6_sockglue.c         | 36 ++++++++++++++++++++++++------------
 net/ipv6/raw.c                   |  8 ++++++--
 net/ipv6/syncookies.c            |  2 +-
 net/ipv6/tcp_ipv6.c              | 28 +++++++++++++++++-----------
 net/ipv6/udp.c                   |  8 ++++++--
 net/l2tp/l2tp_ip6.c              |  8 ++++++--
 13 files changed, 124 insertions(+), 53 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 2faef339d8f2..f3d5d11b8871 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -210,7 +210,7 @@ struct ipv6_pinfo {
 	struct ipv6_ac_socklist	*ipv6_ac_list;
 	struct ipv6_fl_socklist __rcu *ipv6_fl_list;
 
-	struct ipv6_txoptions	*opt;
+	struct ipv6_txoptions __rcu	*opt;
 	struct sk_buff		*pktoptions;
 	struct sk_buff		*rxpmtu;
 	struct {
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a73a6bb0134d..9aca37aa9796 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -205,6 +205,7 @@ extern rwlock_t ip6_ra_lock;
  */
 
 struct ipv6_txoptions {
+	atomic_t		refcnt;
 	/* Length of this structure */
 	int			tot_len;
 
@@ -217,7 +218,7 @@ struct ipv6_txoptions {
 	struct ipv6_opt_hdr	*dst0opt;
 	struct ipv6_rt_hdr	*srcrt;	/* Routing Header */
 	struct ipv6_opt_hdr	*dst1opt;
-
+	struct rcu_head		rcu;
 	/* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */
 };
 
@@ -250,6 +251,24 @@ struct ipv6_fl_socklist {
 	struct rcu_head			rcu;
 };
 
+static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
+{
+	struct ipv6_txoptions *opt;
+
+	rcu_read_lock();
+	opt = rcu_dereference(np->opt);
+	if (opt && !atomic_inc_not_zero(&opt->refcnt))
+		opt = NULL;
+	rcu_read_unlock();
+	return opt;
+}
+
+static inline void txopt_put(struct ipv6_txoptions *opt)
+{
+	if (opt && atomic_dec_and_test(&opt->refcnt))
+		kfree_rcu(opt, rcu);
+}
+
 struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
 struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
 					 struct ip6_flowlabel *fl,
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 4db3c2a1679c..1149e345bba9 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -238,7 +238,9 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
 	security_req_classify_flow(req, flowi6_to_flowi(&fl6));
 
 
-	final_p = fl6_update_dst(&fl6, np->opt, &final);
+	rcu_read_lock();
+	final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final);
+	rcu_read_unlock();
 
 	dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
 	if (IS_ERR(dst)) {
@@ -255,7 +257,10 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
 							 &ireq->ir_v6_loc_addr,
 							 &ireq->ir_v6_rmt_addr);
 		fl6.daddr = ireq->ir_v6_rmt_addr;
-		err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
+		rcu_read_lock();
+		err = ip6_xmit(sk, skb, &fl6, rcu_dereference(np->opt),
+			       np->tclass);
+		rcu_read_unlock();
 		err = net_xmit_eval(err);
 	}
 
@@ -450,6 +455,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 {
 	struct inet_request_sock *ireq = inet_rsk(req);
 	struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
+	struct ipv6_txoptions *opt;
 	struct inet_sock *newinet;
 	struct dccp6_sock *newdp6;
 	struct sock *newsk;
@@ -573,13 +579,15 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 	 * Yes, keeping reference count would be much more clever, but we make
 	 * one more one thing there: reattach optmem to newsk.
 	 */
-	if (np->opt != NULL)
-		newnp->opt = ipv6_dup_options(newsk, np->opt);
-
+	opt = rcu_dereference(np->opt);
+	if (opt) {
+		opt = ipv6_dup_options(newsk, opt);
+		RCU_INIT_POINTER(newnp->opt, opt);
+	}
 	inet_csk(newsk)->icsk_ext_hdr_len = 0;
-	if (newnp->opt != NULL)
-		inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen +
-						     newnp->opt->opt_flen);
+	if (opt)
+		inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen +
+						    opt->opt_flen;
 
 	dccp_sync_mss(newsk, dst_mtu(dst));
 
@@ -831,6 +839,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	struct dccp_sock *dp = dccp_sk(sk);
 	struct in6_addr *saddr = NULL, *final_p, final;
+	struct ipv6_txoptions *opt;
 	struct flowi6 fl6;
 	struct dst_entry *dst;
 	int addr_type;
@@ -932,7 +941,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	fl6.fl6_sport = inet->inet_sport;
 	security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
 
-	final_p = fl6_update_dst(&fl6, np->opt, &final);
+	opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
+	final_p = fl6_update_dst(&fl6, opt, &final);
 
 	dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
 	if (IS_ERR(dst)) {
@@ -952,9 +962,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	__ip6_dst_store(sk, dst, NULL, NULL);
 
 	icsk->icsk_ext_hdr_len = 0;
-	if (np->opt != NULL)
-		icsk->icsk_ext_hdr_len = (np->opt->opt_flen +
-					  np->opt->opt_nflen);
+	if (opt)
+		icsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen;
 
 	inet->inet_dport = usin->sin6_port;
 
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 7cb4392690dd..8966f3ca0d59 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -425,9 +425,11 @@ void inet6_destroy_sock(struct sock *sk)
 
 	/* Free tx options */
 
-	opt = xchg(&np->opt, NULL);
-	if (opt != NULL)
-		sock_kfree_s(sk, opt, opt->tot_len);
+	opt = xchg((__force struct ipv6_txoptions **)&np->opt, NULL);
+	if (opt) {
+		atomic_sub(opt->tot_len, &sk->sk_omem_alloc);
+		txopt_put(opt);
+	}
 }
 EXPORT_SYMBOL_GPL(inet6_destroy_sock);
 
@@ -656,7 +658,10 @@ int inet6_sk_rebuild_header(struct sock *sk)
 		fl6.fl6_sport = inet->inet_sport;
 		security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
 
-		final_p = fl6_update_dst(&fl6, np->opt, &final);
+		rcu_read_lock();
+		final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt),
+					 &final);
+		rcu_read_unlock();
 
 		dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
 		if (IS_ERR(dst)) {
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 6b89b2a1ac74..ec4c8be39488 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -167,8 +167,10 @@ ipv4_connected:
 
 	security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
 
-	opt = flowlabel ? flowlabel->opt : np->opt;
+	rcu_read_lock();
+	opt = flowlabel ? flowlabel->opt : rcu_dereference(np->opt);
 	final_p = fl6_update_dst(&fl6, opt, &final);
+	rcu_read_unlock();
 
 	dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
 	err = 0;
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 8d67900aa003..33dbd6c1a00d 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -727,6 +727,7 @@ ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt)
 			*((char **)&opt2->dst1opt) += dif;
 		if (opt2->srcrt)
 			*((char **)&opt2->srcrt) += dif;
+		atomic_set(&opt2->refcnt, 1);
 	}
 	return opt2;
 }
@@ -790,7 +791,7 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
 		return ERR_PTR(-ENOBUFS);
 
 	memset(opt2, 0, tot_len);
-
+	atomic_set(&opt2->refcnt, 1);
 	opt2->tot_len = tot_len;
 	p = (char *)(opt2 + 1);
 
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index a245e5ddffbd..c3f50bbf6746 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -78,7 +78,9 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
 	memset(fl6, 0, sizeof(*fl6));
 	fl6->flowi6_proto = IPPROTO_TCP;
 	fl6->daddr = ireq->ir_v6_rmt_addr;
-	final_p = fl6_update_dst(fl6, np->opt, &final);
+	rcu_read_lock();
+	final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final);
+	rcu_read_unlock();
 	fl6->saddr = ireq->ir_v6_loc_addr;
 	fl6->flowi6_oif = ireq->ir_iif;
 	fl6->flowi6_mark = ireq->ir_mark;
@@ -212,7 +214,9 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
 	fl6->fl6_dport = inet->inet_dport;
 	security_sk_classify_flow(sk, flowi6_to_flowi(fl6));
 
-	final_p = fl6_update_dst(fl6, np->opt, &final);
+	rcu_read_lock();
+	final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final);
+	rcu_read_unlock();
 
 	dst = __inet6_csk_dst_check(sk, np->dst_cookie);
 	if (!dst) {
@@ -245,7 +249,8 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused
 	/* Restore final destination back after routing done */
 	fl6.daddr = sk->sk_v6_daddr;
 
-	res = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
+	res = ip6_xmit(sk, skb, &fl6, rcu_dereference(np->opt),
+		       np->tclass);
 	rcu_read_unlock();
 	return res;
 }
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index edb58aff4ae7..acda3ed4ba7e 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -110,10 +110,12 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk,
 			icsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen;
 			icsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);
 		}
-		opt = xchg(&inet6_sk(sk)->opt, opt);
+		opt = xchg((__force struct ipv6_txoptions **)&inet6_sk(sk)->opt,
+			   opt);
 	} else {
 		spin_lock(&sk->sk_dst_lock);
-		opt = xchg(&inet6_sk(sk)->opt, opt);
+		opt = xchg((__force struct ipv6_txoptions **)&inet6_sk(sk)->opt,
+			   opt);
 		spin_unlock(&sk->sk_dst_lock);
 	}
 	sk_dst_reset(sk);
@@ -213,9 +215,12 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 				sk->sk_socket->ops = &inet_dgram_ops;
 				sk->sk_family = PF_INET;
 			}
-			opt = xchg(&np->opt, NULL);
-			if (opt)
-				sock_kfree_s(sk, opt, opt->tot_len);
+			opt = xchg((__force struct ipv6_txoptions **)&np->opt,
+				   NULL);
+			if (opt) {
+				atomic_sub(opt->tot_len, &sk->sk_omem_alloc);
+				txopt_put(opt);
+			}
 			pktopt = xchg(&np->pktoptions, NULL);
 			kfree_skb(pktopt);
 
@@ -385,7 +390,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 		if (optname != IPV6_RTHDR && !ns_capable(net->user_ns, CAP_NET_RAW))
 			break;
 
-		opt = ipv6_renew_options(sk, np->opt, optname,
+		opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
+		opt = ipv6_renew_options(sk, opt, optname,
 					 (struct ipv6_opt_hdr __user *)optval,
 					 optlen);
 		if (IS_ERR(opt)) {
@@ -414,8 +420,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 		retv = 0;
 		opt = ipv6_update_options(sk, opt);
 sticky_done:
-		if (opt)
-			sock_kfree_s(sk, opt, opt->tot_len);
+		if (opt) {
+			atomic_sub(opt->tot_len, &sk->sk_omem_alloc);
+			txopt_put(opt);
+		}
 		break;
 	}
 
@@ -468,6 +476,7 @@ sticky_done:
 			break;
 
 		memset(opt, 0, sizeof(*opt));
+		atomic_set(&opt->refcnt, 1);
 		opt->tot_len = sizeof(*opt) + optlen;
 		retv = -EFAULT;
 		if (copy_from_user(opt+1, optval, optlen))
@@ -484,8 +493,10 @@ update:
 		retv = 0;
 		opt = ipv6_update_options(sk, opt);
 done:
-		if (opt)
-			sock_kfree_s(sk, opt, opt->tot_len);
+		if (opt) {
+			atomic_sub(opt->tot_len, &sk->sk_omem_alloc);
+			txopt_put(opt);
+		}
 		break;
 	}
 	case IPV6_UNICAST_HOPS:
@@ -1090,10 +1101,11 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
 	case IPV6_RTHDR:
 	case IPV6_DSTOPTS:
 	{
+		struct ipv6_txoptions *opt;
 
 		lock_sock(sk);
-		len = ipv6_getsockopt_sticky(sk, np->opt,
-					     optname, optval, len);
+		opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
+		len = ipv6_getsockopt_sticky(sk, opt, optname, optval, len);
 		release_sock(sk);
 		/* check if ipv6_getsockopt_sticky() returns err code */
 		if (len < 0)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index fd377c4d8986..a652fdb6bd5d 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -737,6 +737,7 @@ static int rawv6_probe_proto_opt(struct flowi6 *fl6, struct msghdr *msg)
 static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 		   struct msghdr *msg, size_t len)
 {
+	struct ipv6_txoptions *opt_to_free = NULL;
 	struct ipv6_txoptions opt_space;
 	DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
 	struct in6_addr *daddr, *final_p, final;
@@ -842,8 +843,10 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 		if (!(opt->opt_nflen|opt->opt_flen))
 			opt = NULL;
 	}
-	if (opt == NULL)
-		opt = np->opt;
+	if (!opt) {
+		opt = txopt_get(np);
+		opt_to_free = opt;
+		}
 	if (flowlabel)
 		opt = fl6_merge_options(&opt_space, flowlabel, opt);
 	opt = ipv6_fixup_options(&opt_space, opt);
@@ -904,6 +907,7 @@ done:
 	dst_release(dst);
 out:
 	fl6_sock_release(flowlabel);
+	txopt_put(opt_to_free);
 	return err<0?err:len;
 do_confirm:
 	dst_confirm(dst);
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index a822b880689b..da22766765d3 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -241,7 +241,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
 		memset(&fl6, 0, sizeof(fl6));
 		fl6.flowi6_proto = IPPROTO_TCP;
 		fl6.daddr = ireq->ir_v6_rmt_addr;
-		final_p = fl6_update_dst(&fl6, np->opt, &final);
+		final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final);
 		fl6.saddr = ireq->ir_v6_loc_addr;
 		fl6.flowi6_oif = sk->sk_bound_dev_if;
 		fl6.flowi6_mark = ireq->ir_mark;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f9f8bb3c2605..9a87a208732e 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -132,6 +132,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct in6_addr *saddr = NULL, *final_p, final;
+	struct ipv6_txoptions *opt;
 	struct rt6_info *rt;
 	struct flowi6 fl6;
 	struct dst_entry *dst;
@@ -251,7 +252,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 	fl6.fl6_dport = usin->sin6_port;
 	fl6.fl6_sport = inet->inet_sport;
 
-	final_p = fl6_update_dst(&fl6, np->opt, &final);
+	opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
+	final_p = fl6_update_dst(&fl6, opt, &final);
 
 	security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
 
@@ -280,9 +282,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
 		tcp_fetch_timewait_stamp(sk, dst);
 
 	icsk->icsk_ext_hdr_len = 0;
-	if (np->opt)
-		icsk->icsk_ext_hdr_len = (np->opt->opt_flen +
-					  np->opt->opt_nflen);
+	if (opt)
+		icsk->icsk_ext_hdr_len = opt->opt_flen +
+					 opt->opt_nflen;
 
 	tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
 
@@ -495,7 +497,8 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
 			fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts));
 
 		skb_set_queue_mapping(skb, queue_mapping);
-		err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass);
+		err = ip6_xmit(sk, skb, fl6, rcu_dereference(np->opt),
+			       np->tclass);
 		err = net_xmit_eval(err);
 	}
 
@@ -1131,6 +1134,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
 {
 	struct inet_request_sock *ireq;
 	struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
+	struct ipv6_txoptions *opt;
 	struct tcp6_sock *newtcp6sk;
 	struct inet_sock *newinet;
 	struct tcp_sock *newtp;
@@ -1269,13 +1273,15 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
 	   but we make one more one thing there: reattach optmem
 	   to newsk.
 	 */
-	if (np->opt)
-		newnp->opt = ipv6_dup_options(newsk, np->opt);
-
+	opt = rcu_dereference(np->opt);
+	if (opt) {
+		opt = ipv6_dup_options(newsk, opt);
+		RCU_INIT_POINTER(newnp->opt, opt);
+	}
 	inet_csk(newsk)->icsk_ext_hdr_len = 0;
-	if (newnp->opt)
-		inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen +
-						     newnp->opt->opt_flen);
+	if (opt)
+		inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen +
+						    opt->opt_flen;
 
 	tcp_sync_mss(newsk, dst_mtu(dst));
 	newtp->advmss = dst_metric_advmss(dst);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 72603a9af4bc..eb38829d8919 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1082,6 +1082,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
 	DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
 	struct in6_addr *daddr, *final_p, final;
 	struct ipv6_txoptions *opt = NULL;
+	struct ipv6_txoptions *opt_to_free = NULL;
 	struct ip6_flowlabel *flowlabel = NULL;
 	struct flowi6 fl6;
 	struct dst_entry *dst;
@@ -1234,8 +1235,10 @@ do_udp_sendmsg:
 			opt = NULL;
 		connected = 0;
 	}
-	if (opt == NULL)
-		opt = np->opt;
+	if (!opt) {
+		opt = txopt_get(np);
+		opt_to_free = opt;
+	}
 	if (flowlabel)
 		opt = fl6_merge_options(&opt_space, flowlabel, opt);
 	opt = ipv6_fixup_options(&opt_space, opt);
@@ -1329,6 +1332,7 @@ do_append_data:
 out:
 	dst_release(dst);
 	fl6_sock_release(flowlabel);
+	txopt_put(opt_to_free);
 	if (!err)
 		return len;
 	/*
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index f3f98a156cee..7c352ec09ec6 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -487,6 +487,7 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk,
 	DECLARE_SOCKADDR(struct sockaddr_l2tpip6 *, lsa, msg->msg_name);
 	struct in6_addr *daddr, *final_p, final;
 	struct ipv6_pinfo *np = inet6_sk(sk);
+	struct ipv6_txoptions *opt_to_free = NULL;
 	struct ipv6_txoptions *opt = NULL;
 	struct ip6_flowlabel *flowlabel = NULL;
 	struct dst_entry *dst = NULL;
@@ -576,8 +577,10 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk,
 			opt = NULL;
 	}
 
-	if (opt == NULL)
-		opt = np->opt;
+	if (!opt) {
+		opt = txopt_get(np);
+		opt_to_free = opt;
+	}
 	if (flowlabel)
 		opt = fl6_merge_options(&opt_space, flowlabel, opt);
 	opt = ipv6_fixup_options(&opt_space, opt);
@@ -632,6 +635,7 @@ done:
 	dst_release(dst);
 out:
 	fl6_sock_release(flowlabel);
+	txopt_put(opt_to_free);
 
 	return err < 0 ? err : len;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 052/126] net/neighbour: fix crash at dumping device-agnostic proxy entries
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 051/126] ipv6: add complete rcu protection around np->opt Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 053/126] ipv6: sctp: implement sctp_v6_destroy_sock() Luis Henriques
                   ` (73 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Konstantin Khlebnikov, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Konstantin Khlebnikov <koct9i@gmail.com>

commit 6adc5fd6a142c6e2c80574c1db0c7c17dedaa42e upstream.

Proxy entries could have null pointer to net-device.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Fixes: 84920c1420e2 ("net: Allow ipv6 proxies and arp proxies be shown with iproute2")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/neighbour.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 2b0d99dad8be..0478423afd29 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2263,7 +2263,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn,
 	ndm->ndm_pad2    = 0;
 	ndm->ndm_flags	 = pn->flags | NTF_PROXY;
 	ndm->ndm_type	 = RTN_UNICAST;
-	ndm->ndm_ifindex = pn->dev->ifindex;
+	ndm->ndm_ifindex = pn->dev ? pn->dev->ifindex : 0;
 	ndm->ndm_state	 = NUD_NONE;
 
 	if (nla_put(skb, NDA_DST, tbl->key_len, pn->key))
@@ -2337,7 +2337,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
 		if (h > s_h)
 			s_idx = 0;
 		for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
-			if (dev_net(n->dev) != net)
+			if (pneigh_net(n) != net)
 				continue;
 			if (idx < s_idx)
 				goto next;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 053/126] ipv6: sctp: implement sctp_v6_destroy_sock()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 052/126] net/neighbour: fix crash at dumping device-agnostic proxy entries Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 054/126] xfs: allow inode allocations in post-growfs disk space Luis Henriques
                   ` (72 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 602dd62dfbda3e63a2d6a3cbde953ebe82bf5087 upstream.

Dmitry Vyukov reported a memory leak using IPV6 SCTP sockets.

We need to call inet6_destroy_sock() to properly release
inet6 specific fields.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sctp/socket.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 16991386baa3..a8fd2f57af97 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7179,6 +7179,13 @@ struct proto sctp_prot = {
 
 #if IS_ENABLED(CONFIG_IPV6)
 
+#include <net/transp_v6.h>
+static void sctp_v6_destroy_sock(struct sock *sk)
+{
+	sctp_destroy_sock(sk);
+	inet6_destroy_sock(sk);
+}
+
 struct proto sctpv6_prot = {
 	.name		= "SCTPv6",
 	.owner		= THIS_MODULE,
@@ -7188,7 +7195,7 @@ struct proto sctpv6_prot = {
 	.accept		= sctp_accept,
 	.ioctl		= sctp_ioctl,
 	.init		= sctp_init_sock,
-	.destroy	= sctp_destroy_sock,
+	.destroy	= sctp_v6_destroy_sock,
 	.shutdown	= sctp_shutdown,
 	.setsockopt	= sctp_setsockopt,
 	.getsockopt	= sctp_getsockopt,

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 054/126] xfs: allow inode allocations in post-growfs disk space
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 053/126] ipv6: sctp: implement sctp_v6_destroy_sock() Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 055/126] ALSA: usb-audio: add packet size quirk for the Medeli DD305 Luis Henriques
                   ` (71 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Sandeen, Dave Chinner, Ben Hutchings, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Sandeen <sandeen@redhat.com>

commit 9de67c3ba9ea961ba420573d56479d09d33a7587 upstream.

Today, if we perform an xfs_growfs which adds allocation groups,
mp->m_maxagi is not properly updated when the growfs is complete.

Therefore inodes will continue to be allocated only in the
AGs which existed prior to the growfs, and the new space
won't be utilized.

This is because of this path in xfs_growfs_data_private():

xfs_growfs_data_private
	xfs_initialize_perag(mp, nagcount, &nagimax);
		if (mp->m_flags & XFS_MOUNT_32BITINODES)
			index = xfs_set_inode32(mp);
		else
			index = xfs_set_inode64(mp);

		if (maxagi)
			*maxagi = index;

where xfs_set_inode* iterates over the (old) agcount in
mp->m_sb.sb_agblocks, which has not yet been updated
in the growfs path.  So "index" will be returned based on
the old agcount, not the new one, and new AGs are not available
for inode allocation.

Fix this by explicitly passing the proper AG count (which
xfs_initialize_perag() already has) down another level,
so that xfs_set_inode* can make the proper decision about
acceptable AGs for inode allocation in the potentially
newly-added AGs.

This has been broken since 3.7, when these two
xfs_set_inode* functions were added in commit 2d2194f.
Prior to that, we looped over "agcount" not sb_agblocks
in these calculations.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/xfs/xfs_mount.c |  4 ++--
 fs/xfs/xfs_super.c | 20 +++++++++++++-------
 fs/xfs/xfs_super.h |  4 ++--
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 3507cd0ec400..0a8069b38ba6 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -250,9 +250,9 @@ xfs_initialize_perag(
 		mp->m_flags &= ~XFS_MOUNT_32BITINODES;
 
 	if (mp->m_flags & XFS_MOUNT_32BITINODES)
-		index = xfs_set_inode32(mp);
+		index = xfs_set_inode32(mp, agcount);
 	else
-		index = xfs_set_inode64(mp);
+		index = xfs_set_inode64(mp, agcount);
 
 	if (maxagi)
 		*maxagi = index;
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 2637010a6224..0ee601b67d9e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -597,8 +597,13 @@ xfs_max_file_offset(
 	return (((__uint64_t)pagefactor) << bitshift) - 1;
 }
 
+/*
+ * xfs_set_inode32() and xfs_set_inode64() are passed an agcount
+ * because in the growfs case, mp->m_sb.sb_agcount is not updated
+ * yet to the potentially higher ag count.
+ */
 xfs_agnumber_t
-xfs_set_inode32(struct xfs_mount *mp)
+xfs_set_inode32(struct xfs_mount *mp, xfs_agnumber_t agcount)
 {
 	xfs_agnumber_t	index = 0;
 	xfs_agnumber_t	maxagi = 0;
@@ -620,10 +625,10 @@ xfs_set_inode32(struct xfs_mount *mp)
 		do_div(icount, sbp->sb_agblocks);
 		max_metadata = icount;
 	} else {
-		max_metadata = sbp->sb_agcount;
+		max_metadata = agcount;
 	}
 
-	for (index = 0; index < sbp->sb_agcount; index++) {
+	for (index = 0; index < agcount; index++) {
 		ino = XFS_AGINO_TO_INO(mp, index, agino);
 
 		if (ino > XFS_MAXINUMBER_32) {
@@ -648,11 +653,11 @@ xfs_set_inode32(struct xfs_mount *mp)
 }
 
 xfs_agnumber_t
-xfs_set_inode64(struct xfs_mount *mp)
+xfs_set_inode64(struct xfs_mount *mp, xfs_agnumber_t agcount)
 {
 	xfs_agnumber_t index = 0;
 
-	for (index = 0; index < mp->m_sb.sb_agcount; index++) {
+	for (index = 0; index < agcount; index++) {
 		struct xfs_perag	*pag;
 
 		pag = xfs_perag_get(mp, index);
@@ -1188,6 +1193,7 @@ xfs_fs_remount(
 	char			*options)
 {
 	struct xfs_mount	*mp = XFS_M(sb);
+	xfs_sb_t		*sbp = &mp->m_sb;
 	substring_t		args[MAX_OPT_ARGS];
 	char			*p;
 	int			error;
@@ -1208,10 +1214,10 @@ xfs_fs_remount(
 			mp->m_flags &= ~XFS_MOUNT_BARRIER;
 			break;
 		case Opt_inode64:
-			mp->m_maxagi = xfs_set_inode64(mp);
+			mp->m_maxagi = xfs_set_inode64(mp, sbp->sb_agcount);
 			break;
 		case Opt_inode32:
-			mp->m_maxagi = xfs_set_inode32(mp);
+			mp->m_maxagi = xfs_set_inode32(mp, sbp->sb_agcount);
 			break;
 		default:
 			/*
diff --git a/fs/xfs/xfs_super.h b/fs/xfs/xfs_super.h
index bbe3d15a7904..b4cfe21d8fb0 100644
--- a/fs/xfs/xfs_super.h
+++ b/fs/xfs/xfs_super.h
@@ -76,8 +76,8 @@ extern __uint64_t xfs_max_file_offset(unsigned int);
 
 extern void xfs_flush_inodes(struct xfs_mount *mp);
 extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
-extern xfs_agnumber_t xfs_set_inode32(struct xfs_mount *);
-extern xfs_agnumber_t xfs_set_inode64(struct xfs_mount *);
+extern xfs_agnumber_t xfs_set_inode32(struct xfs_mount *, xfs_agnumber_t agcount);
+extern xfs_agnumber_t xfs_set_inode64(struct xfs_mount *, xfs_agnumber_t agcount);
 
 extern const struct export_operations xfs_export_operations;
 extern const struct xattr_handler *xfs_xattr_handlers[];

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 055/126] ALSA: usb-audio: add packet size quirk for the Medeli DD305
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 054/126] xfs: allow inode allocations in post-growfs disk space Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 056/126] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption Luis Henriques
                   ` (70 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Clemens Ladisch, Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Clemens Ladisch <clemens@ladisch.de>

commit 98d362becb6621bebdda7ed0eac7ad7ec6c37898 upstream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/midi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 76747806dc67..d09088727e5f 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -1326,6 +1326,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
 		 * Various chips declare a packet size larger than 4 bytes, but
 		 * do not actually work with larger packets:
 		 */
+	case USB_ID(0x0a67, 0x5011): /* Medeli DD305 */
 	case USB_ID(0x0a92, 0x1020): /* ESI M4U */
 	case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */
 	case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 056/126] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 055/126] ALSA: usb-audio: add packet size quirk for the Medeli DD305 Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 057/126] ALSA: usb-audio: work around CH345 input " Luis Henriques
                   ` (69 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Clemens Ladisch, Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Clemens Ladisch <clemens@ladisch.de>

commit 1ca8b201309d842642f221db7f02f71c0af5be2d upstream.

The CH345 USB MIDI chip has two output ports.  However, they are
multiplexed through one pin, and the number of ports cannot be reduced
even for hardware that implements only one connector, so for those
devices, data sent to either port ends up on the same hardware output.
This becomes a problem when both ports are used at the same time, as
longer MIDI commands (such as SysEx messages) are likely to be
interrupted by messages from the other port, and thus to get lost.

It would not be possible for the driver to detect how many ports the
device actually has, except that in practice, _all_ devices built with
the CH345 have only one port.  So we can just ignore the device's
descriptors, and hardcode one output port.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/midi.c         |  3 +++
 sound/usb/quirks-table.h | 11 +++++++++++
 sound/usb/quirks.c       |  1 +
 sound/usb/usbaudio.h     |  1 +
 4 files changed, 16 insertions(+)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index d09088727e5f..3f1838732b95 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2294,6 +2294,9 @@ int snd_usbmidi_create(struct snd_card *card,
 
 		err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
 		break;
+	case QUIRK_MIDI_CH345:
+		err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+		break;
 	default:
 		dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type);
 		err = -ENXIO;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 7c24088bcaa4..c600d4277974 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -2875,6 +2875,17 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 	.idProduct = 0x1020,
 },
 
+/* QinHeng devices */
+{
+	USB_DEVICE(0x1a86, 0x752d),
+	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
+		.vendor_name = "QinHeng",
+		.product_name = "CH345",
+		.ifnum = 1,
+		.type = QUIRK_MIDI_CH345
+	}
+},
+
 /* KeithMcMillen Stringport */
 {
 	USB_DEVICE(0x1f38, 0x0001),
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 337067cce251..a9945fd050de 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -526,6 +526,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_MIDI_CME] = create_any_midi_quirk,
 		[QUIRK_MIDI_AKAI] = create_any_midi_quirk,
 		[QUIRK_MIDI_FTDI] = create_any_midi_quirk,
+		[QUIRK_MIDI_CH345] = create_any_midi_quirk,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 91d0380431b4..991aa84491cd 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -94,6 +94,7 @@ enum quirk_type {
 	QUIRK_MIDI_AKAI,
 	QUIRK_MIDI_US122L,
 	QUIRK_MIDI_FTDI,
+	QUIRK_MIDI_CH345,
 	QUIRK_AUDIO_STANDARD_INTERFACE,
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 057/126] ALSA: usb-audio: work around CH345 input SysEx corruption
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 056/126] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 058/126] dm thin: restore requested 'error_if_no_space' setting on OODS to WRITE transition Luis Henriques
                   ` (68 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Clemens Ladisch, Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Clemens Ladisch <clemens@ladisch.de>

commit a91e627e3f0ed820b11d86cdc04df38f65f33a70 upstream.

One of the many faults of the QinHeng CH345 USB MIDI interface chip is
that it does not handle received SysEx messages correctly -- every second
event packet has a wrong code index number, which is the one from the last
seen message, instead of 4.  For example, the two messages "FE F0 01 02 03
04 05 06 07 08 09 0A 0B 0C 0D 0E F7" result in the following event
packets:

correct:       CH345:
0F FE 00 00    0F FE 00 00
04 F0 01 02    04 F0 01 02
04 03 04 05    0F 03 04 05
04 06 07 08    04 06 07 08
04 09 0A 0B    0F 09 0A 0B
04 0C 0D 0E    04 0C 0D 0E
05 F7 00 00    05 F7 00 00

A class-compliant driver must interpret an event packet with CIN 15 as
having a single data byte, so the other two bytes would be ignored.  The
message received by the host would then be missing two bytes out of six;
in this example, "F0 01 02 03 06 07 08 09 0C 0D 0E F7".

These corrupted SysEx event packages contain only data bytes, while the
CH345 uses event packets with a correct CIN value only for messages with
a status byte, so it is possible to distinguish between these two cases by
checking for the presence of this status byte.

(Other bugs in the CH345's input handling, such as the corruption resulting
from running status, cannot be worked around.)

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/midi.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 3f1838732b95..70c97cc4574c 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -174,6 +174,8 @@ struct snd_usb_midi_in_endpoint {
 		u8 running_status_length;
 	} ports[0x10];
 	u8 seen_f5;
+	bool in_sysex;
+	u8 last_cin;
 	u8 error_resubmit;
 	int current_port;
 };
@@ -465,6 +467,39 @@ static void snd_usbmidi_maudio_broken_running_status_input(
 }
 
 /*
+ * QinHeng CH345 is buggy: every second packet inside a SysEx has not CIN 4
+ * but the previously seen CIN, but still with three data bytes.
+ */
+static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep,
+				     uint8_t *buffer, int buffer_length)
+{
+	unsigned int i, cin, length;
+
+	for (i = 0; i + 3 < buffer_length; i += 4) {
+		if (buffer[i] == 0 && i > 0)
+			break;
+		cin = buffer[i] & 0x0f;
+		if (ep->in_sysex &&
+		    cin == ep->last_cin &&
+		    (buffer[i + 1 + (cin == 0x6)] & 0x80) == 0)
+			cin = 0x4;
+#if 0
+		if (buffer[i + 1] == 0x90) {
+			/*
+			 * Either a corrupted running status or a real note-on
+			 * message; impossible to detect reliably.
+			 */
+		}
+#endif
+		length = snd_usbmidi_cin_length[cin];
+		snd_usbmidi_input_data(ep, 0, &buffer[i + 1], length);
+		ep->in_sysex = cin == 0x4;
+		if (!ep->in_sysex)
+			ep->last_cin = cin;
+	}
+}
+
+/*
  * CME protocol: like the standard protocol, but SysEx commands are sent as a
  * single USB packet preceded by a 0x0F byte.
  */
@@ -650,6 +685,12 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = {
 	.output_packet = snd_usbmidi_output_standard_packet,
 };
 
+static struct usb_protocol_ops snd_usbmidi_ch345_broken_sysex_ops = {
+	.input = ch345_broken_sysex_input,
+	.output = snd_usbmidi_standard_output,
+	.output_packet = snd_usbmidi_output_standard_packet,
+};
+
 /*
  * AKAI MPD16 protocol:
  *
@@ -2295,6 +2336,7 @@ int snd_usbmidi_create(struct snd_card *card,
 		err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
 		break;
 	case QUIRK_MIDI_CH345:
+		umidi->usb_protocol_ops = &snd_usbmidi_ch345_broken_sysex_ops;
 		err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
 		break;
 	default:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 058/126] dm thin: restore requested 'error_if_no_space' setting on OODS to WRITE transition
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 057/126] ALSA: usb-audio: work around CH345 input " Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 059/126] dm: fix ioctl retry termination with signal Luis Henriques
                   ` (67 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Mike Snitzer, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mike Snitzer <snitzer@redhat.com>

commit 172c238612ebf81cabccc86b788c9209af591f61 upstream.

A thin-pool that is in out-of-data-space (OODS) mode may transition back
to write mode -- without the admin adding more space to the thin-pool --
if/when blocks are released (either by deleting thin devices or
discarding provisioned blocks).

But as part of the thin-pool's earlier transition to out-of-data-space
mode the thin-pool may have set the 'error_if_no_space' flag to true if
the no_space_timeout expires without more space having been made
available.  That implementation detail, of changing the pool's
error_if_no_space setting, needs to be reset back to the default that
the user specified when the thin-pool's table was loaded.

Otherwise we'll drop the user requested behaviour on the floor when this
out-of-data-space to write mode transition occurs.

Reported-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Fixes: 2c43fd26e4 ("dm thin: fix missing out-of-data-space to write mode transition if blocks are released")
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-thin.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 6d8895422f31..e298762d29a6 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1786,6 +1786,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
 	case PM_WRITE:
 		if (old_mode != new_mode)
 			notify_of_pool_mode_change(pool, "write");
+		pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space;
 		dm_pool_metadata_read_write(pool->pmd);
 		pool->process_bio = process_bio;
 		pool->process_discard = process_discard;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 059/126] dm: fix ioctl retry termination with signal
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 058/126] dm thin: restore requested 'error_if_no_space' setting on OODS to WRITE transition Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 060/126] MIPS: KVM: Fix ASID restoration logic Luis Henriques
                   ` (66 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jun'ichi Nomura, Hannes Reinecke, Mikulas Patocka,
	Mike Snitzer, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Junichi Nomura <j-nomura@ce.jp.nec.com>

commit 5bbbfdf685657771fda05b926b28ca0f79163a28 upstream.

dm-mpath retries ioctl, when no path is readily available and the device
is configured to queue I/O in such a case. If you want to stop the retry
before multipathd decides to turn off queueing mode, you could send
signal for the process to exit from the loop.

However the check of fatal signal has not carried along when commit
6c182cd88d17 ("dm mpath: fix ioctl deadlock when no paths") moved the
loop from dm-mpath to dm core. As a result, we can't terminate such
a process in the retry loop.

Easy reproducer of the situation is:

  # dmsetup create mp --table '0 1024 multipath 0 0 0 0'
  # dmsetup message mp 0 'queue_if_no_path'
  # sg_inq /dev/mapper/mp

then you should be able to terminate sg_inq by pressing Ctrl+C.

Fixes: 6c182cd88d17 ("dm mpath: fix ioctl deadlock when no paths")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-mpath.c | 2 +-
 drivers/md/dm.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 43e2b498732f..34601cc0c508 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1548,7 +1548,7 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
 	if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)
 		r = scsi_verify_blk_ioctl(NULL, cmd);
 
-	if (r == -ENOTCONN && !fatal_signal_pending(current)) {
+	if (r == -ENOTCONN) {
 		spin_lock_irqsave(&m->lock, flags);
 		if (!m->current_pg) {
 			/* Path status changed, redo selection */
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 91b239489785..f62d4c8bd9f9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -528,7 +528,7 @@ retry:
 out:
 	dm_put_live_table(md, srcu_idx);
 
-	if (r == -ENOTCONN) {
+	if (r == -ENOTCONN && !fatal_signal_pending(current)) {
 		msleep(10);
 		goto retry;
 	}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 060/126] MIPS: KVM: Fix ASID restoration logic
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 059/126] dm: fix ioctl retry termination with signal Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 061/126] MIPS: KVM: Fix CACHE immediate offset sign extension Luis Henriques
                   ` (65 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Ralf Baechle, Paolo Bonzini, Gleb Natapov,
	linux-mips, kvm, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit 002374f371bd02df864cce1fe85d90dc5b292837 upstream.

ASID restoration on guest resume should determine the guest execution
mode based on the guest Status register rather than bit 30 of the guest
PC.

Fix the two places in locore.S that do this, loading the guest status
from the cop0 area. Note, this assembly is specific to the trap &
emulate implementation of KVM, so it doesn't need to check the
supervisor bit as that mode is not implemented in the guest.

Fixes: b680f70fc111 ("KVM/MIPS32: Entry point for trampolining to...")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[ luis: backported to 3.16:
  - file rename: locore.S -> kvm_locore.S ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/kvm_locore.S | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S
index 17376cd838e6..fc24acb3a837 100644
--- a/arch/mips/kvm/kvm_locore.S
+++ b/arch/mips/kvm/kvm_locore.S
@@ -159,9 +159,11 @@ FEXPORT(__kvm_mips_vcpu_run)
 
 FEXPORT(__kvm_mips_load_asid)
 	/* Set the ASID for the Guest Kernel */
-	INT_SLL	t0, t0, 1	/* with kseg0 @ 0x40000000, kernel */
-			        /* addresses shift to 0x80000000 */
-	bltz	t0, 1f		/* If kernel */
+	PTR_L	t0, VCPU_COP0(k1)
+	LONG_L	t0, COP0_STATUS(t0)
+	andi	t0, KSU_USER | ST0_ERL | ST0_EXL
+	xori	t0, KSU_USER
+	bnez	t0, 1f		/* If kernel */
 	 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID  /* (BD)  */
 	INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID    /* else user */
 1:
@@ -438,9 +440,11 @@ __kvm_mips_return_to_guest:
 	mtc0	t0, CP0_EPC
 
 	/* Set the ASID for the Guest Kernel */
-	INT_SLL	t0, t0, 1	/* with kseg0 @ 0x40000000, kernel */
-				/* addresses shift to 0x80000000 */
-	bltz	t0, 1f		/* If kernel */
+	PTR_L	t0, VCPU_COP0(k1)
+	LONG_L	t0, COP0_STATUS(t0)
+	andi	t0, KSU_USER | ST0_ERL | ST0_EXL
+	xori	t0, KSU_USER
+	bnez	t0, 1f		/* If kernel */
 	 INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID  /* (BD)  */
 	INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID    /* else user */
 1:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 061/126] MIPS: KVM: Fix CACHE immediate offset sign extension
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 060/126] MIPS: KVM: Fix ASID restoration logic Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 062/126] MIPS: KVM: Uninit VCPU in vcpu_create error path Luis Henriques
                   ` (64 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Ralf Baechle, Paolo Bonzini, Gleb Natapov,
	linux-mips, kvm, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit c5c2a3b998f1ff5a586f9d37e154070b8d550d17 upstream.

The immediate field of the CACHE instruction is signed, so ensure that
it gets sign extended by casting it to an int16_t rather than just
masking the low 16 bits.

Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[ luis: backported to 3.16:
  - file rename: emulate.c -> kvm_mips_emul.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/kvm_mips_emul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c
index 18b4e2fdae33..950229176c2f 100644
--- a/arch/mips/kvm/kvm_mips_emul.c
+++ b/arch/mips/kvm/kvm_mips_emul.c
@@ -1434,7 +1434,7 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause,
 
 	base = (inst >> 21) & 0x1f;
 	op_inst = (inst >> 16) & 0x1f;
-	offset = inst & 0xffff;
+	offset = (int16_t)inst;
 	cache = (inst >> 16) & 0x3;
 	op = (inst >> 18) & 0x7;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 062/126] MIPS: KVM: Uninit VCPU in vcpu_create error path
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 061/126] MIPS: KVM: Fix CACHE immediate offset sign extension Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 063/126] ALSA: hda - Add fixup for Acer Aspire One Cloudbook 14 Luis Henriques
                   ` (63 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Ralf Baechle, Paolo Bonzini, Gleb Natapov,
	linux-mips, kvm, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit 585bb8f9a5e592f2ce7abbe5ed3112d5438d2754 upstream.

If either of the memory allocations in kvm_arch_vcpu_create() fail, the
vcpu which has been allocated and kvm_vcpu_init'd doesn't get uninit'd
in the error handling path. Add a call to kvm_vcpu_uninit() to fix this.

Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[ luis: backported to 3.16:
  - file rename: mips.c -> kvm_mips.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/kvm_mips.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index cc721a3c8996..2c81c2c9e8dc 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -307,7 +307,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
 
 	if (!gebase) {
 		err = -ENOMEM;
-		goto out_free_cpu;
+		goto out_uninit_cpu;
 	}
 	kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n",
 		  ALIGN(size, PAGE_SIZE), gebase);
@@ -368,6 +368,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
 out_free_gebase:
 	kfree(gebase);
 
+out_uninit_cpu:
+	kvm_vcpu_uninit(vcpu);
+
 out_free_cpu:
 	kfree(vcpu);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 063/126] ALSA: hda - Add fixup for Acer Aspire One Cloudbook 14
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 062/126] MIPS: KVM: Uninit VCPU in vcpu_create error path Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 064/126] mac: validate mac_partition is within sector Luis Henriques
                   ` (62 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit b9c2fa52135d49a931c56ed2bfc17d61f771b412 upstream.

For making the speakers on Acer Aspire One Cloudbook 14 to work, we
need the as same quirk as for another Chromebook.  This patch adds the
corresponding fixup entry.

Reported-by: Patrick <epictetus@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index a68209c245e2..e78193d905d9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4794,6 +4794,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
+	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 064/126] mac: validate mac_partition is within sector
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 063/126] ALSA: hda - Add fixup for Acer Aspire One Cloudbook 14 Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 065/126] ALSA: hda - Apply HP headphone fixups more generically Luis Henriques
                   ` (61 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kees Cook, Jens Axboe, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kees Cook <keescook@chromium.org>

commit 02e2a5bfebe99edcf9d694575a75032d53fe1b73 upstream.

If md->signature == MAC_DRIVER_MAGIC and md->block_size == 1023, a single
512 byte sector would be read (secsize / 512). However the partition
structure would be located past the end of the buffer (secsize % 512).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 block/partitions/mac.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/block/partitions/mac.c b/block/partitions/mac.c
index 76d8ba6379a9..bd5b91465230 100644
--- a/block/partitions/mac.c
+++ b/block/partitions/mac.c
@@ -32,7 +32,7 @@ int mac_partition(struct parsed_partitions *state)
 	Sector sect;
 	unsigned char *data;
 	int slot, blocks_in_map;
-	unsigned secsize;
+	unsigned secsize, datasize, partoffset;
 #ifdef CONFIG_PPC_PMAC
 	int found_root = 0;
 	int found_root_goodness = 0;
@@ -50,10 +50,14 @@ int mac_partition(struct parsed_partitions *state)
 	}
 	secsize = be16_to_cpu(md->block_size);
 	put_dev_sector(sect);
-	data = read_part_sector(state, secsize/512, &sect);
+	datasize = round_down(secsize, 512);
+	data = read_part_sector(state, datasize / 512, &sect);
 	if (!data)
 		return -1;
-	part = (struct mac_partition *) (data + secsize%512);
+	partoffset = secsize % 512;
+	if (partoffset + sizeof(*part) > datasize)
+		return -1;
+	part = (struct mac_partition *) (data + partoffset);
 	if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
 		put_dev_sector(sect);
 		return 0;		/* not a MacOS disk */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 065/126] ALSA: hda - Apply HP headphone fixups more generically
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 064/126] mac: validate mac_partition is within sector Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 066/126] powerpc/tm: Block signal return setting invalid MSR state Luis Henriques
                   ` (60 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 196543d54574f50e3fd04df4e3048181e006a9da upstream.

It turned out that many HP laptops suffer from the same problem as
fixed in commit [c932b98c1e47: ALSA: hda - Apply pin fixup for HP
ProBook 6550b].  But, it's tiresome to list up all such PCI SSIDs, as
there are really lots of HP machines.

Instead, we do a bit more clever, try to check the supposedly dock and
built-in headphone pins, and apply the fixup when both seem valid.
This rule can be applied generically to all models using the same
quirk, so we'll fix all in a shot.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=107491
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c | 45 +++++++++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 28c9f20c2f63..3a014a4e6f51 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3143,6 +3143,29 @@ static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
 	spec->gpio_led = 0x08;
 }
 
+static bool is_hp_output(struct hda_codec *codec, hda_nid_t pin)
+{
+	unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
+
+	/* count line-out, too, as BIOS sets often so */
+	return get_defcfg_connect(pin_cfg) != AC_JACK_PORT_NONE &&
+		(get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
+		 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT);
+}
+
+static void fixup_hp_headphone(struct hda_codec *codec, hda_nid_t pin)
+{
+	unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, pin);
+
+	/* It was changed in the BIOS to just satisfy MS DTM.
+	 * Lets turn it back into slaved HP
+	 */
+	pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
+		(AC_JACK_HP_OUT << AC_DEFCFG_DEVICE_SHIFT);
+	pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | AC_DEFCFG_SEQUENCE))) |
+		0x1f;
+	snd_hda_codec_set_pincfg(codec, pin, pin_cfg);
+}
 
 static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
 				   const struct hda_fixup *fix, int action)
@@ -3152,22 +3175,12 @@ static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
 		return;
 
-	if (hp_blike_system(codec->subsystem_id)) {
-		unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
-		if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
-			get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER  ||
-			get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
-			/* It was changed in the BIOS to just satisfy MS DTM.
-			 * Lets turn it back into slaved HP
-			 */
-			pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
-					| (AC_JACK_HP_OUT <<
-						AC_DEFCFG_DEVICE_SHIFT);
-			pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
-							| AC_DEFCFG_SEQUENCE)))
-								| 0x1f;
-			snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
-		}
+	/* when both output A and F are assigned, these are supposedly
+	 * dock and built-in headphones; fix both pin configs
+	 */
+	if (is_hp_output(codec, 0x0a) && is_hp_output(codec, 0x0f)) {
+		fixup_hp_headphone(codec, 0x0a);
+		fixup_hp_headphone(codec, 0x0f);
 	}
 
 	if (find_mute_led_cfg(codec, 1))

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 066/126] powerpc/tm: Block signal return setting invalid MSR state
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 065/126] ALSA: hda - Apply HP headphone fixups more generically Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 067/126] powerpc/tm: Check for already reclaimed tasks Luis Henriques
                   ` (59 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Neuling, Michael Ellerman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Neuling <mikey@neuling.org>

commit d2b9d2a5ad5ef04ff978c9923d19730cb05efd55 upstream.

Currently we allow both the MSR T and S bits to be set by userspace on
a signal return.  Unfortunately this is a reserved configuration and
will cause a TM Bad Thing exception if attempted (via rfid).

This patch checks for this case in both the 32 and 64 bit signals
code.  If both T and S are set, we mark the context as invalid.

Found using a syscall fuzzer.

Fixes: 2b0a576d15e0 ("powerpc: Add new transactional memory state to the signal context")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/include/asm/reg.h  |  1 +
 arch/powerpc/kernel/signal_32.c | 14 +++++++++-----
 arch/powerpc/kernel/signal_64.c |  4 ++++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index e73cdadab785..c34b2d302f0e 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -108,6 +108,7 @@
 #define MSR_TS_T	__MASK(MSR_TS_T_LG)	/*  Transaction Transactional */
 #define MSR_TS_MASK	(MSR_TS_T | MSR_TS_S)   /* Transaction State bits */
 #define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */
+#define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */
 #define MSR_TM_TRANSACTIONAL(x)	(((x) & MSR_TS_MASK) == MSR_TS_T)
 #define MSR_TM_SUSPENDED(x)	(((x) & MSR_TS_MASK) == MSR_TS_S)
 
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 84d9e9bc6415..fccd6261326a 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -875,6 +875,15 @@ static long restore_tm_user_regs(struct pt_regs *regs,
 		return 1;
 #endif /* CONFIG_SPE */
 
+	/* Get the top half of the MSR from the user context */
+	if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
+		return 1;
+	msr_hi <<= 32;
+	/* If TM bits are set to the reserved value, it's an invalid context */
+	if (MSR_TM_RESV(msr_hi))
+		return 1;
+	/* Pull in the MSR TM bits from the user context */
+	regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);
 	/* Now, recheckpoint.  This loads up all of the checkpointed (older)
 	 * registers, including FP and V[S]Rs.  After recheckpointing, the
 	 * transactional versions should be loaded.
@@ -884,11 +893,6 @@ static long restore_tm_user_regs(struct pt_regs *regs,
 	current->thread.tm_texasr |= TEXASR_FS;
 	/* This loads the checkpointed FP/VEC state, if used */
 	tm_recheckpoint(&current->thread, msr);
-	/* Get the top half of the MSR */
-	if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
-		return 1;
-	/* Pull in MSR TM from user context */
-	regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK);
 
 	/* This loads the speculative FP/VEC state, if used */
 	if (msr & MSR_FP) {
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 97c1e4b683fc..36a6bcb4ffdc 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -427,6 +427,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
 
 	/* get MSR separately, transfer the LE bit if doing signal return */
 	err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
+	/* Don't allow reserved mode. */
+	if (MSR_TM_RESV(msr))
+		return -EINVAL;
+
 	/* pull in MSR TM from user context */
 	regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 067/126] powerpc/tm: Check for already reclaimed tasks
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 066/126] powerpc/tm: Block signal return setting invalid MSR state Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 068/126] ARC: dw2 unwind: Remove falllback linear search thru FDE entries Luis Henriques
                   ` (58 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Neuling, Michael Ellerman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Neuling <mikey@neuling.org>

commit 7f821fc9c77a9b01fe7b1d6e72717b33d8d64142 upstream.

Currently we can hit a scenario where we'll tm_reclaim() twice.  This
results in a TM bad thing exception because the second reclaim occurs
when not in suspend mode.

The scenario in which this can happen is the following.  We attempt to
deliver a signal to userspace.  To do this we need obtain the stack
pointer to write the signal context.  To get this stack pointer we
must tm_reclaim() in case we need to use the checkpointed stack
pointer (see get_tm_stackpointer()).  Normally we'd then return
directly to userspace to deliver the signal without going through
__switch_to().

Unfortunatley, if at this point we get an error (such as a bad
userspace stack pointer), we need to exit the process.  The exit will
result in a __switch_to().  __switch_to() will attempt to save the
process state which results in another tm_reclaim().  This
tm_reclaim() now causes a TM Bad Thing exception as this state has
already been saved and the processor is no longer in TM suspend mode.
Whee!

This patch checks the state of the MSR to ensure we are TM suspended
before we attempt the tm_reclaim().  If we've already saved the state
away, we should no longer be in TM suspend mode.  This has the
additional advantage of checking for a potential TM Bad Thing
exception.

Found using syscall fuzzer.

Fixes: fb09692e71f1 ("powerpc: Add reclaim and recheckpoint functions for context switching transactional memory processes")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/process.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index be99774d3f44..7ecc2f9dfa86 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -553,6 +553,24 @@ static void tm_reclaim_thread(struct thread_struct *thr,
 		msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;
 	}
 
+	/*
+	 * Use the current MSR TM suspended bit to track if we have
+	 * checkpointed state outstanding.
+	 * On signal delivery, we'd normally reclaim the checkpointed
+	 * state to obtain stack pointer (see:get_tm_stackpointer()).
+	 * This will then directly return to userspace without going
+	 * through __switch_to(). However, if the stack frame is bad,
+	 * we need to exit this thread which calls __switch_to() which
+	 * will again attempt to reclaim the already saved tm state.
+	 * Hence we need to check that we've not already reclaimed
+	 * this state.
+	 * We do this using the current MSR, rather tracking it in
+	 * some specific thread_struct bit, as it has the additional
+	 * benifit of checking for a potential TM bad thing exception.
+	 */
+	if (!MSR_TM_SUSPENDED(mfmsr()))
+		return;
+
 	tm_reclaim(thr, thr->regs->msr, cause);
 
 	/* Having done the reclaim, we now have the checkpointed

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 068/126] ARC: dw2 unwind: Remove falllback linear search thru FDE entries
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 067/126] powerpc/tm: Check for already reclaimed tasks Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 069/126] fix sysvfs symlinks Luis Henriques
                   ` (57 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vineet Gupta <vgupta@synopsys.com>

commit 2e22502c080f27afeab5e6f11e618fb7bc7aea53 upstream.

Fixes STAR 9000953410: "perf callgraph profiling causing RCU stalls"

| perf record -g -c 15000 -e cycles /sbin/hackbench
|
| INFO: rcu_preempt self-detected stall on CPU
| 1: (1 GPs behind) idle=609/140000000000002/0 softirq=2914/2915 fqs=603
| Task dump for CPU 1:

in-kernel dwarf unwinder has a fast binary lookup and a fallback linear
search (which iterates thru each of ~11K entries) thus takes 2 orders of
magnitude longer (~3 million cycles vs. 2000). Routines written in hand
assembler lack dwarf info (as we don't support assembler CFI pseudo-ops
yet) fail the unwinder binary lookup, hit linear search, failing
nevertheless in the end.

However the linear search is pointless as binary lookup tables are created
from it in first place. It is impossible to have binary lookup fail while
succeed the linear search. It is pure waste of cycles thus removed by
this patch.

This manifested as RCU stalls / NMI watchdog splat when running
hackbench under perf with callgraph profiling. The triggering condition
was perf counter overflowing in routine lacking dwarf info (like memset)
leading to patheic 3 million cycle unwinder slow path and by the time it
returned new interrupts were already pending (Timer, IPI) and taken
rightaway. The original memset didn't make forward progress, system kept
accruing more interrupts and more unwinder delayes in a vicious feedback
loop, ultimately triggering the NMI diagnostic.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arc/kernel/unwind.c | 37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)

diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index e550b117ec4f..2d6a36ea8aaf 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -986,42 +986,13 @@ int arc_unwind(struct unwind_frame_info *frame)
 							    (const u8 *)(fde +
 									 1) +
 							    *fde, ptrType);
-				if (pc >= endLoc)
+				if (pc >= endLoc) {
 					fde = NULL;
-			} else
-				fde = NULL;
-		}
-		if (fde == NULL) {
-			for (fde = table->address, tableSize = table->size;
-			     cie = NULL, tableSize > sizeof(*fde)
-			     && tableSize - sizeof(*fde) >= *fde;
-			     tableSize -= sizeof(*fde) + *fde,
-			     fde += 1 + *fde / sizeof(*fde)) {
-				cie = cie_for_fde(fde, table);
-				if (cie == &bad_cie) {
 					cie = NULL;
-					break;
 				}
-				if (cie == NULL
-				    || cie == &not_fde
-				    || (ptrType = fde_pointer_type(cie)) < 0)
-					continue;
-				ptr = (const u8 *)(fde + 2);
-				startLoc = read_pointer(&ptr,
-							(const u8 *)(fde + 1) +
-							*fde, ptrType);
-				if (!startLoc)
-					continue;
-				if (!(ptrType & DW_EH_PE_indirect))
-					ptrType &=
-					    DW_EH_PE_FORM | DW_EH_PE_signed;
-				endLoc =
-				    startLoc + read_pointer(&ptr,
-							    (const u8 *)(fde +
-									 1) +
-							    *fde, ptrType);
-				if (pc >= startLoc && pc < endLoc)
-					break;
+			} else {
+				fde = NULL;
+				cie = NULL;
 			}
 		}
 	}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 069/126] fix sysvfs symlinks
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 068/126] ARC: dw2 unwind: Remove falllback linear search thru FDE entries Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 070/126] vfs: Make sendfile(2) killable even better Luis Henriques
                   ` (56 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@zeniv.linux.org.uk>

commit 0ebf7f10d67a70e120f365018f1c5fce9ddc567d upstream.

The thing got broken back in 2002 - sysvfs does *not* have inline
symlinks; even short ones have bodies stored in the first block
of file.  sysv_symlink() handles that correctly; unfortunately,
attempting to look an existing symlink up will end up confusing
them for inline symlinks, and interpret the block number containing
the body as the body itself.

Nobody has noticed until now, which says something about the level
of testing sysvfs gets ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/sysv/inode.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 88956309cc86..02fa1dcc5969 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -162,14 +162,8 @@ void sysv_set_inode(struct inode *inode, dev_t rdev)
 		inode->i_fop = &sysv_dir_operations;
 		inode->i_mapping->a_ops = &sysv_aops;
 	} else if (S_ISLNK(inode->i_mode)) {
-		if (inode->i_blocks) {
-			inode->i_op = &sysv_symlink_inode_operations;
-			inode->i_mapping->a_ops = &sysv_aops;
-		} else {
-			inode->i_op = &sysv_fast_symlink_inode_operations;
-			nd_terminate_link(SYSV_I(inode)->i_data, inode->i_size,
-				sizeof(SYSV_I(inode)->i_data) - 1);
-		}
+		inode->i_op = &sysv_symlink_inode_operations;
+		inode->i_mapping->a_ops = &sysv_aops;
 	} else
 		init_special_inode(inode, inode->i_mode, rdev);
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 070/126] vfs: Make sendfile(2) killable even better
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 069/126] fix sysvfs symlinks Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 071/126] vfs: Avoid softlockups with sendfile(2) Luis Henriques
                   ` (55 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Kara, Al Viro, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit c725bfce7968009756ed2836a8cd7ba4dc163011 upstream.

Commit 296291cdd162 (mm: make sendfile(2) killable) fixed an issue where
sendfile(2) was doing a lot of tiny writes into a filesystem and thus
was unkillable for a long time. However sendfile(2) can be (mis)used to
issue lots of writes into arbitrary file descriptor such as evenfd or
similar special file descriptors which never hit the standard filesystem
write path and thus are still unkillable. E.g. the following example
from Dmitry burns CPU for ~16s on my test system without possibility to
be killed:

        int r1 = eventfd(0, 0);
        int r2 = memfd_create("", 0);
        unsigned long n = 1<<30;
        fallocate(r2, 0, 0, n);
        sendfile(r1, r2, 0, n);

There are actually quite a few tests for pending signals in sendfile
code however we data to write is always available none of them seems to
trigger. So fix the problem by adding a test for pending signal into
splice_from_pipe_next() also before the loop waiting for pipe buffers to
be available. This should fix all the lockup issues with sendfile of the
do-ton-of-tiny-writes nature.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/splice.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/splice.c b/fs/splice.c
index 92acf7074d45..31a66a3278cb 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -806,6 +806,13 @@ static int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_des
  */
 static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc *sd)
 {
+	/*
+	 * Check for signal early to make process killable when there are
+	 * always buffers available
+	 */
+	if (signal_pending(current))
+		return -ERESTARTSYS;
+
 	while (!pipe->nrbufs) {
 		if (!pipe->writers)
 			return 0;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 071/126] vfs: Avoid softlockups with sendfile(2)
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 070/126] vfs: Make sendfile(2) killable even better Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 072/126] nfs4: start callback_ident at idr 1 Luis Henriques
                   ` (54 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Vyukov, Jan Kara, Al Viro, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit c2489e07c0a71a56fb2c84bc0ee66cddfca7d068 upstream.

The following test program from Dmitry can cause softlockups or RCU
stalls as it copies 1GB from tmpfs into eventfd and we don't have any
scheduling point at that path in sendfile(2) implementation:

        int r1 = eventfd(0, 0);
        int r2 = memfd_create("", 0);
        unsigned long n = 1<<30;
        fallocate(r2, 0, 0, n);
        sendfile(r1, r2, 0, n);

Add cond_resched() into __splice_from_pipe() to fix the problem.

CC: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/splice.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/splice.c b/fs/splice.c
index 31a66a3278cb..28f8d9dd92e3 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -888,6 +888,7 @@ ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, struct splice_desc *sd,
 
 	splice_from_pipe_begin(sd);
 	do {
+		cond_resched();
 		ret = splice_from_pipe_next(pipe, sd);
 		if (ret > 0)
 			ret = splice_from_pipe_feed(pipe, sd, actor);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 072/126] nfs4: start callback_ident at idr 1
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 071/126] vfs: Avoid softlockups with sendfile(2) Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 073/126] ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3 Luis Henriques
                   ` (53 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Coddington, Trond Myklebust, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Benjamin Coddington <bcodding@redhat.com>

commit c68a027c05709330fe5b2f50c50d5fa02124b5d8 upstream.

If clp->cl_cb_ident is zero, then nfs_cb_idr_remove_locked() skips removing
it when the nfs_client is freed.  A decoding or server bug can then find
and try to put that first nfs_client which would lead to a crash.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Fixes: d6870312659d ("nfs4client: convert to idr_alloc()")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfs/nfs4client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index af02bf6a418f..1b171b81e7db 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -33,7 +33,7 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)
 		return ret;
 	idr_preload(GFP_KERNEL);
 	spin_lock(&nn->nfs_client_lock);
-	ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT);
+	ret = idr_alloc(&nn->cb_ident_idr, clp, 1, 0, GFP_NOWAIT);
 	if (ret >= 0)
 		clp->cl_cb_ident = ret;
 	spin_unlock(&nn->nfs_client_lock);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 073/126] ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 072/126] nfs4: start callback_ident at idr 1 Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 074/126] arm64: KVM: Fix AArch32 to AArch64 register mapping Luis Henriques
                   ` (52 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kailang Yang, Hui Wang, Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hui Wang <hui.wang@canonical.com>

commit 8c69729b4439bbda88c3073df7243f755cc418ed upstream.

We have a machine Dell XPS 13 with the codec alc256, after resume back
from S3, the headphone has noise when play sound.

Through comparing with the coeff vaule before and after S3, we found
restoring a coeff register will help remove noise.

BugLink: https://bugs.launchpad.net/bugs/1519168
Cc: Kailang Yang <kailang@realtek.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e78193d905d9..379ece8c3afc 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4318,6 +4318,7 @@ enum {
 	ALC292_FIXUP_TPT440_DOCK,
 	ALC292_FIXUP_TPT440_DOCK2,
 	ALC275_FIXUP_DELL_XPS,
+	ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -4781,6 +4782,17 @@ static const struct hda_fixup alc269_fixups[] = {
 			{}
 		}
 	},
+	[ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
+		.type = HDA_FIXUP_VERBS,
+		.v.verbs = (const struct hda_verb[]) {
+			/* Disable pass-through path for FRONT 14h */
+			{0x20, AC_VERB_SET_COEF_INDEX, 0x36},
+			{0x20, AC_VERB_SET_PROC_COEF, 0x1737},
+			{}
+		},
+		.chained = true,
+		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4845,6 +4857,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+	SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 074/126] arm64: KVM: Fix AArch32 to AArch64 register mapping
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 073/126] ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3 Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 075/126] drm/radeon: make rv770_set_sw_state failures non-fatal Luis Henriques
                   ` (51 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marc Zyngier, Christoffer Dall, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marc Zyngier <marc.zyngier@arm.com>

commit c0f0963464c24e034b858441205455bf2a5d93ad upstream.

When running a 32bit guest under a 64bit hypervisor, the ARMv8
architecture defines a mapping of the 32bit registers in the 64bit
space. This includes banked registers that are being demultiplexed
over the 64bit ones.

On exceptions caused by an operation involving a 32bit register, the
HW exposes the register number in the ESR_EL2 register. It was so
far understood that SW had to distinguish between AArch32 and AArch64
accesses (based on the current AArch32 mode and register number).

It turns out that I misinterpreted the ARM ARM, and the clue is in
D1.20.1: "For some exceptions, the exception syndrome given in the
ESR_ELx identifies one or more register numbers from the issued
instruction that generated the exception. Where the exception is
taken from an Exception level using AArch32 these register numbers
give the AArch64 view of the register."

Which means that the HW is already giving us the translated version,
and that we shouldn't try to interpret it at all (for example, doing
an MMIO operation from the IRQ mode using the LR register leads to
very unexpected behaviours).

The fix is thus not to perform a call to vcpu_reg32() at all from
vcpu_reg(), and use whatever register number is supplied directly.
The only case we need to find out about the mapping is when we
actively generate a register access, which only occurs when injecting
a fault in a guest.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/include/asm/kvm_emulate.h | 8 +++++---
 arch/arm64/kvm/inject_fault.c        | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 91f33c2051f2..eeab71a884cb 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -86,11 +86,13 @@ static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
 	*vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;
 }
 
+/*
+ * vcpu_reg should always be passed a register number coming from a
+ * read of ESR_EL2. Otherwise, it may give the wrong result on AArch32
+ * with banked registers.
+ */
 static inline unsigned long *vcpu_reg(const struct kvm_vcpu *vcpu, u8 reg_num)
 {
-	if (vcpu_mode_is_32bit(vcpu))
-		return vcpu_reg32(vcpu, reg_num);
-
 	return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num];
 }
 
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index 86825f8883de..f527a37ac979 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -48,7 +48,7 @@ static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
 
 	/* Note: These now point to the banked copies */
 	*vcpu_spsr(vcpu) = new_spsr_value;
-	*vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
+	*vcpu_reg32(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
 
 	/* Branch to exception vector */
 	if (sctlr & (1 << 13))

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 075/126] drm/radeon: make rv770_set_sw_state failures non-fatal
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 074/126] arm64: KVM: Fix AArch32 to AArch64 register mapping Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 076/126] ALSA: hda - Fix noise on Gigabyte Z170X mobo Luis Henriques
                   ` (50 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 4e7697ed79d0c0d5f869c87a6b3ce3d5cd1a07d6 upstream.

On some cards it takes a relatively long time for the change
to take place.  Make a timeout non-fatal.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76130

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/rv770_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index 3c76e1dcdf04..56536daaa927 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -1415,7 +1415,7 @@ int rv770_resume_smc(struct radeon_device *rdev)
 int rv770_set_sw_state(struct radeon_device *rdev)
 {
 	if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToSwState) != PPSMC_Result_OK)
-		return -EINVAL;
+		DRM_ERROR("rv770_set_sw_state failed\n");
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 076/126] ALSA: hda - Fix noise on Gigabyte Z170X mobo
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 075/126] drm/radeon: make rv770_set_sw_state failures non-fatal Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 077/126] drm/radeon: make some dpm errors debug only Luis Henriques
                   ` (49 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 0c25ad80408e95e0a4fbaf0056950206e95f726f upstream.

Gigabyte Z710X mobo with ALC1150 codec gets significant noises from
the analog loopback routes even if their inputs are all muted.
Simply kill the aamix for fixing it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=108301
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 379ece8c3afc..a9bbfefb9d4a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1848,6 +1848,7 @@ enum {
 	ALC882_FIXUP_NO_PRIMARY_HP,
 	ALC887_FIXUP_ASUS_BASS,
 	ALC887_FIXUP_BASS_CHMAP,
+	ALC882_FIXUP_DISABLE_AAMIX,
 };
 
 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2009,6 +2010,8 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
 
 static void alc_fixup_bass_chmap(struct hda_codec *codec,
 				 const struct hda_fixup *fix, int action);
+static void alc_fixup_disable_aamix(struct hda_codec *codec,
+				    const struct hda_fixup *fix, int action);
 
 static const struct hda_fixup alc882_fixups[] = {
 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
@@ -2240,6 +2243,10 @@ static const struct hda_fixup alc882_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_bass_chmap,
 	},
+	[ALC882_FIXUP_DISABLE_AAMIX] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc_fixup_disable_aamix,
+	},
 };
 
 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2307,6 +2314,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+	SND_PCI_QUIRK(0x1458, 0xa182, "Gigabyte Z170X-UD3", ALC882_FIXUP_DISABLE_AAMIX),
 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 077/126] drm/radeon: make some dpm errors debug only
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 076/126] ALSA: hda - Fix noise on Gigabyte Z170X mobo Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 078/126] nfs: if we have no valid attrs, then don't declare the attribute cache valid Luis Henriques
                   ` (48 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 9c565e3386fdc804a61f8c116efc2c5999ba46e1 upstream.

"Could not force DPM to low", etc. is usually harmless and
just confuses users.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/rv730_dpm.c | 2 +-
 drivers/gpu/drm/radeon/rv770_dpm.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/rv730_dpm.c b/drivers/gpu/drm/radeon/rv730_dpm.c
index 3f5e1cf138ba..d37ba2cb886e 100644
--- a/drivers/gpu/drm/radeon/rv730_dpm.c
+++ b/drivers/gpu/drm/radeon/rv730_dpm.c
@@ -464,7 +464,7 @@ void rv730_stop_dpm(struct radeon_device *rdev)
 	result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
 
 	if (result != PPSMC_Result_OK)
-		DRM_ERROR("Could not force DPM to low\n");
+		DRM_DEBUG("Could not force DPM to low\n");
 
 	WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
 
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index 56536daaa927..a707b2d0b239 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -192,7 +192,7 @@ void rv770_stop_dpm(struct radeon_device *rdev)
 	result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_TwoLevelsDisabled);
 
 	if (result != PPSMC_Result_OK)
-		DRM_ERROR("Could not force DPM to low.\n");
+		DRM_DEBUG("Could not force DPM to low.\n");
 
 	WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN);
 
@@ -1415,7 +1415,7 @@ int rv770_resume_smc(struct radeon_device *rdev)
 int rv770_set_sw_state(struct radeon_device *rdev)
 {
 	if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToSwState) != PPSMC_Result_OK)
-		DRM_ERROR("rv770_set_sw_state failed\n");
+		DRM_DEBUG("rv770_set_sw_state failed\n");
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 078/126] nfs: if we have no valid attrs, then don't declare the attribute cache valid
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 077/126] drm/radeon: make some dpm errors debug only Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 079/126] xen/gntdev: Grant maps should not be subject to NUMA balancing Luis Henriques
                   ` (47 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jeff Layton, Trond Myklebust, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jeff Layton <jlayton@poochiereds.net>

commit c812012f9ca7cf89c9e1a1cd512e6c3b5be04b85 upstream.

If we pass in an empty nfs_fattr struct to nfs_update_inode, it will
(correctly) not update any of the attributes, but it then clears the
NFS_INO_INVALID_ATTR flag, which indicates that the attributes are
up to date. Don't clear the flag if the fattr struct has no valid
attrs to apply.

Reviewed-by: Steve French <steve.french@primarydata.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index fa8d1b632d49..3a8c1a7d5bc6 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1704,7 +1704,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			nfsi->attrtimeo_timestamp = now;
 		}
 	}
-	invalid &= ~NFS_INO_INVALID_ATTR;
+
+	/* Don't declare attrcache up to date if there were no attrs! */
+	if (fattr->valid != 0)
+		invalid &= ~NFS_INO_INVALID_ATTR;
+
 	/* Don't invalidate the data if we were to blame */
 	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
 				|| S_ISLNK(inode->i_mode)))

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 079/126] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 078/126] nfs: if we have no valid attrs, then don't declare the attribute cache valid Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 080/126] iscsi-target: Fix rx_login_comp hang after login failure Luis Henriques
                   ` (46 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Boris Ostrovsky, David Vrabel, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

commit 9c17d96500f78d7ecdb71ca6942830158bc75a2b upstream.

Doing so will cause the grant to be unmapped and then, during
fault handling, the fault to be mistakenly treated as NUMA hint
fault.

In addition, even if those maps could partcipate in NUMA
balancing, it wouldn't provide any benefit since we are unable
to determine physical page's node (even if/when VNUMA is
implemented).

Marking grant maps' VMAs as VM_IO will exclude them from being
part of NUMA balancing.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/xen/gntdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 91cc44611062..7ffbb9390628 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -765,7 +765,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 
 	vma->vm_ops = &gntdev_vmops;
 
-	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
 
 	if (use_ptemod)
 		vma->vm_flags |= VM_DONTCOPY;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 080/126] iscsi-target: Fix rx_login_comp hang after login failure
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 079/126] xen/gntdev: Grant maps should not be subject to NUMA balancing Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 081/126] target: Fix race for SCF_COMPARE_AND_WRITE_POST checking Luis Henriques
                   ` (45 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Nicholas Bellinger, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit ca82c2bded29b38d36140bfa1e76a7bbfcade390 upstream.

This patch addresses a case where iscsi_target_do_tx_login_io()
fails sending the last login response PDU, after the RX/TX
threads have already been started.

The case centers around iscsi_target_rx_thread() not invoking
allow_signal(SIGINT) before the send_sig(SIGINT, ...) occurs
from the failure path, resulting in RX thread hanging
indefinately on iscsi_conn->rx_login_comp.

Note this bug is a regression introduced by:

  commit e54198657b65625085834847ab6271087323ffea
  Author: Nicholas Bellinger <nab@linux-iscsi.org>
  Date:   Wed Jul 22 23:14:19 2015 -0700

      iscsi-target: Fix iscsit_start_kthreads failure OOPs

To address this bug, complete ->rx_login_complete for good
measure in the failure path, and immediately return from
RX thread context if connection state did not actually reach
full feature phase (TARG_CONN_STATE_LOGGED_IN).

Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c      | 13 ++++++++++++-
 drivers/target/iscsi/iscsi_target_nego.c |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 9f299c7fe73f..00b801df7322 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4054,6 +4054,17 @@ reject:
 	return iscsit_add_reject(conn, ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
 }
 
+static bool iscsi_target_check_conn_state(struct iscsi_conn *conn)
+{
+	bool ret;
+
+	spin_lock_bh(&conn->state_lock);
+	ret = (conn->conn_state != TARG_CONN_STATE_LOGGED_IN);
+	spin_unlock_bh(&conn->state_lock);
+
+	return ret;
+}
+
 int iscsi_target_rx_thread(void *arg)
 {
 	int ret, rc;
@@ -4071,7 +4082,7 @@ int iscsi_target_rx_thread(void *arg)
 	 * incoming iscsi/tcp socket I/O, and/or failing the connection.
 	 */
 	rc = wait_for_completion_interruptible(&conn->rx_login_comp);
-	if (rc < 0)
+	if (rc < 0 || iscsi_target_check_conn_state(conn))
 		return 0;
 
 	if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 092112e5e1a6..dcb63481325f 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -393,6 +393,7 @@ err:
 	if (login->login_complete) {
 		if (conn->rx_thread && conn->rx_thread_active) {
 			send_sig(SIGINT, conn->rx_thread, 1);
+			complete(&conn->rx_login_comp);
 			kthread_stop(conn->rx_thread);
 		}
 		if (conn->tx_thread && conn->tx_thread_active) {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 081/126] target: Fix race for SCF_COMPARE_AND_WRITE_POST checking
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 080/126] iscsi-target: Fix rx_login_comp hang after login failure Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 082/126] target: fix COMPARE_AND_WRITE non zero SGL offset data corruption Luis Henriques
                   ` (44 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sagi Grimberg, Nicholas Bellinger, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 057085e522f8bf94c2e691a5b76880f68060f8ba upstream.

This patch addresses a race + use after free where the first
stage of COMPARE_AND_WRITE in compare_and_write_callback()
is rescheduled after the backend sends the secondary WRITE,
resulting in second stage compare_and_write_post() callback
completing in target_complete_ok_work() before the first
can return.

Because current code depends on checking se_cmd->se_cmd_flags
after return from se_cmd->transport_complete_callback(),
this results in first stage having SCF_COMPARE_AND_WRITE_POST
set, which incorrectly falls through into second stage CAW
processing code, eventually triggering a NULL pointer
dereference due to use after free.

To address this bug, pass in a new *post_ret parameter into
se_cmd->transport_complete_callback(), and depend upon this
value instead of ->se_cmd_flags to determine when to return
or fall through into ->queue_status() code for CAW.

Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_sbc.c       | 13 +++++++++----
 drivers/target/target_core_transport.c | 14 ++++++++------
 include/target/target_core_base.h      |  2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index be2a1000e3dd..c59afca94080 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -299,7 +299,8 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
 	return 0;
 }
 
-static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success)
+static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success,
+					   int *post_ret)
 {
 	unsigned char *buf, *addr;
 	struct scatterlist *sg;
@@ -363,7 +364,8 @@ sbc_execute_rw(struct se_cmd *cmd)
 			       cmd->data_direction);
 }
 
-static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
+static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success,
+					     int *post_ret)
 {
 	struct se_device *dev = cmd->se_dev;
 
@@ -373,8 +375,10 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
 	 * sent to the backend driver.
 	 */
 	spin_lock_irq(&cmd->t_state_lock);
-	if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status)
+	if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status) {
 		cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST;
+		*post_ret = 1;
+	}
 	spin_unlock_irq(&cmd->t_state_lock);
 
 	/*
@@ -386,7 +390,8 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
 	return TCM_NO_SENSE;
 }
 
-static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success)
+static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success,
+						 int *post_ret)
 {
 	struct se_device *dev = cmd->se_dev;
 	struct scatterlist *write_sg = NULL, *sg;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index b32cbb8ab5b8..9eeeb78bf604 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1594,7 +1594,7 @@ bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags)
 void transport_generic_request_failure(struct se_cmd *cmd,
 		sense_reason_t sense_reason)
 {
-	int ret = 0;
+	int ret = 0, post_ret = 0;
 
 	pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x"
 		" CDB: 0x%02x\n", cmd, cmd->se_tfo->get_task_tag(cmd),
@@ -1617,7 +1617,7 @@ void transport_generic_request_failure(struct se_cmd *cmd,
 	 */
 	if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
 	     cmd->transport_complete_callback)
-		cmd->transport_complete_callback(cmd, false);
+		cmd->transport_complete_callback(cmd, false, &post_ret);
 
 	switch (sense_reason) {
 	case TCM_NON_EXISTENT_LUN:
@@ -1977,11 +1977,13 @@ static void target_complete_ok_work(struct work_struct *work)
 	 */
 	if (cmd->transport_complete_callback) {
 		sense_reason_t rc;
+		bool caw = (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE);
+		bool zero_dl = !(cmd->data_length);
+		int post_ret = 0;
 
-		rc = cmd->transport_complete_callback(cmd, true);
-		if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
-			if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
-			    !cmd->data_length)
+		rc = cmd->transport_complete_callback(cmd, true, &post_ret);
+		if (!rc && !post_ret) {
+			if (caw && zero_dl)
 				goto queue_rsp;
 
 			return;
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index edfd69a25884..0c37d70a4f57 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -518,7 +518,7 @@ struct se_cmd {
 	sense_reason_t		(*execute_cmd)(struct se_cmd *);
 	sense_reason_t		(*execute_rw)(struct se_cmd *, struct scatterlist *,
 					      u32, enum dma_data_direction);
-	sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
+	sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool, int *);
 
 	unsigned char		*t_task_cdb;
 	unsigned char		__t_task_cdb[TCM_MAX_COMMAND_SIZE];

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 082/126] target: fix COMPARE_AND_WRITE non zero SGL offset data corruption
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 081/126] target: Fix race for SCF_COMPARE_AND_WRITE_POST checking Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 083/126] ARM: dts: Kirkwood: Fix QNAP TS219 power-off Luis Henriques
                   ` (43 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Engelhardt, Nicholas Bellinger, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Engelhardt <jengelh@inai.de>

commit d94e5a61357a04938ce14d6033b4d33a3c5fd780 upstream.

target_core_sbc's compare_and_write functionality suffers from taking
data at the wrong memory location when writing a CAW request to disk
when a SGL offset is non-zero.

This can happen with loopback and vhost-scsi fabric drivers when
SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC is used to map existing user-space
SGL memory into COMPARE_AND_WRITE READ/WRITE payload buffers.

Given the following sample LIO subtopology,

% targetcli ls /loopback/
o- loopback ................................. [1 Target]
  o- naa.6001405ebb8df14a ....... [naa.60014059143ed2b3]
    o- luns ................................... [2 LUNs]
      o- lun0 ................ [iblock/ram0 (/dev/ram0)]
      o- lun1 ................ [iblock/ram1 (/dev/ram1)]
% lsscsi -g
[3:0:1:0]    disk    LIO-ORG  IBLOCK           4.0   /dev/sdc   /dev/sg3
[3:0:1:1]    disk    LIO-ORG  IBLOCK           4.0   /dev/sdd   /dev/sg4

the following bug can be observed in Linux 4.3 and 4.4~rc1:

% perl -e 'print chr$_ for 0..255,reverse 0..255' >rand
% perl -e 'print "\0" x 512' >zero
% cat rand >/dev/sdd
% sg_compare_and_write -i rand -D zero --lba 0 /dev/sdd
% sg_compare_and_write -i zero -D rand --lba 0 /dev/sdd
Miscompare reported
% hexdump -Cn 512 /dev/sdd
00000000  0f 0e 0d 0c 0b 0a 09 08  07 06 05 04 03 02 01 00
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
*
00000200

Rather than writing all-zeroes as instructed with the -D file, it
corrupts the data in the sector by splicing some of the original
bytes in. The page of the first entry of cmd->t_data_sg includes the
CDB, and sg->offset is set to a position past the CDB. I presume that
sg->offset is also the right choice to use for subsequent sglist
members.

Signed-off-by: Jan Engelhardt <jengelh@netitwork.de>
Tested-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/target/target_core_sbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index c59afca94080..f4865901263f 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -487,11 +487,11 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes
 
 		if (block_size < PAGE_SIZE) {
 			sg_set_page(&write_sg[i], m.page, block_size,
-				    block_size);
+				    m.piter.sg->offset + block_size);
 		} else {
 			sg_miter_next(&m);
 			sg_set_page(&write_sg[i], m.page, block_size,
-				    0);
+				    m.piter.sg->offset);
 		}
 		len -= block_size;
 		i++;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 083/126] ARM: dts: Kirkwood: Fix QNAP TS219 power-off
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 082/126] target: fix COMPARE_AND_WRITE non zero SGL offset data corruption Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 084/126] netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse Luis Henriques
                   ` (42 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Helmut Klein, Andrew Lunn, Gregory CLEMENT, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Helmut Klein <hgkr.klein@gmail.com>

commit 5442f0eadf2885453d5b2ed8c8592f32a3744f8e upstream.

The "reg" entry in the "poweroff" section of "kirkwood-ts219.dtsi"
addressed the wrong uart (0 = console). This patch changes the address
to select uart 1, which is the uart connected to the pic
microcontroller, which can switch the device off.

Signed-off-by: Helmut Klein <hgkr.klein@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 4350a47bbac3 ("ARM: Kirkwood: Make use of the QNAP Power off driver.")
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/kirkwood-ts219.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
index df7f15276575..8e15b36c1beb 100644
--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -40,7 +40,7 @@
 		};
 		poweroff@12100 {
 			compatible = "qnap,power-off";
-			reg = <0x12000 0x100>;
+			reg = <0x12100 0x100>;
 			clocks = <&gate_clk 7>;
 		};
 		spi@10600 {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 084/126] netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 083/126] ARM: dts: Kirkwood: Fix QNAP TS219 power-off Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 085/126] netfilter: nf_tables: fix bogus warning in nft_data_uninit() Luis Henriques
                   ` (41 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Xin Long, Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: lucien <lucien.xin@gmail.com>

commit cc4998febd567d1c671684abce5595344bd4e8b2 upstream.

--accept-local  option works for res.type == RTN_LOCAL, which should be
from the local table, but there, the fib_info's nh->nh_scope =
RT_SCOPE_NOWHERE ( > RT_SCOPE_HOST). in fib_create_info().

	if (cfg->fc_scope == RT_SCOPE_HOST) {
		struct fib_nh *nh = fi->fib_nh;

		/* Local address is added. */
		if (nhs != 1 || nh->nh_gw)
			goto err_inval;
		nh->nh_scope = RT_SCOPE_NOWHERE;   <===
		nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif);
		err = -ENODEV;
		if (!nh->nh_dev)
			goto failure;

but in our rpfilter_lookup_reverse():

	if (dev_match || flags & XT_RPFILTER_LOOSE)
		return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;

if nh->nh_scope > RT_SCOPE_HOST, it will fail. --accept-local option
will never be passed.

it seems the test is bogus and can be removed to fix this issue.

	if (dev_match || flags & XT_RPFILTER_LOOSE)
		return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;

ipv6 does not have this issue.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/netfilter/ipt_rpfilter.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c
index 4bfaedf9b34e..60f27b1e46f6 100644
--- a/net/ipv4/netfilter/ipt_rpfilter.c
+++ b/net/ipv4/netfilter/ipt_rpfilter.c
@@ -61,9 +61,7 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4,
 	if (FIB_RES_DEV(res) == dev)
 		dev_match = true;
 #endif
-	if (dev_match || flags & XT_RPFILTER_LOOSE)
-		return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
-	return dev_match;
+	return dev_match || flags & XT_RPFILTER_LOOSE;
 }
 
 static bool rpfilter_is_local(const struct sk_buff *skb)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 085/126] netfilter: nf_tables: fix bogus warning in nft_data_uninit()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 084/126] netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 086/126] netfilter: ip6t_SYNPROXY: fix NULL pointer dereference Luis Henriques
                   ` (40 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mirek Kratochvil, Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mirek Kratochvil <exa.exa@gmail.com>

commit 960bd2c26421d321e890f1936938196ead41976f upstream.

The values 0x00000000-0xfffffeff are reserved for userspace datatype. When,
deleting set elements with maps, a bogus warning is triggered.

WARNING: CPU: 0 PID: 11133 at net/netfilter/nf_tables_api.c:4481 nft_data_uninit+0x35/0x40 [nf_tables]()

This fixes the check accordingly to enum definition in
include/linux/netfilter/nf_tables.h

Fixes: https://bugzilla.netfilter.org/show_bug.cgi?id=1013
Signed-off-by: Mirek Kratochvil <exa.exa@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 7b049cb56825..3ea4109486ce 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -3956,9 +3956,9 @@ EXPORT_SYMBOL_GPL(nft_data_init);
  */
 void nft_data_uninit(const struct nft_data *data, enum nft_data_types type)
 {
-	switch (type) {
-	case NFT_DATA_VALUE:
+	if (type < NFT_DATA_VERDICT)
 		return;
+	switch (type) {
 	case NFT_DATA_VERDICT:
 		return nft_verdict_uninit(data);
 	default:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 086/126] netfilter: ip6t_SYNPROXY: fix NULL pointer dereference
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 085/126] netfilter: nf_tables: fix bogus warning in nft_data_uninit() Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 087/126] RDS: fix race condition when sending a message on unbound socket Luis Henriques
                   ` (39 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Sutter, Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Phil Sutter <phil@nwl.cc>

commit 96fffb4f23f124f297d51dedc9cf51d19eb88ee1 upstream.

This happens when networking namespaces are enabled.

Suggested-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/netfilter/ip6t_SYNPROXY.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c
index a0d17270117c..bd174540eb21 100644
--- a/net/ipv6/netfilter/ip6t_SYNPROXY.c
+++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c
@@ -37,12 +37,13 @@ synproxy_build_ip(struct sk_buff *skb, const struct in6_addr *saddr,
 }
 
 static void
-synproxy_send_tcp(const struct sk_buff *skb, struct sk_buff *nskb,
+synproxy_send_tcp(const struct synproxy_net *snet,
+		  const struct sk_buff *skb, struct sk_buff *nskb,
 		  struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
 		  struct ipv6hdr *niph, struct tcphdr *nth,
 		  unsigned int tcp_hdr_size)
 {
-	struct net *net = nf_ct_net((struct nf_conn *)nfct);
+	struct net *net = nf_ct_net(snet->tmpl);
 	struct dst_entry *dst;
 	struct flowi6 fl6;
 
@@ -83,7 +84,8 @@ free_nskb:
 }
 
 static void
-synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th,
+synproxy_send_client_synack(const struct synproxy_net *snet,
+			    const struct sk_buff *skb, const struct tcphdr *th,
 			    const struct synproxy_options *opts)
 {
 	struct sk_buff *nskb;
@@ -119,7 +121,7 @@ synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th,
 
 	synproxy_build_options(nth, opts);
 
-	synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
+	synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
 			  niph, nth, tcp_hdr_size);
 }
 
@@ -163,7 +165,7 @@ synproxy_send_server_syn(const struct synproxy_net *snet,
 
 	synproxy_build_options(nth, opts);
 
-	synproxy_send_tcp(skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
+	synproxy_send_tcp(snet, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
 			  niph, nth, tcp_hdr_size);
 }
 
@@ -203,7 +205,7 @@ synproxy_send_server_ack(const struct synproxy_net *snet,
 
 	synproxy_build_options(nth, opts);
 
-	synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
+	synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
 }
 
 static void
@@ -241,7 +243,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet,
 
 	synproxy_build_options(nth, opts);
 
-	synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
+	synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
 }
 
 static bool
@@ -301,7 +303,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 					  XT_SYNPROXY_OPT_SACK_PERM |
 					  XT_SYNPROXY_OPT_ECN);
 
-		synproxy_send_client_synack(skb, th, &opts);
+		synproxy_send_client_synack(snet, skb, th, &opts);
 		return NF_DROP;
 
 	} else if (th->ack && !(th->fin || th->rst || th->syn)) {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 087/126] RDS: fix race condition when sending a message on unbound socket
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 086/126] netfilter: ip6t_SYNPROXY: fix NULL pointer dereference Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 088/126] gre6: allow to update all parameters via rtnl Luis Henriques
                   ` (38 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David S. Miller, Quentin Casasnovas, Moritz Muehlenhoff,
	Kamal Mostafa, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Quentin Casasnovas <quentin.casasnovas@oracle.com>

commit 8c7188b23474cca017b3ef354c4a58456f68303a upstream.

Sasha's found a NULL pointer dereference in the RDS connection code when
sending a message to an apparently unbound socket.  The problem is caused
by the code checking if the socket is bound in rds_sendmsg(), which checks
the rs_bound_addr field without taking a lock on the socket.  This opens a
race where rs_bound_addr is temporarily set but where the transport is not
in rds_bind(), leading to a NULL pointer dereference when trying to
dereference 'trans' in __rds_conn_create().

Vegard wrote a reproducer for this issue, so kindly ask him to share if
you're interested.

I cannot reproduce the NULL pointer dereference using Vegard's reproducer
with this patch, whereas I could without.

Complete earlier incomplete fix to CVE-2015-6937:

  74e98eb08588 ("RDS: verify the underlying transport exists before creating a connection")

Cc: David S. Miller <davem@davemloft.net>
Reviewed-by: Vegard Nossum <vegard.nossum@oracle.com>
Reviewed-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Moritz Muehlenhoff <jmm@inutil.org>
Cc: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/rds/connection.c | 6 ------
 net/rds/send.c       | 4 +++-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/net/rds/connection.c b/net/rds/connection.c
index f5fb7d6b7c41..378c3a6acf84 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -183,12 +183,6 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,
 		}
 	}
 
-	if (trans == NULL) {
-		kmem_cache_free(rds_conn_slab, conn);
-		conn = ERR_PTR(-ENODEV);
-		goto out;
-	}
-
 	conn->c_trans = trans;
 
 	ret = trans->conn_alloc(conn, gfp);
diff --git a/net/rds/send.c b/net/rds/send.c
index 23718160d71e..dfca46865d2e 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -955,11 +955,13 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
 		release_sock(sk);
 	}
 
-	/* racing with another thread binding seems ok here */
+	lock_sock(sk);
 	if (daddr == 0 || rs->rs_bound_addr == 0) {
+		release_sock(sk);
 		ret = -ENOTCONN; /* XXX not a great errno */
 		goto out;
 	}
+	release_sock(sk);
 
 	/* size of rm including all sgs */
 	ret = rds_rm_size(msg, payload_len);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 088/126] gre6: allow to update all parameters via rtnl
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 087/126] RDS: fix race condition when sending a message on unbound socket Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 089/126] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation Luis Henriques
                   ` (37 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Dichtel, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>

commit 6a61d4dbf4f54b5683e0f1e58d873cecca7cb977 upstream.

Parameters were updated only if the kernel was unable to find the tunnel
with the new parameters, ie only if core pamareters were updated (keys,
addr, link, type).
Now it's possible to update ttl, hoplimit, flowinfo and flags.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ip6_gre.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index f5ea5aaf75f9..1ee013644bb2 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1553,13 +1553,11 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
 			return -EEXIST;
 	} else {
 		t = nt;
-
-		ip6gre_tunnel_unlink(ign, t);
-		ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]);
-		ip6gre_tunnel_link(ign, t);
-		netdev_state_change(dev);
 	}
 
+	ip6gre_tunnel_unlink(ign, t);
+	ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]);
+	ip6gre_tunnel_link(ign, t);
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 089/126] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 088/126] gre6: allow to update all parameters via rtnl Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 090/126] sctp: use the same clock as if sock source timestamps were on Luis Henriques
                   ` (36 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pavel Machek, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pavel Machek <pavel@ucw.cz>

commit f2a3771ae8aca879c32336c76ad05a017629bae2 upstream.

atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks  networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.

atl1c_setup_ring_resources() is called from .open() function, and
already uses GFP_KERNEL, so this change is safe.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index e11bf18fbbd1..50c705fed154 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1014,13 +1014,12 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
 		sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
 		8 * 4;
 
-	ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
-				&ring_header->dma);
+	ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size,
+						&ring_header->dma, GFP_KERNEL);
 	if (unlikely(!ring_header->desc)) {
-		dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+		dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
 		goto err_nomem;
 	}
-	memset(ring_header->desc, 0, ring_header->size);
 	/* init TPD ring */
 
 	tpd_ring[0].dma = roundup(ring_header->dma, 8);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 090/126] sctp: use the same clock as if sock source timestamps were on
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 089/126] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation Luis Henriques
@ 2016-01-06 10:36 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 091/126] sctp: update the netstamp_needed counter when copying sockets Luis Henriques
                   ` (35 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcelo Ricardo Leitner, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

commit cb5e173ed7c03a0d4630ce68a95a186cce3cc872 upstream.

SCTP echoes a cookie o INIT ACK chunks that contains a timestamp, for
detecting stale cookies. This cookie is echoed back to the server by the
client and then that timestamp is checked.

Thing is, if the listening socket is using packet timestamping, the
cookie is encoded with ktime_get() value and checked against
ktime_get_real(), as done by __net_timestamp().

The fix is to sctp also use ktime_get_real(), so we can compare bananas
with bananas later no matter if packet timestamping was enabled or not.

Fixes: 52db882f3fc2 ("net: sctp: migrate cookie life from timeval to ktime")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sctp/sm_make_chunk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 371a152d9759..642c11570285 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1652,7 +1652,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
 
 	/* Set an expiration time for the cookie.  */
 	cookie->c.expiration = ktime_add(asoc->cookie_life,
-					 ktime_get());
+					 ktime_get_real());
 
 	/* Copy the peer's init packet.  */
 	memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr,
@@ -1780,7 +1780,7 @@ no_hmac:
 	if (sock_flag(ep->base.sk, SOCK_TIMESTAMP))
 		kt = skb_get_ktime(skb);
 	else
-		kt = ktime_get();
+		kt = ktime_get_real();
 
 	if (!asoc && ktime_before(bear_cookie->expiration, kt)) {
 		/*

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 091/126] sctp: update the netstamp_needed counter when copying sockets
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2016-01-06 10:36 ` [PATCH 3.16.y-ckt 090/126] sctp: use the same clock as if sock source timestamps were on Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 092/126] ipv6: sctp: clone options to avoid use after free Luis Henriques
                   ` (34 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcelo Ricardo Leitner, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

commit 01ce63c90170283a9855d1db4fe81934dddce648 upstream.

Dmitry Vyukov reported that SCTP was triggering a WARN on socket destroy
related to disabling sock timestamp.

When SCTP accepts an association or peel one off, it copies sock flags
but forgot to call net_enable_timestamp() if a packet timestamping flag
was copied, leading to extra calls to net_disable_timestamp() whenever
such clones were closed.

The fix is to call net_enable_timestamp() whenever we copy a sock with
that flag on, like tcp does.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/sock.h | 2 ++
 net/core/sock.c    | 2 --
 net/sctp/socket.c  | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 9c24377a7bc9..d4a6b45f337f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -702,6 +702,8 @@ enum sock_flags {
 	SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
 };
 
+#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
+
 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
 {
 	nsk->sk_flags = osk->sk_flags;
diff --git a/net/core/sock.c b/net/core/sock.c
index 9956e854d0e6..ac9aa2878d99 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -422,8 +422,6 @@ static void sock_warn_obsolete_bsdism(const char *name)
 	}
 }
 
-#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
-
 static void sock_disable_timestamp(struct sock *sk, unsigned long flags)
 {
 	if (sk->sk_flags & flags) {
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a8fd2f57af97..e58140abe17e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6999,6 +6999,9 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 	newinet->mc_ttl = 1;
 	newinet->mc_index = 0;
 	newinet->mc_list = NULL;
+
+	if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
+		net_enable_timestamp();
 }
 
 static inline void sctp_copy_descendant(struct sock *sk_to,

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 092/126] ipv6: sctp: clone options to avoid use after free
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 091/126] sctp: update the netstamp_needed counter when copying sockets Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 093/126] net: add validation for the socket syscall protocol argument Luis Henriques
                   ` (33 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 9470e24f35ab81574da54e69df90c1eb4a96b43f upstream.

SCTP is lacking proper np->opt cloning at accept() time.

TCP and DCCP use ipv6_dup_options() helper, do the same
in SCTP.

We might later factorize this code in a common helper to avoid
future mistakes.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sctp/ipv6.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 1999592ba88c..06a0fcc00b2e 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -638,6 +638,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
 	struct sock *newsk;
 	struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
 	struct sctp6_sock *newsctp6sk;
+	struct ipv6_txoptions *opt;
 
 	newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot);
 	if (!newsk)
@@ -657,6 +658,13 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
 
 	memcpy(newnp, np, sizeof(struct ipv6_pinfo));
 
+	rcu_read_lock();
+	opt = rcu_dereference(np->opt);
+	if (opt)
+		opt = ipv6_dup_options(newsk, opt);
+	RCU_INIT_POINTER(newnp->opt, opt);
+	rcu_read_unlock();
+
 	/* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname()
 	 * and getpeername().
 	 */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 093/126] net: add validation for the socket syscall protocol argument
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 092/126] ipv6: sctp: clone options to avoid use after free Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 094/126] sh_eth: fix kernel oops in skb_put() Luis Henriques
                   ` (32 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cong Wang, Hannes Frederic Sowa, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hannes Frederic Sowa <hannes@stressinduktion.org>

commit 79462ad02e861803b3840cc782248c7359451cd9 upstream.

郭永刚 reported that one could simply crash the kernel as root by
using a simple program:

	int socket_fd;
	struct sockaddr_in addr;
	addr.sin_port = 0;
	addr.sin_addr.s_addr = INADDR_ANY;
	addr.sin_family = 10;

	socket_fd = socket(10,3,0x40000000);
	connect(socket_fd , &addr,16);

AF_INET, AF_INET6 sockets actually only support 8-bit protocol
identifiers. inet_sock's skc_protocol field thus is sized accordingly,
thus larger protocol identifiers simply cut off the higher bits and
store a zero in the protocol fields.

This could lead to e.g. NULL function pointer because as a result of
the cut off inet_num is zero and we call down to inet_autobind, which
is NULL for raw sockets.

kernel: Call Trace:
kernel:  [<ffffffff816db90e>] ? inet_autobind+0x2e/0x70
kernel:  [<ffffffff816db9a4>] inet_dgram_connect+0x54/0x80
kernel:  [<ffffffff81645069>] SYSC_connect+0xd9/0x110
kernel:  [<ffffffff810ac51b>] ? ptrace_notify+0x5b/0x80
kernel:  [<ffffffff810236d8>] ? syscall_trace_enter_phase2+0x108/0x200
kernel:  [<ffffffff81645e0e>] SyS_connect+0xe/0x10
kernel:  [<ffffffff81779515>] tracesys_phase2+0x84/0x89

I found no particular commit which introduced this problem.

CVE: CVE-2015-8543
Cc: Cong Wang <cwang@twopensource.com>
Reported-by: 郭永刚 <guoyonggang@360.cn>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/sock.h     | 1 +
 net/ax25/af_ax25.c     | 3 +++
 net/decnet/af_decnet.c | 3 +++
 net/ipv4/af_inet.c     | 3 +++
 net/ipv6/af_inet6.c    | 3 +++
 net/irda/af_irda.c     | 3 +++
 6 files changed, 16 insertions(+)

diff --git a/include/net/sock.h b/include/net/sock.h
index d4a6b45f337f..dd06b32abea3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -376,6 +376,7 @@ struct sock {
 				sk_no_check_rx : 1,
 				sk_userlocks : 4,
 				sk_protocol  : 8,
+#define SK_PROTOCOL_MAX U8_MAX
 				sk_type      : 16;
 	kmemcheck_bitfield_end(flags);
 	int			sk_wmem_queued;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c35c3f48fc0f..1428c3ff3341 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -806,6 +806,9 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
 	struct sock *sk;
 	ax25_cb *ax25;
 
+	if (protocol < 0 || protocol > SK_PROTOCOL_MAX)
+		return -EINVAL;
+
 	if (!net_eq(net, &init_net))
 		return -EAFNOSUPPORT;
 
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index ae011b46c071..0d3cc9566f0f 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -677,6 +677,9 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
 {
 	struct sock *sk;
 
+	if (protocol < 0 || protocol > SK_PROTOCOL_MAX)
+		return -EINVAL;
+
 	if (!net_eq(net, &init_net))
 		return -EAFNOSUPPORT;
 
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 6ebb8f6235c9..9da88765e88e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -259,6 +259,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
 	int try_loading_module = 0;
 	int err;
 
+	if (protocol < 0 || protocol >= IPPROTO_MAX)
+		return -EINVAL;
+
 	sock->state = SS_UNCONNECTED;
 
 	/* Look for the requested type/protocol pair. */
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 8966f3ca0d59..8aabacdd5dd7 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -109,6 +109,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
 	int try_loading_module = 0;
 	int err;
 
+	if (protocol < 0 || protocol >= IPPROTO_MAX)
+		return -EINVAL;
+
 	/* Look for the requested type/protocol pair. */
 lookup_protocol:
 	err = -ESOCKTNOSUPPORT;
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 54747c25c86c..f945293c17f0 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1103,6 +1103,9 @@ static int irda_create(struct net *net, struct socket *sock, int protocol,
 
 	IRDA_DEBUG(2, "%s()\n", __func__);
 
+	if (protocol < 0 || protocol > SK_PROTOCOL_MAX)
+		return -EINVAL;
+
 	if (net != &init_net)
 		return -EAFNOSUPPORT;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 094/126] sh_eth: fix kernel oops in skb_put()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 093/126] net: add validation for the socket syscall protocol argument Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 095/126] vlan: Fix untag operations of stacked vlans with REORDER_HEADER off Luis Henriques
                   ` (31 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Shtylyov, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

commit 248be83dcb3feb3f6332eb3d010a016402138484 upstream.

In a low memory situation the following kernel oops occurs:

Unable to handle kernel NULL pointer dereference at virtual address 00000050
pgd = 8490c000
[00000050] *pgd=4651e831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT ARM
Modules linked in:
CPU: 0    Not tainted  (3.4-at16 #9)
PC is at skb_put+0x10/0x98
LR is at sh_eth_poll+0x2c8/0xa10
pc : [<8035f780>]    lr : [<8028bf50>]    psr: 60000113
sp : 84eb1a90  ip : 84eb1ac8  fp : 84eb1ac4
r10: 0000003f  r9 : 000005ea  r8 : 00000000
r7 : 00000000  r6 : 940453b0  r5 : 00030000  r4 : 9381b180
r3 : 00000000  r2 : 00000000  r1 : 000005ea  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 4248c059  DAC: 00000015
Process klogd (pid: 2046, stack limit = 0x84eb02e8)
[...]

This is  because netdev_alloc_skb() fails and 'mdp->rx_skbuff[entry]' is left
NULL but sh_eth_rx() later  uses it without checking.  Add such check...

Reported-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7622213beef1..d11546c2e902 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1427,6 +1427,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
 		if (mdp->cd->shift_rd0)
 			desc_status >>= 16;
 
+		skb = mdp->rx_skbuff[entry];
 		if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
 				   RD_RFS5 | RD_RFS6 | RD_RFS10)) {
 			ndev->stats.rx_errors++;
@@ -1442,12 +1443,11 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
 				ndev->stats.rx_missed_errors++;
 			if (desc_status & RD_RFS10)
 				ndev->stats.rx_over_errors++;
-		} else {
+		} else	if (skb) {
 			if (!mdp->cd->hw_swap)
 				sh_eth_soft_swap(
 					phys_to_virt(ALIGN(rxdesc->addr, 4)),
 					pkt_len + 2);
-			skb = mdp->rx_skbuff[entry];
 			mdp->rx_skbuff[entry] = NULL;
 			if (mdp->cd->rpadir)
 				skb_reserve(skb, NET_IP_ALIGN);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 095/126] vlan: Fix untag operations of stacked vlans with REORDER_HEADER off
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 094/126] sh_eth: fix kernel oops in skb_put() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 096/126] skbuff: Fix offset error in skb_reorder_vlan_header Luis Henriques
                   ` (30 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vladislav Yasevich, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vlad Yasevich <vyasevich@gmail.com>

commit a6e18ff111701b4ff6947605bfbe9594ec42a6e8 upstream.

When we have multiple stacked vlan devices all of which have
turned off REORDER_HEADER flag, the untag operation does not
locate the ethernet addresses correctly for nested vlans.
The reason is that in case of REORDER_HEADER flag being off,
the outer vlan headers are put back and the mac_len is adjusted
to account for the presense of the header.  Then, the subsequent
untag operation, for the next level vlan, always use VLAN_ETH_HLEN
to locate the begining of the ethernet header and that ends up
being a multiple of 4 bytes short of the actuall beginning
of the mac header (the multiple depending on the how many vlan
encapsulations ethere are).

As a reslult, if there are multiple levles of vlan devices
with REODER_HEADER being off, the recevied packets end up
being dropped.

To solve this, we use skb->mac_len as the offset.  The value
is always set on receive path and starts out as a ETH_HLEN.
The value is also updated when the vlan header manupations occur
so we know it will be correct.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/skbuff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index a280d04a3414..d50deee76502 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3996,7 +3996,8 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
 		return NULL;
 	}
 
-	memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
+	memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len,
+		2 * ETH_ALEN);
 	skb->mac_header += VLAN_HLEN;
 	return skb;
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 096/126] skbuff: Fix offset error in skb_reorder_vlan_header
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 095/126] vlan: Fix untag operations of stacked vlans with REORDER_HEADER off Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 097/126] pptp: verify sockaddr_len in pptp_bind() and pptp_connect() Luis Henriques
                   ` (29 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Dichtel, Patrick McHardy, Vladislav Yasevich,
	David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vlad Yasevich <vyasevich@gmail.com>

commit f654861569872d10dcb79d9d7ca219b316f94ff0 upstream.

skb_reorder_vlan_header is called after the vlan header has
been pulled.  As a result the offset of the begining of
the mac header has been incrased by 4 bytes (VLAN_HLEN).
When moving the mac addresses, include this incrase in
the offset calcualation so that the mac addresses are
copied correctly.

Fixes: a6e18ff1117 (vlan: Fix untag operations of stacked vlans with REORDER_HEADER off)
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Patrick McHardy <kaber@trash.net>
Signed-off-by: Vladislav Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d50deee76502..7e31a99e0ed9 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3996,7 +3996,7 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
 		return NULL;
 	}
 
-	memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len,
+	memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len - VLAN_HLEN,
 		2 * ETH_ALEN);
 	skb->mac_header += VLAN_HLEN;
 	return skb;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 097/126] pptp: verify sockaddr_len in pptp_bind() and pptp_connect()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 096/126] skbuff: Fix offset error in skb_reorder_vlan_header Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 098/126] bluetooth: Validate socket address length in sco_sock_bind() Luis Henriques
                   ` (28 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cong Wang, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: WANG Cong <xiyou.wangcong@gmail.com>

commit 09ccfd238e5a0e670d8178cf50180ea81ae09ae1 upstream.

Reported-by: Dmitry Vyukov <dvyukov@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ppp/pptp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
index 1dc628ffce2b..0710214df2bf 100644
--- a/drivers/net/ppp/pptp.c
+++ b/drivers/net/ppp/pptp.c
@@ -420,6 +420,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr,
 	struct pptp_opt *opt = &po->proto.pptp;
 	int error = 0;
 
+	if (sockaddr_len < sizeof(struct sockaddr_pppox))
+		return -EINVAL;
+
 	lock_sock(sk);
 
 	opt->src_addr = sp->sa_addr.pptp;
@@ -441,6 +444,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
 	struct flowi4 fl4;
 	int error = 0;
 
+	if (sockaddr_len < sizeof(struct sockaddr_pppox))
+		return -EINVAL;
+
 	if (sp->sa_protocol != PX_PROTO_PPTP)
 		return -EINVAL;
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 098/126] bluetooth: Validate socket address length in sco_sock_bind().
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 097/126] pptp: verify sockaddr_len in pptp_bind() and pptp_connect() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 099/126] af_unix: Revert 'lock_interruptible' in stream receive code Luis Henriques
                   ` (27 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "David S. Miller" <davem@davemloft.net>

commit 5233252fce714053f0151680933571a2da9cbfb4 upstream.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/sco.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index dbbbc0292bd0..f9cd2e1e1635 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -459,6 +459,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
 	if (!addr || addr->sa_family != AF_BLUETOOTH)
 		return -EINVAL;
 
+	if (addr_len < sizeof(struct sockaddr_sco))
+		return -EINVAL;
+
 	lock_sock(sk);
 
 	if (sk->sk_state != BT_OPEN) {

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 099/126] af_unix: Revert 'lock_interruptible' in stream receive code
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 098/126] bluetooth: Validate socket address length in sco_sock_bind() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 100/126] ip6mr: call del_timer_sync() in ip6mr_free_table() Luis Henriques
                   ` (26 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rainer Weikusat, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rainer Weikusat <rweikusat@mobileactivedefense.com>

commit 3822b5c2fc62e3de8a0f33806ff279fb7df92432 upstream.

With b3ca9b02b00704053a38bfe4c31dbbb9c13595d0, the AF_UNIX SOCK_STREAM
receive code was changed from using mutex_lock(&u->readlock) to
mutex_lock_interruptible(&u->readlock) to prevent signals from being
delayed for an indefinite time if a thread sleeping on the mutex
happened to be selected for handling the signal. But this was never a
problem with the stream receive code (as opposed to its datagram
counterpart) as that never went to sleep waiting for new messages with the
mutex held and thus, wouldn't cause secondary readers to block on the
mutex waiting for the sleeping primary reader. As the interruptible
locking makes the code more complicated in exchange for no benefit,
change it back to using mutex_lock.

Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/unix/af_unix.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 9acfd79f0d13..7229794c1419 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2096,14 +2096,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
 		memset(&tmp_scm, 0, sizeof(tmp_scm));
 	}
 
-	err = mutex_lock_interruptible(&u->readlock);
-	if (unlikely(err)) {
-		/* recvmsg() in non blocking mode is supposed to return -EAGAIN
-		 * sk_rcvtimeo is not honored by mutex_lock_interruptible()
-		 */
-		err = noblock ? -EAGAIN : -ERESTARTSYS;
-		goto out;
-	}
+	mutex_lock(&u->readlock);
 
 	if (flags & MSG_PEEK)
 		skip = sk_peek_offset(sk, flags);
@@ -2144,12 +2137,12 @@ again:
 
 			timeo = unix_stream_data_wait(sk, timeo, last);
 
-			if (signal_pending(current)
-			    ||  mutex_lock_interruptible(&u->readlock)) {
+			if (signal_pending(current)) {
 				err = sock_intr_errno(timeo);
 				goto out;
 			}
 
+			mutex_lock(&u->readlock);
 			continue;
  unlock:
 			unix_state_unlock(sk);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 100/126] ip6mr: call del_timer_sync() in ip6mr_free_table()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 099/126] af_unix: Revert 'lock_interruptible' in stream receive code Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 101/126] drm/i915: Disable PSMI sleep messages on all rings around context switches Luis Henriques
                   ` (25 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hannes Frederic Sowa, Cong Wang, David S. Miller, Ben Hutchings,
	Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: WANG Cong <xiyou.wangcong@gmail.com>

commit 7ba0c47c34a1ea5bc7a24ca67309996cce0569b5 upstream.

We need to wait for the flying timers, since we
are going to free the mrtable right after it.

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 72f3baee76d9..5e739bb6ae90 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -336,7 +336,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)
 
 static void ip6mr_free_table(struct mr6_table *mrt)
 {
-	del_timer(&mrt->ipmr_expire_timer);
+	del_timer_sync(&mrt->ipmr_expire_timer);
 	mroute_clean_tables(mrt, true);
 	kfree(mrt);
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 101/126] drm/i915: Disable PSMI sleep messages on all rings around context switches
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 100/126] ip6mr: call del_timer_sync() in ip6mr_free_table() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 102/126] crypto: nx - Fix timing leak in GCM and CCM decryption Luis Henriques
                   ` (24 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Simon Farnsworth, Daniel Vetter, Ville Syrjälä,
	Chris Wilson, Jani Nikula, Ben Hutchings, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Wilson <chris@chris-wilson.co.uk>

commit 2c550183476dfa25641309ae9a28d30feed14379 upstream.

There exists a current workaround to prevent a hang on context switch
should the ring go to sleep in the middle of the restore,
WaProgramMiArbOnOffAroundMiSetContext (applicable to all gen7+). In
spite of disabling arbitration (which prevents the ring from powering
down during the critical section) we were still hitting hangs that had
the hallmarks of the known erratum. That is we are still seeing hangs
"on the last instruction in the context restore". By comparing -nightly
(broken) with requests (working), we were able to deduce that it was the
semaphore LRI cross-talk that reproduced the original failure. The key
was that requests implemented deferred semaphore signalling, and
disabling that, i.e. emitting the semaphore signal to every other ring
after every batch restored the frequent hang.  Explicitly disabling PSMI
sleep on the RCS ring was insufficient, all the rings had to be awake to
prevent the hangs. Fortunately, we can reduce the wakelock to the
MI_SET_CONTEXT operation itself, and so should be able to limit the extra
power implications.

Since the MI_ARB_ON_OFF workaround is listed for all gen7 and above
products, we should apply this extra hammer for all of the same
platforms despite so far that we have only been able to reproduce the
hang on certain ivb and hsw models. The last question is whether we want
to always use the extra hammer or only when we know semaphores are in
operation. At the moment, we only use LRI on non-RCS rings for
semaphores, but that may change in the future with the possibility of
reintroducing this bug under subtle conditions.

v2: Make it explicit that the PSMI LRI are an extension to the original
workaround for the other rings.
v3: Bikeshedding variable names and whitespacing

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80660
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83677
Cc: Simon Farnsworth <simon@farnz.org.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Peter Frühberger <fritsch@xbmc.org>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 48 +++++++++++++++++++++++++++------
 drivers/gpu/drm/i915/i915_reg.h         |  2 ++
 2 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index a5ddf3bce9c3..14f92644828a 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -545,7 +545,12 @@ mi_set_context(struct intel_engine_cs *ring,
 	       struct intel_context *new_context,
 	       u32 hw_flags)
 {
-	int ret;
+	const int num_rings =
+		/* Use an extended w/a on ivb+ if signalling from other rings */
+		i915_semaphore_is_enabled(ring->dev) ?
+		hweight32(INTEL_INFO(ring->dev)->ring_mask) - 1 :
+		0;
+	int len, i, ret;
 
 	/* w/a: If Flush TLB Invalidation Mode is enabled, driver must do a TLB
 	 * invalidation prior to MI_SET_CONTEXT. On GEN6 we don't set the value
@@ -558,15 +563,31 @@ mi_set_context(struct intel_engine_cs *ring,
 			return ret;
 	}
 
-	ret = intel_ring_begin(ring, 6);
+
+	len = 4;
+	if (INTEL_INFO(ring->dev)->gen >= 7)
+		len += 2 + (num_rings ? 4*num_rings + 2 : 0);
+
+	ret = intel_ring_begin(ring, len);
 	if (ret)
 		return ret;
 
 	/* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */
-	if (INTEL_INFO(ring->dev)->gen >= 7)
+	if (INTEL_INFO(ring->dev)->gen >= 7) {
 		intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_DISABLE);
-	else
-		intel_ring_emit(ring, MI_NOOP);
+		if (num_rings) {
+			struct intel_engine_cs *signaller;
+
+			intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(num_rings));
+			for_each_ring(signaller, to_i915(ring->dev), i) {
+				if (signaller == ring)
+					continue;
+
+				intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base));
+				intel_ring_emit(ring, _MASKED_BIT_ENABLE(GEN6_PSMI_SLEEP_MSG_DISABLE));
+			}
+		}
+	}
 
 	intel_ring_emit(ring, MI_NOOP);
 	intel_ring_emit(ring, MI_SET_CONTEXT);
@@ -581,10 +602,21 @@ mi_set_context(struct intel_engine_cs *ring,
 	 */
 	intel_ring_emit(ring, MI_NOOP);
 
-	if (INTEL_INFO(ring->dev)->gen >= 7)
+	if (INTEL_INFO(ring->dev)->gen >= 7) {
+		if (num_rings) {
+			struct intel_engine_cs *signaller;
+
+			intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(num_rings));
+			for_each_ring(signaller, to_i915(ring->dev), i) {
+				if (signaller == ring)
+					continue;
+
+				intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base));
+				intel_ring_emit(ring, _MASKED_BIT_DISABLE(GEN6_PSMI_SLEEP_MSG_DISABLE));
+			}
+		}
 		intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE);
-	else
-		intel_ring_emit(ring, MI_NOOP);
+	}
 
 	intel_ring_advance(ring);
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index fa0ec5aed9ed..8196408bb819 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -978,6 +978,7 @@ enum punit_power_well {
 #define GEN6_VERSYNC	(RING_SYNC_1(VEBOX_RING_BASE))
 #define GEN6_VEVSYNC	(RING_SYNC_2(VEBOX_RING_BASE))
 #define GEN6_NOSYNC 0
+#define RING_PSMI_CTL(base)	((base)+0x50)
 #define RING_MAX_IDLE(base)	((base)+0x54)
 #define RING_HWS_PGA(base)	((base)+0x80)
 #define RING_HWS_PGA_GEN6(base)	((base)+0x2080)
@@ -1301,6 +1302,7 @@ enum punit_power_well {
 #define   GEN6_BLITTER_FBC_NOTIFY			(1<<3)
 
 #define GEN6_RC_SLEEP_PSMI_CONTROL	0x2050
+#define   GEN6_PSMI_SLEEP_MSG_DISABLE	(1 << 0)
 #define   GEN8_RC_SEMA_IDLE_MSG_DISABLE	(1 << 12)
 #define   GEN8_FF_DOP_CLOCK_GATE_DISABLE	(1<<10)
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 102/126] crypto: nx - Fix timing leak in GCM and CCM decryption
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 101/126] drm/i915: Disable PSMI sleep messages on all rings around context switches Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 103/126] crypto: talitos - Fix timing leak in ESP ICV verification Luis Henriques
                   ` (23 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David Gstir, Herbert Xu, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Gstir <david@sigma-star.at>

commit cb8affb55c7e64816f3effcd9b2fc3268c016fac upstream.

Using non-constant time memcmp() makes the verification of the authentication
tag in the decrypt path vulnerable to timing attacks. Fix this by using
crypto_memneq() instead.

Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/crypto/nx/nx-aes-ccm.c | 2 +-
 drivers/crypto/nx/nx-aes-gcm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/nx/nx-aes-ccm.c b/drivers/crypto/nx/nx-aes-ccm.c
index 5ecd4c2414aa..b1679db09de2 100644
--- a/drivers/crypto/nx/nx-aes-ccm.c
+++ b/drivers/crypto/nx/nx-aes-ccm.c
@@ -411,7 +411,7 @@ static int ccm_nx_decrypt(struct aead_request   *req,
 		processed += to_process;
 	} while (processed < nbytes);
 
-	rc = memcmp(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
+	rc = crypto_memneq(csbcpb->cpb.aes_ccm.out_pat_or_mac, priv->oauth_tag,
 		    authsize) ? -EBADMSG : 0;
 out:
 	spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c
index 025d9a8d5b19..dd4431ea1376 100644
--- a/drivers/crypto/nx/nx-aes-gcm.c
+++ b/drivers/crypto/nx/nx-aes-gcm.c
@@ -415,7 +415,7 @@ mac:
 		scatterwalk_map_and_copy(itag, req->src, nbytes,
 				 crypto_aead_authsize(crypto_aead_reqtfm(req)),
 				 SCATTERWALK_FROM_SG);
-		rc = memcmp(itag, otag,
+		rc = crypto_memneq(itag, otag,
 			    crypto_aead_authsize(crypto_aead_reqtfm(req))) ?
 		     -EBADMSG : 0;
 	}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 103/126] crypto: talitos - Fix timing leak in ESP ICV verification
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 102/126] crypto: nx - Fix timing leak in GCM and CCM decryption Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 104/126] ASoC: wm8962: correct addresses for HPF_C_0/1 Luis Henriques
                   ` (22 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David Gstir, Herbert Xu, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Gstir <david@sigma-star.at>

commit 79960943fdc114fd4583c9ab164b5c89da7aa601 upstream.

Using non-constant time memcmp() makes the verification of the authentication
tag in the decrypt path vulnerable to timing attacks. Fix this by using
crypto_memneq() instead.

Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/crypto/talitos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 307931528eb2..da328ed633fb 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -870,8 +870,8 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
 			icvdata = &edesc->link_tbl[0];
 
 		sg = sg_last(req->dst, edesc->dst_nents ? : 1);
-		err = memcmp(icvdata, (char *)sg_virt(sg) + sg->length -
-			     ctx->authsize, ctx->authsize) ? -EBADMSG : 0;
+		err = crypto_memneq(icvdata, (char *)sg_virt(sg) + sg->length -
+				    ctx->authsize, ctx->authsize) ? -EBADMSG : 0;
 	}
 
 	kfree(edesc);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 104/126] ASoC: wm8962: correct addresses for HPF_C_0/1
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 103/126] crypto: talitos - Fix timing leak in ESP ICV verification Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 105/126] mac80211: mesh: fix call_rcu() usage Luis Henriques
                   ` (21 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sachin Pandhare, Mark Brown, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sachin Pandhare <sachinpandhare@gmail.com>

commit e9f96bc53c1b959859599cb30ce6fd4fbb4448c2 upstream.

>From datasheet:
R17408 (4400h) HPF_C_1
R17409 (4401h) HPF_C_0
17048 -> 17408 (0x4400)
17049 -> 17409 (0x4401)

Signed-off-by: Sachin Pandhare <sachinpandhare@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8962.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index ca2fda9d72be..0caaa8fa4231 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -362,8 +362,8 @@ static struct reg_default wm8962_reg[] = {
 	{ 16924, 0x0059 },   /* R16924 - HDBASS_PG_1 */
 	{ 16925, 0x999A },   /* R16925 - HDBASS_PG_0 */
 
-	{ 17048, 0x0083 },   /* R17408 - HPF_C_1 */
-	{ 17049, 0x98AD },   /* R17409 - HPF_C_0 */
+	{ 17408, 0x0083 },   /* R17408 - HPF_C_1 */
+	{ 17409, 0x98AD },   /* R17409 - HPF_C_0 */
 
 	{ 17920, 0x007F },   /* R17920 - ADCL_RETUNE_C1_1 */
 	{ 17921, 0xFFFF },   /* R17921 - ADCL_RETUNE_C1_0 */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 105/126] mac80211: mesh: fix call_rcu() usage
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 104/126] ASoC: wm8962: correct addresses for HPF_C_0/1 Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 106/126] mac80211: ensure we don't update tx power on a non-running sdata Luis Henriques
                   ` (20 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johannes Berg <johannes.berg@intel.com>

commit c2e703a55245bfff3db53b1f7cbe59f1ee8a4339 upstream.

When using call_rcu(), the called function may be delayed quite
significantly, and without a matching rcu_barrier() there's no
way to be sure it has finished.
Therefore, global state that could be gone/freed/reused should
never be touched in the callback.

Fix this in mesh by moving the atomic_dec() into the caller;
that's not really a problem since we already unlinked the path
and it will be destroyed anyway.

This fixes a crash Jouni observed when running certain tests in
a certain order, in which the mesh interface was torn down, the
memory reused for a function pointer (work struct) and running
that then crashed since the pointer had been decremented by 1,
resulting in an invalid instruction byte stream.

Fixes: eb2b9311fd00 ("mac80211: mesh path table implementation")
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/mesh_pathtbl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index cf032a8db9d7..8830af725bc6 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -748,10 +748,8 @@ void mesh_plink_broken(struct sta_info *sta)
 static void mesh_path_node_reclaim(struct rcu_head *rp)
 {
 	struct mpath_node *node = container_of(rp, struct mpath_node, rcu);
-	struct ieee80211_sub_if_data *sdata = node->mpath->sdata;
 
 	del_timer_sync(&node->mpath->timer);
-	atomic_dec(&sdata->u.mesh.mpaths);
 	kfree(node->mpath);
 	kfree(node);
 }
@@ -759,8 +757,9 @@ static void mesh_path_node_reclaim(struct rcu_head *rp)
 /* needs to be called with the corresponding hashwlock taken */
 static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node)
 {
-	struct mesh_path *mpath;
-	mpath = node->mpath;
+	struct mesh_path *mpath = node->mpath;
+	struct ieee80211_sub_if_data *sdata = node->mpath->sdata;
+
 	spin_lock(&mpath->state_lock);
 	mpath->flags |= MESH_PATH_RESOLVING;
 	if (mpath->is_gate)
@@ -768,6 +767,7 @@ static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node)
 	hlist_del_rcu(&node->list);
 	call_rcu(&node->rcu, mesh_path_node_reclaim);
 	spin_unlock(&mpath->state_lock);
+	atomic_dec(&sdata->u.mesh.mpaths);
 	atomic_dec(&tbl->entries);
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 106/126] mac80211: ensure we don't update tx power on a non-running sdata
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 105/126] mac80211: mesh: fix call_rcu() usage Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 107/126] can: sja1000: clear interrupts on start Luis Henriques
                   ` (19 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Emmanuel Grumbach, Johannes Berg, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

commit 5ad11b50fda1306b5317124f97f0a7a4c022b022 upstream.

We can't update the Tx power on the device unless it is
running.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=101521.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/iface.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 0af1778345b8..da555f878db7 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -74,7 +74,8 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)
 
 void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)
 {
-	if (__ieee80211_recalc_txpower(sdata))
+	if (__ieee80211_recalc_txpower(sdata) ||
+	    ieee80211_sdata_running(sdata))
 		ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER);
 }
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 107/126] can: sja1000: clear interrupts on start
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 106/126] mac80211: ensure we don't update tx power on a non-running sdata Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 108/126] ring-buffer: Update read stamp with first real commit on page Luis Henriques
                   ` (18 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mirza Krak, Marc Kleine-Budde, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mirza Krak <mirza.krak@hostmobility.com>

commit 7cecd9ab80f43972c056dc068338f7bcc407b71c upstream.

According to SJA1000 data sheet error-warning (EI) interrupt is not
cleared by setting the controller in to reset-mode.

Then if we have the following case:
- system is suspended (echo mem > /sys/power/state) and SJA1000 is left
  in operating state
- A bus error condition occurs which activates EI interrupt, system is
  still suspended which means EI interrupt will be not be handled nor
  cleared.

If the above two events occur, on resume there is no way to return the
SJA1000 to operating state, except to cycle power to it.

By simply reading the IR register on start we will clear any previous
conditions that could be present.

Signed-off-by: Mirza Krak <mirza.krak@hostmobility.com>
Reported-by: Christian Magnusson <Christian.Magnusson@semcon.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/sja1000/sja1000.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index f31499a32d7d..052b4edaab43 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -183,6 +183,9 @@ static void sja1000_start(struct net_device *dev)
 	priv->write_reg(priv, SJA1000_RXERR, 0x0);
 	priv->read_reg(priv, SJA1000_ECC);
 
+	/* clear interrupt flags */
+	priv->read_reg(priv, SJA1000_IR);
+
 	/* leave reset mode */
 	set_normal_mode(dev);
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 108/126] ring-buffer: Update read stamp with first real commit on page
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 107/126] can: sja1000: clear interrupts on start Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 109/126] block: Always check queue limits for cloned requests Luis Henriques
                   ` (17 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit b81f472a208d3e2b4392faa6d17037a89442f4ce upstream.

Do not update the read stamp after swapping out the reader page from the
write buffer. If the reader page is swapped out of the buffer before an
event is written to it, then the read_stamp may get an out of date
timestamp, as the page timestamp is updated on the first commit to that
page.

rb_get_reader_page() only returns a page if it has an event on it, otherwise
it will return NULL. At that point, check if the page being returned has
events and has not been read yet. Then at that point update the read_stamp
to match the time stamp of the reader page.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/ring_buffer.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index c2aad7276111..56ce06143148 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1998,12 +1998,6 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer)
 		goto again;
 }
 
-static void rb_reset_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
-{
-	cpu_buffer->read_stamp = cpu_buffer->reader_page->page->time_stamp;
-	cpu_buffer->reader_page->read = 0;
-}
-
 static void rb_inc_iter(struct ring_buffer_iter *iter)
 {
 	struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;
@@ -3652,7 +3646,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
 
 	/* Finally update the reader page to the new head */
 	cpu_buffer->reader_page = reader;
-	rb_reset_reader_page(cpu_buffer);
+	cpu_buffer->reader_page->read = 0;
 
 	if (overwrite != cpu_buffer->last_overrun) {
 		cpu_buffer->lost_events = overwrite - cpu_buffer->last_overrun;
@@ -3662,6 +3656,10 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
 	goto again;
 
  out:
+	/* Update the read_stamp on the first event */
+	if (reader && reader->read == 0)
+		cpu_buffer->read_stamp = reader->page->time_stamp;
+
 	arch_spin_unlock(&cpu_buffer->lock);
 	local_irq_restore(flags);
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 109/126] block: Always check queue limits for cloned requests
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 108/126] ring-buffer: Update read stamp with first real commit on page Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 110/126] Fix a memory leak in scsi_host_dev_release() Luis Henriques
                   ` (16 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Snitzer, Ewan Milne, Jeff Moyer, Hannes Reinecke,
	Jens Axboe, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hannes Reinecke <hare@suse.de>

commit bf4e6b4e757488dee1b6a581f49c7ac34cd217f8 upstream.

When a cloned request is retried on other queues it always needs
to be checked against the queue limits of that queue.
Otherwise the calculations for nr_phys_segments might be wrong,
leading to a crash in scsi_init_sgtable().

To clarify this the patch renames blk_rq_check_limits()
to blk_cloned_rq_check_limits() and removes the symbol
export, as the new function should only be used for
cloned requests and never exported.

Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Ewan Milne <emilne@redhat.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Fixes: e2a60da74 ("block: Clean up special command handling logic")
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 block/blk-core.c       | 21 +++++++--------------
 include/linux/blkdev.h |  1 -
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1cfe8e603d3b..72a4cdaa083c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1969,7 +1969,8 @@ void submit_bio(int rw, struct bio *bio)
 EXPORT_SYMBOL(submit_bio);
 
 /**
- * blk_rq_check_limits - Helper function to check a request for the queue limit
+ * blk_cloned_rq_check_limits - Helper function to check a cloned request
+ *                              for new the queue limits
  * @q:  the queue
  * @rq: the request being checked
  *
@@ -1980,20 +1981,13 @@ EXPORT_SYMBOL(submit_bio);
  *    after it is inserted to @q, it should be checked against @q before
  *    the insertion using this generic function.
  *
- *    This function should also be useful for request stacking drivers
- *    in some cases below, so export this function.
  *    Request stacking drivers like request-based dm may change the queue
- *    limits while requests are in the queue (e.g. dm's table swapping).
- *    Such request stacking drivers should check those requests against
- *    the new queue limits again when they dispatch those requests,
- *    although such checkings are also done against the old queue limits
- *    when submitting requests.
+ *    limits when retrying requests on other queues. Those requests need
+ *    to be checked against the new queue limits again during dispatch.
  */
-int blk_rq_check_limits(struct request_queue *q, struct request *rq)
+static int blk_cloned_rq_check_limits(struct request_queue *q,
+				      struct request *rq)
 {
-	if (!rq_mergeable(rq))
-		return 0;
-
 	if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
 		printk(KERN_ERR "%s: over max size limit.\n", __func__);
 		return -EIO;
@@ -2013,7 +2007,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(blk_rq_check_limits);
 
 /**
  * blk_insert_cloned_request - Helper for stacking drivers to submit a request
@@ -2025,7 +2018,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
 	unsigned long flags;
 	int where = ELEVATOR_INSERT_BACK;
 
-	if (blk_rq_check_limits(q, rq))
+	if (blk_cloned_rq_check_limits(q, rq))
 		return -EIO;
 
 	if (rq->rq_disk &&
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4b92fcb7e0e1..d19d996482ab 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -801,7 +801,6 @@ extern void blk_rq_set_block_pc(struct request *);
 extern void blk_requeue_request(struct request_queue *, struct request *);
 extern void blk_add_request_payload(struct request *rq, struct page *page,
 		unsigned int len);
-extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
 extern int blk_lld_busy(struct request_queue *q);
 extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
 			     struct bio_set *bs, gfp_t gfp_mask,

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 110/126] Fix a memory leak in scsi_host_dev_release()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 109/126] block: Always check queue limits for cloned requests Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 111/126] wan/x25: Fix use-after-free in x25_asy_open_tty() Luis Henriques
                   ` (15 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, Christoph Hellwig, Hannes Reinecke,
	Martin K. Petersen, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit b49493f99690c8eaacfbc635bafaad629ea2c036 upstream.

Avoid that kmemleak reports the following memory leak if a
SCSI LLD calls scsi_host_alloc() and scsi_host_put() but neither
scsi_host_add() nor scsi_host_remove(). The following shell
command triggers that scenario:

for ((i=0; i<2; i++)); do
  srp_daemon -oac |
  while read line; do
    echo $line >/sys/class/infiniband_srp/srp-mlx4_0-1/add_target
  done
done

unreferenced object 0xffff88021b24a220 (size 8):
  comm "srp_daemon", pid 56421, jiffies 4295006762 (age 4240.750s)
  hex dump (first 8 bytes):
    68 6f 73 74 35 38 00 a5                          host58..
  backtrace:
    [<ffffffff8151014a>] kmemleak_alloc+0x7a/0xc0
    [<ffffffff81165c1e>] __kmalloc_track_caller+0xfe/0x160
    [<ffffffff81260d2b>] kvasprintf+0x5b/0x90
    [<ffffffff81260e2d>] kvasprintf_const+0x8d/0xb0
    [<ffffffff81254b0c>] kobject_set_name_vargs+0x3c/0xa0
    [<ffffffff81337e3c>] dev_set_name+0x3c/0x40
    [<ffffffff81355757>] scsi_host_alloc+0x327/0x4b0
    [<ffffffffa03edc8e>] srp_create_target+0x4e/0x8a0 [ib_srp]
    [<ffffffff8133778b>] dev_attr_store+0x1b/0x20
    [<ffffffff811f27fa>] sysfs_kf_write+0x4a/0x60
    [<ffffffff811f1e8e>] kernfs_fop_write+0x14e/0x180
    [<ffffffff81176eef>] __vfs_write+0x2f/0xf0
    [<ffffffff811771e4>] vfs_write+0xa4/0x100
    [<ffffffff81177c64>] SyS_write+0x54/0xc0
    [<ffffffff8151b257>] entry_SYSCALL_64_fastpath+0x12/0x6f

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/hosts.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 3cbb57a8b846..3b43224f7f77 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -308,6 +308,17 @@ static void scsi_host_dev_release(struct device *dev)
 		kfree(queuedata);
 	}
 
+	if (shost->shost_state == SHOST_CREATED) {
+		/*
+		 * Free the shost_dev device name here if scsi_host_alloc()
+		 * and scsi_host_put() have been called but neither
+		 * scsi_host_add() nor scsi_host_remove() has been called.
+		 * This avoids that the memory allocated for the shost_dev
+		 * name is leaked.
+		 */
+		kfree(dev_name(&shost->shost_dev));
+	}
+
 	scsi_destroy_command_freelist(shost);
 	if (shost->bqt)
 		blk_free_tags(shost->bqt);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 111/126] wan/x25: Fix use-after-free in x25_asy_open_tty()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 110/126] Fix a memory leak in scsi_host_dev_release() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 112/126] mac80211: do not actively scan DFS channels Luis Henriques
                   ` (14 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Hurley <peter@hurleysoftware.com>

commit ee9159ddce14bc1dec9435ae4e3bd3153e783706 upstream.

The N_X25 line discipline may access the previous line discipline's closed
and already-freed private data on open [1].

The tty->disc_data field _never_ refers to valid data on entry to the
line discipline's open() method. Rather, the ldisc is expected to
initialize that field for its own use for the lifetime of the instance
(ie. from open() to close() only).

[1]
    [  634.336761] ==================================================================
    [  634.338226] BUG: KASAN: use-after-free in x25_asy_open_tty+0x13d/0x490 at addr ffff8800a743efd0
    [  634.339558] Read of size 4 by task syzkaller_execu/8981
    [  634.340359] =============================================================================
    [  634.341598] BUG kmalloc-512 (Not tainted): kasan: bad access detected
    ...
    [  634.405018] Call Trace:
    [  634.405277] dump_stack (lib/dump_stack.c:52)
    [  634.405775] print_trailer (mm/slub.c:655)
    [  634.406361] object_err (mm/slub.c:662)
    [  634.406824] kasan_report_error (mm/kasan/report.c:138 mm/kasan/report.c:236)
    [  634.409581] __asan_report_load4_noabort (mm/kasan/report.c:279)
    [  634.411355] x25_asy_open_tty (drivers/net/wan/x25_asy.c:559 (discriminator 1))
    [  634.413997] tty_ldisc_open.isra.2 (drivers/tty/tty_ldisc.c:447)
    [  634.414549] tty_set_ldisc (drivers/tty/tty_ldisc.c:567)
    [  634.415057] tty_ioctl (drivers/tty/tty_io.c:2646 drivers/tty/tty_io.c:2879)
    [  634.423524] do_vfs_ioctl (fs/ioctl.c:43 fs/ioctl.c:607)
    [  634.427491] SyS_ioctl (fs/ioctl.c:622 fs/ioctl.c:613)
    [  634.427945] entry_SYSCALL_64_fastpath (arch/x86/entry/entry_64.S:188)

Reported-and-tested-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wan/x25_asy.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index fa9fdfa128c1..087e6a586a1e 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -549,16 +549,12 @@ static void x25_asy_receive_buf(struct tty_struct *tty,
 
 static int x25_asy_open_tty(struct tty_struct *tty)
 {
-	struct x25_asy *sl = tty->disc_data;
+	struct x25_asy *sl;
 	int err;
 
 	if (tty->ops->write == NULL)
 		return -EOPNOTSUPP;
 
-	/* First make sure we're not already connected. */
-	if (sl && sl->magic == X25_ASY_MAGIC)
-		return -EEXIST;
-
 	/* OK.  Find a free X.25 channel to use. */
 	sl = x25_asy_alloc();
 	if (sl == NULL)

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 112/126] mac80211: do not actively scan DFS channels
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 111/126] wan/x25: Fix use-after-free in x25_asy_open_tty() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 113/126] locking: Add WARN_ON_ONCE lock assertion Luis Henriques
                   ` (13 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Antonio Quartulli, Johannes Berg, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Antonio Quartulli <antonio@meshcoding.com>

commit 4e39ccac0d678eacb5dd6ffc5057531af33c12d6 upstream.

DFS channels should not be actively scanned as we can't be sure
if we are allowed or not.

If the current channel is in the DFS band, active scan might be
performed after CSA, but we have no guarantee about other channels,
therefore it is safer to prevent active scanning at all.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/scan.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index f40661eb75b5..96c3e3d5ef70 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -525,8 +525,8 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 		/* We need to ensure power level is at max for scanning. */
 		ieee80211_hw_config(local, 0);
 
-		if ((req->channels[0]->flags &
-		     IEEE80211_CHAN_NO_IR) ||
+		if ((req->channels[0]->flags & (IEEE80211_CHAN_NO_IR |
+						IEEE80211_CHAN_RADAR)) ||
 		    !local->scan_req->n_ssids) {
 			next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		} else {
@@ -572,7 +572,7 @@ ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
 	 * TODO: channel switching also consumes quite some time,
 	 * add that delay as well to get a better estimation
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR)
+	if (chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR))
 		return IEEE80211_PASSIVE_CHANNEL_TIME;
 	return IEEE80211_PROBE_DELAY + IEEE80211_CHANNEL_TIME;
 }
@@ -696,7 +696,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
 	 *
 	 * In any case, it is not necessary for a passive scan.
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR ||
+	if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)) ||
 	    !local->scan_req->n_ssids) {
 		*next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		local->next_scan_state = SCAN_DECISION;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 113/126] locking: Add WARN_ON_ONCE lock assertion
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 112/126] mac80211: do not actively scan DFS channels Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 114/126] drm: Fix an unwanted master inheritance v2 Luis Henriques
                   ` (12 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Hurley <peter@hurleysoftware.com>

commit 9a37110d20c95d1ebf6c04881177fe8f62831db2 upstream.

An interface may need to assert a lock invariant and not flood the
system logs; add a lockdep helper macro equivalent to
lockdep_assert_held() which only WARNs once.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/lockdep.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f920d7..64c7425afbce 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
 		WARN_ON(debug_locks && !lockdep_is_held(l));	\
 	} while (0)
 
+#define lockdep_assert_held_once(l)	do {				\
+		WARN_ON_ONCE(debug_locks && !lockdep_is_held(l));	\
+	} while (0)
+
 #define lockdep_recursing(tsk)	((tsk)->lockdep_recursion)
 
 #else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
 #define lockdep_depth(tsk)	(0)
 
 #define lockdep_assert_held(l)			do { (void)(l); } while (0)
+#define lockdep_assert_held_once(l)		do { (void)(l); } while (0)
 
 #define lockdep_recursing(tsk)			(0)
 

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 114/126] drm: Fix an unwanted master inheritance v2
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 113/126] locking: Add WARN_ON_ONCE lock assertion Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 115/126] sched/core: Clear the root_domain cpumasks in init_rootdomain() Luis Henriques
                   ` (11 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Hellstrom, Dave Airlie, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Hellstrom <thellstrom@vmware.com>

commit a0af2e538c80f3e47f1d6ddf120a153ad909e8ad upstream.

A client calling drmSetMaster() using a file descriptor that was opened
when another client was master would inherit the latter client's master
object and all its authenticated clients.

This is unwanted behaviour, and when this happens, instead allocate a
brand new master object for the client calling drmSetMaster().

Fixes a BUG() throw in vmw_master_set().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[ luis: backported to 3.16:
  - drm_setmaster_ioctl() in file drm_stub.c instead of drm_drv.c
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/drm_fops.c | 84 ++++++++++++++++++++++++++++++----------------
 drivers/gpu/drm/drm_stub.c |  5 +++
 include/drm/drmP.h         |  6 ++++
 3 files changed, 67 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 021fe5d11df5..394bdc6617c7 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -168,6 +168,60 @@ static int drm_cpu_valid(void)
 }
 
 /**
+ * drm_new_set_master - Allocate a new master object and become master for the
+ * associated master realm.
+ *
+ * @dev: The associated device.
+ * @fpriv: File private identifying the client.
+ *
+ * This function must be called with dev::struct_mutex held.
+ * Returns negative error code on failure. Zero on success.
+ */
+int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
+{
+	struct drm_master *old_master;
+	int ret;
+
+	lockdep_assert_held_once(&dev->master_mutex);
+
+	/* create a new master */
+	fpriv->minor->master = drm_master_create(fpriv->minor);
+	if (!fpriv->minor->master)
+		return -ENOMEM;
+
+	/* take another reference for the copy in the local file priv */
+	old_master = fpriv->master;
+	fpriv->master = drm_master_get(fpriv->minor->master);
+
+	if (dev->driver->master_create) {
+		ret = dev->driver->master_create(dev, fpriv->master);
+		if (ret)
+			goto out_err;
+	}
+	if (dev->driver->master_set) {
+		ret = dev->driver->master_set(dev, fpriv, true);
+		if (ret)
+			goto out_err;
+	}
+
+	fpriv->is_master = 1;
+	fpriv->allowed_master = 1;
+	fpriv->authenticated = 1;
+	if (old_master)
+		drm_master_put(&old_master);
+
+	return 0;
+
+out_err:
+	/* drop both references and restore old master on failure */
+	drm_master_put(&fpriv->minor->master);
+	drm_master_put(&fpriv->master);
+	fpriv->master = old_master;
+
+	return ret;
+}
+
+/**
  * Called whenever a process opens /dev/drm.
  *
  * \param filp file pointer.
@@ -231,35 +285,9 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
 	mutex_lock(&dev->master_mutex);
 	if (drm_is_primary_client(priv) && !priv->minor->master) {
 		/* create a new master */
-		priv->minor->master = drm_master_create(priv->minor);
-		if (!priv->minor->master) {
-			ret = -ENOMEM;
+		ret = drm_new_set_master(dev, priv);
+		if (ret)
 			goto out_close;
-		}
-
-		priv->is_master = 1;
-		/* take another reference for the copy in the local file priv */
-		priv->master = drm_master_get(priv->minor->master);
-		priv->authenticated = 1;
-
-		if (dev->driver->master_create) {
-			ret = dev->driver->master_create(dev, priv->master);
-			if (ret) {
-				/* drop both references if this fails */
-				drm_master_put(&priv->minor->master);
-				drm_master_put(&priv->master);
-				goto out_close;
-			}
-		}
-		if (dev->driver->master_set) {
-			ret = dev->driver->master_set(dev, priv, true);
-			if (ret) {
-				/* drop both references if this fails */
-				drm_master_put(&priv->minor->master);
-				drm_master_put(&priv->master);
-				goto out_close;
-			}
-		}
 	} else if (drm_is_primary_client(priv)) {
 		/* get a reference to the master */
 		priv->master = drm_master_get(priv->minor->master);
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 14d16464000a..ce2269d00b32 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -202,6 +202,11 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
 		goto out_unlock;
 	}
 
+	if (!file_priv->allowed_master) {
+		ret = drm_new_set_master(dev, file_priv);
+		goto out_unlock;
+	}
+
 	file_priv->minor->master = drm_master_get(file_priv->master);
 	file_priv->is_master = 1;
 	if (dev->driver->master_set) {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8af71a8e2c00..6eec68c9b459 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -407,6 +407,11 @@ struct drm_file {
 	 * in the plane list
 	 */
 	unsigned universal_planes:1;
+	/*
+	 * This client is allowed to gain master privileges for @master.
+	 * Protected by struct drm_device::master_mutex.
+	 */
+	unsigned allowed_master:1;
 
 	struct pid *pid;
 	kuid_t uid;
@@ -1219,6 +1224,7 @@ extern int drm_stub_open(struct inode *inode, struct file *filp);
 extern ssize_t drm_read(struct file *filp, char __user *buffer,
 			size_t count, loff_t *offset);
 extern int drm_release(struct inode *inode, struct file *filp);
+extern int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv);
 
 				/* Mapping support (drm_vm.h) */
 extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 115/126] sched/core: Clear the root_domain cpumasks in init_rootdomain()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 114/126] drm: Fix an unwanted master inheritance v2 Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 116/126] x86/signal: Fix restart_syscall number for x32 tasks Luis Henriques
                   ` (10 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Xunlei Pang, Peter Zijlstra (Intel),
	Linus Torvalds, Mike Galbraith, Steven Rostedt, Thomas Gleixner,
	Ingo Molnar, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Xunlei Pang <xlpang@redhat.com>

commit 8295c69925ad53ec32ca54ac9fc194ff21bc40e2 upstream.

root_domain::rto_mask allocated through alloc_cpumask_var()
contains garbage data, this may cause problems. For instance,
When doing pull_rt_task(), it may do useless iterations if
rto_mask retains some extra garbage bits. Worse still, this
violates the isolated domain rule for clustered scheduling
using cpuset, because the tasks(with all the cpus allowed)
belongs to one root domain can be pulled away into another
root domain.

The patch cleans the garbage by using zalloc_cpumask_var()
instead of alloc_cpumask_var() for root_domain::rto_mask
allocation, thereby addressing the issues.

Do the same thing for root_domain's other cpumask memembers:
dlo_mask, span, and online.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1449057179-29321-1-git-send-email-xlpang@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/sched/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c80729679806..0417f4b1a5f3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5486,13 +5486,13 @@ static int init_rootdomain(struct root_domain *rd)
 {
 	memset(rd, 0, sizeof(*rd));
 
-	if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL))
 		goto out;
-	if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL))
 		goto free_span;
-	if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL))
 		goto free_online;
-	if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
 		goto free_dlo_mask;
 
 	init_dl_bw(&rd->dl_bw);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 116/126] x86/signal: Fix restart_syscall number for x32 tasks
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 115/126] sched/core: Clear the root_domain cpumasks in init_rootdomain() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 117/126] isdn: Partially revert debug format string usage clean up Luis Henriques
                   ` (9 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry V. Levin, Elvira Khabirova, Thomas Gleixner, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Dmitry V. Levin" <ldv@altlinux.org>

commit 22eab1108781eff09961ae7001704f7bd8fb1dce upstream.

When restarting a syscall with regs->ax == -ERESTART_RESTARTBLOCK,
regs->ax is assigned to a restart_syscall number.  For x32 tasks, this
syscall number must have __X32_SYSCALL_BIT set, otherwise it will be
an x86_64 syscall number instead of a valid x32 syscall number. This
issue has been there since the introduction of x32.

Reported-by: strace/tests/restart_syscall.test
Reported-and-tested-by: Elvira Khabirova <lineprinter0@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: Elvira Khabirova <lineprinter0@gmail.com>
Link: http://lkml.kernel.org/r/20151130215436.GA25996@altlinux.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/signal.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index ed37a768d0fc..11577f53bb53 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -684,12 +684,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 	signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
 }
 
-#ifdef CONFIG_X86_32
-#define NR_restart_syscall	__NR_restart_syscall
-#else /* !CONFIG_X86_32 */
-#define NR_restart_syscall	\
-	test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
-#endif /* CONFIG_X86_32 */
+static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
+{
+#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
+	return __NR_restart_syscall;
+#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
+	return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
+		__NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
+#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
+}
 
 /*
  * Note that 'init' is a special process: it doesn't get signals it doesn't
@@ -718,7 +721,7 @@ static void do_signal(struct pt_regs *regs)
 			break;
 
 		case -ERESTART_RESTARTBLOCK:
-			regs->ax = NR_restart_syscall;
+			regs->ax = get_nr_restart_syscall(regs);
 			regs->ip -= 2;
 			break;
 		}

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 117/126] isdn: Partially revert debug format string usage clean up
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 116/126] x86/signal: Fix restart_syscall number for x32 tasks Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 118/126] remoteproc: avoid stack overflow in debugfs file Luis Henriques
                   ` (8 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Karsten Keil, Christoph Biedl, David S. Miller,
	Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>

commit 19cebbcb04c8277bb8a7905957c8af11967c4e28 upstream.

Commit 35a4a57 ("isdn: clean up debug format string usage") introduced
a safeguard to avoid accidential format string interpolation of data
when calling debugl1 or HiSax_putstatus. This did however not take into
account VHiSax_putstatus (called by HiSax_putstatus) does *not* call
vsprintf if the head parameter is NULL - the format string is treated
as plain text then instead. As a result, the string "%s" is processed
literally, and the actual information is lost. This affects the isdnlog
userspace program which stopped logging information since that commit.

So revert the HiSax_putstatus invocations to the previous state.

Fixes: 35a4a5733b0a ("isdn: clean up debug format string usage")
Cc: Kees Cook <keescook@chromium.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/isdn/hisax/config.c  | 2 +-
 drivers/isdn/hisax/hfc_pci.c | 2 +-
 drivers/isdn/hisax/hfc_sx.c  | 2 +-
 drivers/isdn/hisax/q931.c    | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index b33f53b3ca93..bf04d2a3cf4a 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1896,7 +1896,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
 				ptr--;
 				*ptr++ = '\n';
 				*ptr = 0;
-				HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+				HiSax_putstatus(cs, NULL, cs->dlog);
 			} else
 				HiSax_putstatus(cs, "LogEcho: ",
 						"warning Frame too big (%d)",
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index 4a4825528188..90449e1e91e5 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -901,7 +901,7 @@ Begin:
 					ptr--;
 					*ptr++ = '\n';
 					*ptr = 0;
-					HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+					HiSax_putstatus(cs, NULL, cs->dlog);
 				} else
 					HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3);
 			}
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index fa1fefd711cd..dc4574f735ef 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs)
 					ptr--;
 					*ptr++ = '\n';
 					*ptr = 0;
-					HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+					HiSax_putstatus(cs, NULL, cs->dlog);
 				} else
 					HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len);
 			}
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index b420f8bd862e..ba4beb25d872 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -1179,7 +1179,7 @@ LogFrame(struct IsdnCardState *cs, u_char *buf, int size)
 		dp--;
 		*dp++ = '\n';
 		*dp = 0;
-		HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+		HiSax_putstatus(cs, NULL, cs->dlog);
 	} else
 		HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
 }
@@ -1246,7 +1246,7 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
 	}
 	if (finish) {
 		*dp = 0;
-		HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+		HiSax_putstatus(cs, NULL, cs->dlog);
 		return;
 	}
 	if ((0xfe & buf[0]) == PROTO_DIS_N0) {	/* 1TR6 */
@@ -1509,5 +1509,5 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
 		dp += sprintf(dp, "Unknown protocol %x!", buf[0]);
 	}
 	*dp = 0;
-	HiSax_putstatus(cs, NULL, "%s", cs->dlog);
+	HiSax_putstatus(cs, NULL, cs->dlog);
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 118/126] remoteproc: avoid stack overflow in debugfs file
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 117/126] isdn: Partially revert debug format string usage clean up Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 119/126] net: mvneta: add configuration for MBUS windows access protection Luis Henriques
                   ` (7 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Ohad Ben-Cohen, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 92792e48e2ae6051af30468a87994b5432da2f06 upstream.

Recent gcc versions warn about reading from a negative offset of
an on-stack array:

drivers/remoteproc/remoteproc_debugfs.c: In function 'rproc_recovery_write':
drivers/remoteproc/remoteproc_debugfs.c:167:9: warning: 'buf[4294967295u]' may be used uninitialized in this function [-Wmaybe-uninitialized]

I don't see anything in sys_write() that prevents us from
being called with a zero 'count' argument, so we should
add an extra check in rproc_recovery_write() to prevent the
access and avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 2e37abb89a2e ("remoteproc: create a 'recovery' debugfs entry")
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/remoteproc/remoteproc_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
index 9d30809bb407..916af5096f57 100644
--- a/drivers/remoteproc/remoteproc_debugfs.c
+++ b/drivers/remoteproc/remoteproc_debugfs.c
@@ -156,7 +156,7 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf,
 	char buf[10];
 	int ret;
 
-	if (count > sizeof(buf))
+	if (count < 1 || count > sizeof(buf))
 		return count;
 
 	ret = copy_from_user(buf, user_buf, count);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 119/126] net: mvneta: add configuration for MBUS windows access protection
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 118/126] remoteproc: avoid stack overflow in debugfs file Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 120/126] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Luis Henriques
                   ` (6 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Wojtas, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Wojtas <mw@semihalf.com>

commit db6ba9a5371f173489df126739d0a1c2a50f347b upstream.

This commit adds missing configuration of MBUS windows access protection
in mvneta_conf_mbus_windows function - a dedicated variable for that
purpose remained there unused since v3.8 initial mvneta support. Because
of that the register contents were inherited from the bootloader.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index b6de763afef0..572e203d28be 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -60,6 +60,7 @@
 #define MVNETA_WIN_SIZE(w)                      (0x2204 + ((w) << 3))
 #define MVNETA_WIN_REMAP(w)                     (0x2280 + ((w) << 2))
 #define MVNETA_BASE_ADDR_ENABLE                 0x2290
+#define MVNETA_ACCESS_PROTECT_ENABLE            0x2294
 #define MVNETA_PORT_CONFIG                      0x2400
 #define      MVNETA_UNI_PROMISC_MODE            BIT(0)
 #define      MVNETA_DEF_RXQ(q)                  ((q) << 1)
@@ -2898,6 +2899,7 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
 	}
 
 	mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
+	mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
 }
 
 /* Power up the port */

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 120/126] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 119/126] net: mvneta: add configuration for MBUS windows access protection Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 121/126] net: mvneta: fix bit assignment for RX packet irq enable Luis Henriques
                   ` (5 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Wojtas, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Wojtas <mw@semihalf.com>

commit e5bdf689d32fcf3aaf548c71e715b303ba20b5d1 upstream.

MVNETA_RXQ_HW_BUF_ALLOC bit which controls enabling hardware buffer
allocation was mistakenly set as BIT(1). This commit fixes the assignment.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 572e203d28be..798f9c78a83f 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -34,7 +34,7 @@
 
 /* Registers */
 #define MVNETA_RXQ_CONFIG_REG(q)                (0x1400 + ((q) << 2))
-#define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(1)
+#define      MVNETA_RXQ_HW_BUF_ALLOC            BIT(0)
 #define      MVNETA_RXQ_PKT_OFFSET_ALL_MASK     (0xf    << 8)
 #define      MVNETA_RXQ_PKT_OFFSET_MASK(offs)   ((offs) << 8)
 #define MVNETA_RXQ_THRESHOLD_REG(q)             (0x14c0 + ((q) << 2))

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 121/126] net: mvneta: fix bit assignment for RX packet irq enable
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 120/126] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 122/126] ipv4: igmp: Allow removing groups from a removed interface Luis Henriques
                   ` (4 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Wojtas, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Wojtas <mw@semihalf.com>

commit dc1aadf6f1e7609590fadf7a0252413732289b2e upstream.

A value originally defined in the driver was inappropriate. Even though
the ingress was somehow working, writing MVNETA_RXQ_INTR_ENABLE_ALL_MASK
to MVNETA_INTR_ENABLE didn't make any effect, because the bits [31:16]
are reserved and read-only.

This commit updates MVNETA_RXQ_INTR_ENABLE_ALL_MASK to be compliant with
the controller's documentation.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network
unit")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 798f9c78a83f..0830d23f01ae 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -153,7 +153,7 @@
 
 #define MVNETA_INTR_ENABLE                       0x25b8
 #define      MVNETA_TXQ_INTR_ENABLE_ALL_MASK     0x0000ff00
-#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0xff000000  // note: neta says it's 0x000000FF
+#define      MVNETA_RXQ_INTR_ENABLE_ALL_MASK     0x000000ff
 
 #define MVNETA_RXQ_CMD                           0x2680
 #define      MVNETA_RXQ_DISABLE_SHIFT            8

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 122/126] ipv4: igmp: Allow removing groups from a removed interface
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 121/126] net: mvneta: fix bit assignment for RX packet irq enable Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 123/126] sched/core: Remove false-positive warning from wake_up_process() Luis Henriques
                   ` (3 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrew Lunn, David S. Miller, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrew Lunn <andrew@lunn.ch>

commit 4eba7bb1d72d9bde67d810d09bf62dc207b63c5c upstream.

When a multicast group is joined on a socket, a struct ip_mc_socklist
is appended to the sockets mc_list containing information about the
joined group.

If the interface is hot unplugged, this entry becomes stale. Prior to
commit 52ad353a5344f ("igmp: fix the problem when mc leave group") it
was possible to remove the stale entry by performing a
IP_DROP_MEMBERSHIP, passing either the old ifindex or ip address on
the interface. However, this fix enforces that the interface must
still exist. Thus with time, the number of stale entries grows, until
sysctl_igmp_max_memberships is reached and then it is not possible to
join and more groups.

The previous patch fixes an issue where a IP_DROP_MEMBERSHIP is
performed without specifying the interface, either by ifindex or ip
address. However here we do supply one of these. So loosen the
restriction on device existence to only apply when the interface has
not been specified. This then restores the ability to clean up the
stale entries.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 52ad353a5344f "(igmp: fix the problem when mc leave group")
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/igmp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index fbb230ea039a..719c3d707327 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1943,7 +1943,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
 
 	rtnl_lock();
 	in_dev = ip_mc_find_dev(net, imr);
-	if (!in_dev) {
+	if (!imr->imr_ifindex && !imr->imr_address.s_addr && !in_dev) {
 		ret = -ENODEV;
 		goto out;
 	}
@@ -1964,7 +1964,8 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
 
 		*imlp = iml->next_rcu;
 
-		ip_mc_dec_group(in_dev, group);
+		if (in_dev)
+			ip_mc_dec_group(in_dev, group);
 		rtnl_unlock();
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 123/126] sched/core: Remove false-positive warning from wake_up_process()
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 122/126] ipv4: igmp: Allow removing groups from a removed interface Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 124/126] btrfs: fix signed overflows in btrfs_sync_file Luis Henriques
                   ` (2 subsequent siblings)
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sasha Levin, Peter Zijlstra (Intel),
	Mike Galbraith, Thomas Gleixner, oleg, Ingo Molnar,
	Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sasha Levin <sasha.levin@oracle.com>

commit 119d6f6a3be8b424b200dcee56e74484d5445f7e upstream.

Because wakeups can (fundamentally) be late, a task might not be in
the expected state. Therefore testing against a task's state is racy,
and can yield false positives.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: oleg@redhat.com
Fixes: 9067ac85d533 ("wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task")
Link: http://lkml.kernel.org/r/1448933660-23082-1-git-send-email-sasha.levin@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0417f4b1a5f3..c49c16c405b7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1772,7 +1772,6 @@ out:
  */
 int wake_up_process(struct task_struct *p)
 {
-	WARN_ON(task_is_stopped_or_traced(p));
 	return try_to_wake_up(p, TASK_NORMAL, 0);
 }
 EXPORT_SYMBOL(wake_up_process);

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 124/126] btrfs: fix signed overflows in btrfs_sync_file
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 123/126] sched/core: Remove false-positive warning from wake_up_process() Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 125/126] KEYS: Fix race between read and revoke Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 126/126] KVM: x86: Reload pit counters for all channels when restoring state Luis Henriques
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Sterba, Chris Mason, Kamal Mostafa, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Sterba <dsterba@suse.com>

commit 9dcbeed4d7e11e1dcf5e55475de3754f0855d1c2 upstream.

The calculation of range length in btrfs_sync_file leads to signed
overflow. This was caught by PaX gcc SIZE_OVERFLOW plugin.

https://forums.grsecurity.net/viewtopic.php?f=1&t=4284

The fsync call passes 0 and LLONG_MAX, the range length does not fit to
loff_t and overflows, but the value is converted to u64 so it silently
works as expected.

The minimal fix is a typecast to u64, switching functions to take
(start, end) instead of (start, len) would be more intrusive.

Coccinelle script found that there's one more opencoded calculation of
the length.

<smpl>
@@
loff_t start, end;
@@
* end - start
</smpl>

Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
[ kamal: backport to 3.13-stable: use len in both btrfs_wait_ordered_range
  calls, like
  b659ef0 Btrfs: avoid syncing log in the fast fsync path when not necessary ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/file.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 7a71c7885835..8d60cf519578 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1868,7 +1868,13 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	struct btrfs_log_ctx ctx;
 	int ret = 0;
 	bool full_sync = 0;
+	u64 len;
 
+	/*
+	 * The range length can be represented by u64, we have to do the typecasts
+	 * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
+	 */
+	len = (u64)end - (u64)start + 1;
 	trace_btrfs_sync_file(file, datasync);
 
 	/*
@@ -1896,7 +1902,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
 			     &BTRFS_I(inode)->runtime_flags);
 	if (full_sync) {
-		ret = btrfs_wait_ordered_range(inode, start, end - start + 1);
+		ret = btrfs_wait_ordered_range(inode, start, len);
 		if (ret) {
 			mutex_unlock(&inode->i_mutex);
 			goto out;
@@ -2001,8 +2007,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 			}
 		}
 		if (!full_sync) {
-			ret = btrfs_wait_ordered_range(inode, start,
-						       end - start + 1);
+			ret = btrfs_wait_ordered_range(inode, start, len);
 			if (ret) {
 				btrfs_end_transaction(trans, root);
 				goto out;

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 125/126] KEYS: Fix race between read and revoke
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 124/126] btrfs: fix signed overflows in btrfs_sync_file Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 126/126] KVM: x86: Reload pit counters for all channels when restoring state Luis Henriques
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Howells, James Morris, Moritz Muehlenhoff, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Howells <dhowells@redhat.com>

commit b4a1b4f5047e4f54e194681125c74c0aa64d637d upstream.

This fixes CVE-2015-7550.

There's a race between keyctl_read() and keyctl_revoke().  If the revoke
happens between keyctl_read() checking the validity of a key and the key's
semaphore being taken, then the key type read method will see a revoked key.

This causes a problem for the user-defined key type because it assumes in
its read method that there will always be a payload in a non-revoked key
and doesn't check for a NULL pointer.

Fix this by making keyctl_read() check the validity of a key after taking
semaphore instead of before.

I think the bug was introduced with the original keyrings code.

This was discovered by a multithreaded test program generated by syzkaller
(http://github.com/google/syzkaller).  Here's a cleaned up version:

	#include <sys/types.h>
	#include <keyutils.h>
	#include <pthread.h>
	void *thr0(void *arg)
	{
		key_serial_t key = (unsigned long)arg;
		keyctl_revoke(key);
		return 0;
	}
	void *thr1(void *arg)
	{
		key_serial_t key = (unsigned long)arg;
		char buffer[16];
		keyctl_read(key, buffer, 16);
		return 0;
	}
	int main()
	{
		key_serial_t key = add_key("user", "%", "foo", 3, KEY_SPEC_USER_KEYRING);
		pthread_t th[5];
		pthread_create(&th[0], 0, thr0, (void *)(unsigned long)key);
		pthread_create(&th[1], 0, thr1, (void *)(unsigned long)key);
		pthread_create(&th[2], 0, thr0, (void *)(unsigned long)key);
		pthread_create(&th[3], 0, thr1, (void *)(unsigned long)key);
		pthread_join(th[0], 0);
		pthread_join(th[1], 0);
		pthread_join(th[2], 0);
		pthread_join(th[3], 0);
		return 0;
	}

Build as:

	cc -o keyctl-race keyctl-race.c -lkeyutils -lpthread

Run as:

	while keyctl-race; do :; done

as it may need several iterations to crash the kernel.  The crash can be
summarised as:

	BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
	IP: [<ffffffff81279b08>] user_read+0x56/0xa3
	...
	Call Trace:
	 [<ffffffff81276aa9>] keyctl_read_key+0xb6/0xd7
	 [<ffffffff81277815>] SyS_keyctl+0x83/0xe0
	 [<ffffffff815dbb97>] entry_SYSCALL_64_fastpath+0x12/0x6f

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Cc: Moritz Muehlenhoff <jmm@inutil.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 security/keys/keyctl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index cd5bd0cef25d..3553f197789b 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -744,16 +744,16 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
 
 	/* the key is probably readable - now try to read it */
 can_read_key:
-	ret = key_validate(key);
-	if (ret == 0) {
-		ret = -EOPNOTSUPP;
-		if (key->type->read) {
-			/* read the data with the semaphore held (since we
-			 * might sleep) */
-			down_read(&key->sem);
+	ret = -EOPNOTSUPP;
+	if (key->type->read) {
+		/* Read the data with the semaphore held (since we might sleep)
+		 * to protect against the key being updated or revoked.
+		 */
+		down_read(&key->sem);
+		ret = key_validate(key);
+		if (ret == 0)
 			ret = key->type->read(key, buffer, buflen);
-			up_read(&key->sem);
-		}
+		up_read(&key->sem);
 	}
 
 error2:

^ permalink raw reply related	[flat|nested] 128+ messages in thread

* [PATCH 3.16.y-ckt 126/126] KVM: x86: Reload pit counters for all channels when restoring state
  2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2016-01-06 10:37 ` [PATCH 3.16.y-ckt 125/126] KEYS: Fix race between read and revoke Luis Henriques
@ 2016-01-06 10:37 ` Luis Henriques
  125 siblings, 0 replies; 128+ messages in thread
From: Luis Henriques @ 2016-01-06 10:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Honig, Paolo Bonzini, Moritz Muehlenhoff, Luis Henriques

3.16.7-ckt22 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrew Honig <ahonig@google.com>

commit 0185604c2d82c560dab2f2933a18f797e74ab5a8 upstream.

Currently if userspace restores the pit counters with a count of 0
on channels 1 or 2 and the guest attempts to read the count on those
channels, then KVM will perform a mod of 0 and crash.  This will ensure
that 0 values are converted to 65536 as per the spec.

This is CVE-2015-7513.

Signed-off-by: Andy Honig <ahonig@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Moritz Muehlenhoff <jmm@inutil.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/x86.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4977c1a93d52..e336615e0aae 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3559,10 +3559,12 @@ static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps)
 static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps)
 {
 	int r = 0;
+	int i;
 
 	mutex_lock(&kvm->arch.vpit->pit_state.lock);
 	memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state));
-	kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0);
+	for (i = 0; i < 3; i++)
+		kvm_pit_load_count(kvm, i, ps->channels[i].count, 0);
 	mutex_unlock(&kvm->arch.vpit->pit_state.lock);
 	return r;
 }
@@ -3583,6 +3585,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
 static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
 {
 	int r = 0, start = 0;
+	int i;
 	u32 prev_legacy, cur_legacy;
 	mutex_lock(&kvm->arch.vpit->pit_state.lock);
 	prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;
@@ -3592,7 +3595,8 @@ static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
 	memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,
 	       sizeof(kvm->arch.vpit->pit_state.channels));
 	kvm->arch.vpit->pit_state.flags = ps->flags;
-	kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start);
+	for (i = 0; i < 3; i++)
+		kvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start);
 	mutex_unlock(&kvm->arch.vpit->pit_state.lock);
 	return r;
 }

^ permalink raw reply related	[flat|nested] 128+ messages in thread

end of thread, other threads:[~2016-01-06 11:19 UTC | newest]

Thread overview: 128+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 10:35 [3.16.y-ckt stable] Linux 3.16.7-ckt22 stable review Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 001/126] iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 002/126] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 003/126] iio: ad5064: Fix ad5629/ad5669 shift Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 004/126] iio:ad7793: Fix ad7785 product ID Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 005/126] x86/fpu: Fix 32-bit signal frame handling Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 006/126] iio: adc: xilinx: Fix VREFN scale Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 007/126] drm/i915: quirk backlight present on Macbook 4, 1 Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 008/126] USB: qcserial: Add support for Quectel EC20 Mini PCIe module Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 009/126] USB: serial: option: add support for Novatel MiFi USB620L Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 010/126] USB: ti_usb_3410_5052: Add Honeywell HGI80 ID Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 011/126] drm/i915: get runtime PM reference around GEM set_caching IOCTL Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 012/126] drm/radeon: unconditionally set sysfs_initialized Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 013/126] USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 014/126] arm64: kernel: pause/unpause function graph tracer in cpu_suspend() Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 015/126] usb: dwc3: gadget: let us set lower max_speed Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 016/126] usb: chipidea: debug: disable usb irq while role switch Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 017/126] xhci: Workaround to get Intel xHCI reset working more reliably Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 018/126] xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 019/126] x86/cpu: Fix SMAP check in PVOPS environments Luis Henriques
2016-01-06 10:35   ` Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 020/126] arm64: restore bogomips information in /proc/cpuinfo Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 021/126] USB: option: add XS Stick W100-2 from 4G Systems Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 022/126] usblp: do not set TASK_INTERRUPTIBLE before lock Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 023/126] fat: fix fake_offset handling on error path Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 024/126] kernel/signal.c: unexport sigsuspend() Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 025/126] ocfs2: fix umask ignored issue Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 026/126] parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 027/126] mmc: remove bondage between REQ_META and reliable write Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 028/126] tools/net: Use include/uapi with __EXPORTED_HEADERS__ Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 029/126] packet: do skb_probe_transport_header when we actually have data Luis Henriques
2016-01-06 10:35 ` [PATCH 3.16.y-ckt 030/126] packet: only allow extra vlan len on ethernet devices Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 031/126] packet: fix tpacket_snd max frame len Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 032/126] sctp: translate host order to network order when setting a hmacid Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 033/126] net/mlx4_core: Avoid returning success in case of an error flow Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 034/126] usb: musb: core: fix order of arguments to ulpi write callback Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 035/126] FS-Cache: Add missing initialization of ret in cachefiles_write_page() Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 036/126] macvlan: fix leak in macvlan_handle_frame Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 037/126] ARC: Fix silly typo in MAINTAINERS file Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 038/126] unix: avoid use-after-free in ep_remove_wait_queue Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 039/126] packet: always probe for transport header Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 040/126] packet: infer protocol from ethernet header if unset Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 041/126] ip_tunnel: disable preemption when updating per-cpu tstats Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 042/126] snmp: Remove duplicate OUTMCAST stat increment Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 043/126] net: qmi_wwan: add XS Stick W100-2 from 4G Systems Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 044/126] tcp: md5: fix lockdep annotation Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 045/126] tcp: initialize tp->copied_seq in case of cross SYN connection Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 046/126] net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 047/126] net: ipmr: fix static mfc/dev leaks on table destruction Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 048/126] net: ip6mr: " Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 049/126] broadcom: fix PHY_ID_BCM5481 entry in the id table Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 050/126] ipv6: distinguish frag queues by device for multicast and link-local packets Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 051/126] ipv6: add complete rcu protection around np->opt Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 052/126] net/neighbour: fix crash at dumping device-agnostic proxy entries Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 053/126] ipv6: sctp: implement sctp_v6_destroy_sock() Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 054/126] xfs: allow inode allocations in post-growfs disk space Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 055/126] ALSA: usb-audio: add packet size quirk for the Medeli DD305 Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 056/126] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 057/126] ALSA: usb-audio: work around CH345 input " Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 058/126] dm thin: restore requested 'error_if_no_space' setting on OODS to WRITE transition Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 059/126] dm: fix ioctl retry termination with signal Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 060/126] MIPS: KVM: Fix ASID restoration logic Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 061/126] MIPS: KVM: Fix CACHE immediate offset sign extension Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 062/126] MIPS: KVM: Uninit VCPU in vcpu_create error path Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 063/126] ALSA: hda - Add fixup for Acer Aspire One Cloudbook 14 Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 064/126] mac: validate mac_partition is within sector Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 065/126] ALSA: hda - Apply HP headphone fixups more generically Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 066/126] powerpc/tm: Block signal return setting invalid MSR state Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 067/126] powerpc/tm: Check for already reclaimed tasks Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 068/126] ARC: dw2 unwind: Remove falllback linear search thru FDE entries Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 069/126] fix sysvfs symlinks Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 070/126] vfs: Make sendfile(2) killable even better Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 071/126] vfs: Avoid softlockups with sendfile(2) Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 072/126] nfs4: start callback_ident at idr 1 Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 073/126] ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3 Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 074/126] arm64: KVM: Fix AArch32 to AArch64 register mapping Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 075/126] drm/radeon: make rv770_set_sw_state failures non-fatal Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 076/126] ALSA: hda - Fix noise on Gigabyte Z170X mobo Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 077/126] drm/radeon: make some dpm errors debug only Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 078/126] nfs: if we have no valid attrs, then don't declare the attribute cache valid Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 079/126] xen/gntdev: Grant maps should not be subject to NUMA balancing Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 080/126] iscsi-target: Fix rx_login_comp hang after login failure Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 081/126] target: Fix race for SCF_COMPARE_AND_WRITE_POST checking Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 082/126] target: fix COMPARE_AND_WRITE non zero SGL offset data corruption Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 083/126] ARM: dts: Kirkwood: Fix QNAP TS219 power-off Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 084/126] netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 085/126] netfilter: nf_tables: fix bogus warning in nft_data_uninit() Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 086/126] netfilter: ip6t_SYNPROXY: fix NULL pointer dereference Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 087/126] RDS: fix race condition when sending a message on unbound socket Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 088/126] gre6: allow to update all parameters via rtnl Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 089/126] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation Luis Henriques
2016-01-06 10:36 ` [PATCH 3.16.y-ckt 090/126] sctp: use the same clock as if sock source timestamps were on Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 091/126] sctp: update the netstamp_needed counter when copying sockets Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 092/126] ipv6: sctp: clone options to avoid use after free Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 093/126] net: add validation for the socket syscall protocol argument Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 094/126] sh_eth: fix kernel oops in skb_put() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 095/126] vlan: Fix untag operations of stacked vlans with REORDER_HEADER off Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 096/126] skbuff: Fix offset error in skb_reorder_vlan_header Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 097/126] pptp: verify sockaddr_len in pptp_bind() and pptp_connect() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 098/126] bluetooth: Validate socket address length in sco_sock_bind() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 099/126] af_unix: Revert 'lock_interruptible' in stream receive code Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 100/126] ip6mr: call del_timer_sync() in ip6mr_free_table() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 101/126] drm/i915: Disable PSMI sleep messages on all rings around context switches Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 102/126] crypto: nx - Fix timing leak in GCM and CCM decryption Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 103/126] crypto: talitos - Fix timing leak in ESP ICV verification Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 104/126] ASoC: wm8962: correct addresses for HPF_C_0/1 Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 105/126] mac80211: mesh: fix call_rcu() usage Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 106/126] mac80211: ensure we don't update tx power on a non-running sdata Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 107/126] can: sja1000: clear interrupts on start Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 108/126] ring-buffer: Update read stamp with first real commit on page Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 109/126] block: Always check queue limits for cloned requests Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 110/126] Fix a memory leak in scsi_host_dev_release() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 111/126] wan/x25: Fix use-after-free in x25_asy_open_tty() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 112/126] mac80211: do not actively scan DFS channels Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 113/126] locking: Add WARN_ON_ONCE lock assertion Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 114/126] drm: Fix an unwanted master inheritance v2 Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 115/126] sched/core: Clear the root_domain cpumasks in init_rootdomain() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 116/126] x86/signal: Fix restart_syscall number for x32 tasks Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 117/126] isdn: Partially revert debug format string usage clean up Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 118/126] remoteproc: avoid stack overflow in debugfs file Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 119/126] net: mvneta: add configuration for MBUS windows access protection Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 120/126] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 121/126] net: mvneta: fix bit assignment for RX packet irq enable Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 122/126] ipv4: igmp: Allow removing groups from a removed interface Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 123/126] sched/core: Remove false-positive warning from wake_up_process() Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 124/126] btrfs: fix signed overflows in btrfs_sync_file Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 125/126] KEYS: Fix race between read and revoke Luis Henriques
2016-01-06 10:37 ` [PATCH 3.16.y-ckt 126/126] KVM: x86: Reload pit counters for all channels when restoring state Luis Henriques

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.