stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review
@ 2015-05-05 20:53 Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute Kamal Mostafa
                   ` (89 more replies)
  0 siblings, 90 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kamal Mostafa

This is the start of the review cycle for the Linux 3.13.11-ckt20 stable kernel.

This version contains 90 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.13.y-review

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

The review period for version 3.13.11-ckt20 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.13.y-ckt extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Kamal

--
 arch/arc/kernel/signal.c                        |   4 +-
 arch/arm64/include/asm/mmu_context.h            |   9 +
 arch/powerpc/platforms/pseries/mobility.c       |  44 ++---
 arch/x86/kernel/reboot.c                        |  10 +
 arch/x86/kvm/lapic.c                            |  18 +-
 arch/x86/kvm/vmx.c                              |   8 +-
 drivers/acpi/processor_idle.c                   |   2 +-
 drivers/block/nbd.c                             |   8 +-
 drivers/dma/edma.c                              |   6 +
 drivers/dma/omap-dma.c                          |   1 +
 drivers/gpu/drm/radeon/radeon_bios.c            |  10 +-
 drivers/iio/accel/bma180.c                      |   2 +-
 drivers/iio/adc/at91_adc.c                      |   5 +-
 drivers/iio/adc/ti_am335x_adc.c                 |   3 +-
 drivers/iio/imu/adis_trigger.c                  |   2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c      |  25 +--
 drivers/iio/industrialio-core.c                 |   5 +-
 drivers/iio/industrialio-event.c                |   1 +
 drivers/infiniband/core/umem.c                  |   8 +
 drivers/input/mouse/psmouse-base.c              |  14 ++
 drivers/input/mouse/psmouse.h                   |   1 +
 drivers/input/mouse/synaptics.c                 | 241 +++++++++++++-----------
 drivers/input/serio/i8042-x86ia64io.h           |  15 ++
 drivers/input/serio/i8042.c                     |   6 +
 drivers/input/serio/serio.c                     |  14 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   2 +-
 drivers/media/platform/sh_veu.c                 |   1 +
 drivers/mfd/kempld-core.c                       |   2 +-
 drivers/net/bonding/bond_3ad.c                  |   2 +-
 drivers/net/bonding/bond_alb.c                  |   2 +-
 drivers/net/bonding/bond_main.c                 |  10 +-
 drivers/net/can/flexcan.c                       |  11 +-
 drivers/net/ethernet/amd/pcnet32.c              |  31 ++-
 drivers/net/ethernet/broadcom/bnx2.c            |   6 +-
 drivers/net/ethernet/broadcom/tg3.c             |  14 +-
 drivers/net/ethernet/emulex/benet/be_main.c     |   2 +-
 drivers/net/ethernet/freescale/gianfar.c        |   4 +-
 drivers/net/ethernet/intel/ixgb/ixgb_main.c     |   6 +-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |  15 +-
 drivers/net/ethernet/realtek/8139cp.c           |   2 +-
 drivers/net/ethernet/realtek/8139too.c          |   4 +-
 drivers/net/ethernet/realtek/r8169.c            |   6 +-
 drivers/net/wireless/iwlwifi/dvm/dev.h          |   1 -
 drivers/net/wireless/iwlwifi/dvm/ucode.c        |   5 -
 drivers/net/xen-netfront.c                      |   5 +-
 drivers/pci/hotplug/cpci_hotplug_pci.c          |   3 +-
 drivers/scsi/be2iscsi/be_main.c                 |   2 +-
 drivers/scsi/scsi_lib.c                         |   4 +-
 drivers/spi/spi.c                               |   5 +-
 drivers/target/iscsi/iscsi_target.c             |   2 +-
 drivers/tty/n_tty.c                             | 143 +++++++++-----
 drivers/tty/serial/fsl_lpuart.c                 |   3 +
 drivers/usb/host/xhci-hub.c                     |   9 +-
 drivers/usb/host/xhci-pci.c                     |   2 +-
 drivers/usb/serial/ftdi_sio.c                   |   9 +-
 drivers/usb/serial/ftdi_sio_ids.h               |   6 +
 drivers/usb/serial/keyspan_pda.c                |   3 +
 fs/aio.c                                        |   3 +
 fs/cifs/file.c                                  |   1 +
 fs/cifs/smb2ops.c                               |   3 +-
 fs/exec.c                                       |  76 +++++---
 fs/hfsplus/brec.c                               |  20 +-
 fs/ocfs2/file.c                                 |  14 +-
 include/linux/blk_types.h                       |   4 +-
 include/linux/netdevice.h                       |   6 +
 include/linux/serio.h                           |   1 +
 include/linux/skbuff.h                          |   1 +
 include/net/ip.h                                |  16 --
 include/net/ip6_route.h                         |   3 +-
 include/net/sock.h                              |   2 +
 include/uapi/linux/input.h                      |   1 +
 kernel/events/core.c                            |  10 +
 mm/memory_hotplug.c                             |  13 +-
 mm/mmap.c                                       |   4 +-
 mm/page-writeback.c                             |   7 +-
 mm/rmap.c                                       |   7 +
 net/core/dev.c                                  |   4 +-
 net/core/rtnetlink.c                            |   4 +-
 net/core/skbuff.c                               |  30 ++-
 net/core/sock.c                                 |  19 ++
 net/ipv4/ip_forward.c                           |   3 +
 net/ipv4/ping.c                                 |   1 +
 net/ipv4/tcp_input.c                            |   7 +-
 net/ipv4/tcp_ipv4.c                             |   2 +-
 net/ipv4/tcp_output.c                           |  67 +++++--
 net/ipv6/ip6_output.c                           |   3 +-
 net/ipv6/tcp_ipv6.c                             |   2 +-
 net/mac80211/agg-rx.c                           |   8 +-
 net/mac80211/rx.c                               |   7 +-
 net/mac80211/sta_info.h                         |   2 +
 net/netlink/af_netlink.c                        |   6 +-
 security/selinux/selinuxfs.c                    |   2 +-
 sound/pci/hda/patch_realtek.c                   |  11 ++
 sound/usb/mixer_quirks.c                        |   1 +
 94 files changed, 750 insertions(+), 405 deletions(-)

Al Viro (2):
      ioctx_alloc(): fix vma (and file) leak on failure
      ocfs2: _really_ sync the right range

Ameya Palande (1):
      mfd: kempld-core: Fix callback return value check

Andreas Werner (1):
      can: flexcan: Deferred on Regulator return EPROBE_DEFER

Bart Van Assche (1):
      Defer processing of REQ_PREEMPT requests for blocked devices

Ben Hutchings (1):
      tcp: Fix crash in TCP Fast Open

Ben Sagal (1):
      Input: synaptics - adjust min/max on Thinkpad E540

Benjamin Tissoires (1):
      Input: synaptics - skip quirks when post-2013 dimensions

Catalin Marinas (1):
      arm64: Use the reserved TTBR0 if context switching to the init_mm

Dan Carpenter (1):
      PCI: cpcihp: Add missing curly braces in cpci_configure_slot()

Daniel Martin (4):
      Input: synaptics - split synaptics_resolution(), query first
      Input: synaptics - log queried and quirked dimension values
      Input: synaptics - remove obsolete min/max quirk for X240
      Input: synaptics - support min/max board id in min_max_pnpid_table

Darshana Padmadas (1):
      iio: imu: Use iio_trigger_get for indio_dev->trig assignment

David Disseldorp (1):
      cifs: fix use-after-free bug in find_writable_file

David Miller (1):
      radeon: Do not directly dereference pointers to BIOS area.

David S. Miller (1):
      ipv4: Missing sk_nulls_node_init() in ping_unhash().

Dmitry M. Fedin (1):
      ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support

Doug Goldstein (2):
      USB: ftdi_sio: Added custom PID for Synapse Wireless product
      USB: ftdi_sio: Use jtag quirk for SNAP Connect E10

Emmanuel Grumbach (1):
      iwlwifi: dvm: run INIT firmware again upon .start()

Eric Dumazet (5):
      tcp: tcp_make_synack() should clear skb->tstamp
      tcp: fix possible deadlock in tcp_send_fin()
      tcp: avoid looping in tcp_send_fin()
      net: do not deplete pfmemalloc reserve
      net: fix crash in build_skb()

Eric W. Biederman (9):
      8139cp: Call dev_kfree_skby_any instead of kfree_skb.
      8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.
      r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.
      bonding: Call dev_kfree_skby_any instead of kfree_skb.
      bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb.
      tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.
      ixgb: Call dev_kfree_skby_any instead of dev_kfree_skb.
      benet: Call dev_kfree_skby_any instead of kfree_skb.
      gianfar: Carefully free skbs in functions called by netpoll.

Gu Zheng (1):
      mm/memory hotplug: postpone the reset of obsolete pgdat

Hans Verkuil (1):
      [media] sh_veu: v4l2_dev wasn't set

Hans de Goede (8):
      Input: serio - add firmware_id sysfs attribute
      Input: i8042 - add firmware_id support
      Input: Add INPUT_PROP_TOPBUTTONPAD device property
      Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property
      Input: synaptics - add a matches_pnp_id helper function
      Input: synaptics - change min/max quirk table to pnp-id matching
      Input: psmouse - add psmouse_matches_pnp_id helper function
      Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531)

Ido Shamay (1):
      net/mlx4_en: Call register_netdevice in the proper location

Jann Horn (1):
      fs: take i_mutex during prepare_binprm for set[ug]id executables

Joe Perches (1):
      selinux: fix sel_write_enforce broken return value

Johannes Berg (1):
      mac80211: fix RX A-MPDU session reorder timer deletion

John Soni Jose (1):
      be2iscsi: Fix kernel panic when device initialization fails

Jonathan Davies (1):
      xen-netfront: transmit fully GSO-sized packets

Kailang Yang (1):
      ALSA: hda/realtek - Make more stable to get pin sense for ALC283

Leon Yu (1):
      mm: fix anon_vma->degree underflow in anon_vma endless growing prevention

Lu Baolu (2):
      usb: xhci: handle Config Error Change (CEC) in xhci driver
      usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers

Marek Szyprowski (1):
      [media] media: s5p-mfc: fix mmap support for 64bit arch

Markos Chandras (1):
      net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5}

Martin Fuzzey (1):
      iio: core: Fix double free.

Michal Kubeček (1):
      tcp: prevent fetching dst twice in early demux code

Mike Christie (1):
      iscsi target: fix oops when adding reject pdu

Nadav Amit (1):
      KVM: x86: Fix lost interrupt on irr_pending race

Nathaniel W Filardo (1):
      USB: keyspan_pda: add new device id

Neal Cardwell (1):
      tcp: fix FRTO undo on cumulative ACK of SACKed range

Octavian Purdila (1):
      iio: fix drivers that check buffer->scan_mask

Peter Hurley (2):
      n_tty: Merge .receive_buf() flavors
      n_tty: Fix read buffer overwrite when no newline

Peter Hutterer (1):
      Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd

Peter Ujfalusi (1):
      dmaengine: omap-dma: Fix memory leak when terminating running transfer

Peter Zijlstra (1):
      perf: Fix irq_work 'tail' recursion

Petr Kulhavy (1):
      dmaengine: edma: fix memory leak when terminating running transfers

Radim Krčmář (1):
      KVM: nVMX: mask unrestricted_guest if disabled on L0

Sachin Prabhu (1):
      cifs: smb2_clone_range() - exit on unhandled error

Sebastian Pöhn (1):
      ip_forward: Drop frames with attached skb->sk

Sergei Antonov (1):
      hfsplus: fix B-tree corruption after insertion at position 0

Shachar Raindel (1):
      IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic

Stefan Agner (1):
      tty: serial: fsl_lpuart: clear receive flag on FIFO flush

Stefan Lippers-Hollmann (1):
      x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk

Sudip Mukherjee (1):
      nbd: fix possible memory leak

Takashi Iwai (2):
      Input: synaptics - add min/max quirk for Lenovo T440s
      ALSA: hda - Fix headphone pin config for Lifebook T731

Tejun Heo (2):
      writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
      writeback: fix possible underflow in write bandwidth calculation

Thomas Schlichter (1):
      cpuidle: ACPI: do not overwrite name and description of C0

Tyrel Datwyler (1):
      powerpc/pseries: Little endian fixes for post mobility device tree update

Uwe Kleine-König (1):
      spi: trigger trace event for message-done before mesg->complete

Vineet Gupta (1):
      ARC: SA_SIGINFO ucontext regs off-by-one

Viorel Suman (1):
      iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo

WANG Cong (1):
      net: use for_each_netdev_safe() in rtnl_group_changelink()

hannes@stressinduktion.org (1):
      ipv6: protect skb->sk accesses from recursive dereference inside the stack

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

* [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 02/90] Input: i8042 - add firmware_id support Kamal Mostafa
                   ` (88 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit 0456c66f4e905e1ca839318219c770988b47975c upstream.

serio devices exposed via platform firmware interfaces such as ACPI may
provide additional identifying information of use to userspace.

We don't associate the serio devices with the firmware device (we don't
set it as parent), so there's no way for userspace to make use of this
information.

We cannot change the parent for serio devices instantiated though a
firmware interface as that would break suspend / resume ordering.

Therefore this patch adds a new firmware_id sysfs attribute so that
userspace can get a string from there with any additional identifying
information the firmware interface may provide.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/serio/serio.c | 14 ++++++++++++++
 include/linux/serio.h       |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 8f4c4ab..b29134d 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -451,6 +451,13 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
 	return retval;
 }
 
+static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct serio *serio = to_serio_port(dev);
+
+	return sprintf(buf, "%s\n", serio->firmware_id);
+}
+
 static DEVICE_ATTR_RO(type);
 static DEVICE_ATTR_RO(proto);
 static DEVICE_ATTR_RO(id);
@@ -473,12 +480,14 @@ static DEVICE_ATTR_RO(modalias);
 static DEVICE_ATTR_WO(drvctl);
 static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
 static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
+static DEVICE_ATTR_RO(firmware_id);
 
 static struct attribute *serio_device_attrs[] = {
 	&dev_attr_modalias.attr,
 	&dev_attr_description.attr,
 	&dev_attr_drvctl.attr,
 	&dev_attr_bind_mode.attr,
+	&dev_attr_firmware_id.attr,
 	NULL
 };
 
@@ -921,9 +930,14 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
 	SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
 	SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
 	SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
+
 	SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
 				serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
 
+	if (serio->firmware_id[0])
+		SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s",
+				     serio->firmware_id);
+
 	return 0;
 }
 #undef SERIO_ADD_UEVENT_VAR
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 36aac73..9f779c7 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -23,6 +23,7 @@ struct serio {
 
 	char name[32];
 	char phys[32];
+	char firmware_id[128];
 
 	bool manual_bind;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 02/90] Input: i8042 - add firmware_id support
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 03/90] Input: Add INPUT_PROP_TOPBUTTONPAD device property Kamal Mostafa
                   ` (87 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit a7c5868c3482127cb308c779b8a6460a3353c17f upstream.

Fill in the new serio firmware_id sysfs attribute for pnp instantiated
8042 serio ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/serio/i8042-x86ia64io.h | 15 +++++++++++++++
 drivers/input/serio/i8042.c           |  6 ++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 4de2571..dd6d14d 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -783,6 +783,17 @@ static int i8042_pnp_aux_irq;
 static char i8042_pnp_kbd_name[32];
 static char i8042_pnp_aux_name[32];
 
+static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
+{
+	strlcpy(dst, "PNP:", dst_size);
+
+	while (id) {
+		strlcat(dst, " ", dst_size);
+		strlcat(dst, id->id, dst_size);
+		id = id->next;
+	}
+}
+
 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
 {
 	if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
@@ -799,6 +810,8 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
 		strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
 		strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
 	}
+	i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
+			       sizeof(i8042_kbd_firmware_id));
 
 	/* Keyboard ports are always supposed to be wakeup-enabled */
 	device_set_wakeup_enable(&dev->dev, true);
@@ -823,6 +836,8 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
 		strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
 		strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
 	}
+	i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
+			       sizeof(i8042_aux_firmware_id));
 
 	i8042_pnp_aux_devices++;
 	return 0;
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ff91085..eb796ff 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -91,6 +91,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
 #endif
 
 static bool i8042_bypass_aux_irq_test;
+static char i8042_kbd_firmware_id[128];
+static char i8042_aux_firmware_id[128];
 
 #include "i8042.h"
 
@@ -1232,6 +1234,8 @@ static int __init i8042_create_kbd_port(void)
 	serio->dev.parent	= &i8042_platform_device->dev;
 	strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
 	strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
+	strlcpy(serio->firmware_id, i8042_kbd_firmware_id,
+		sizeof(serio->firmware_id));
 
 	port->serio = serio;
 	port->irq = I8042_KBD_IRQ;
@@ -1258,6 +1262,8 @@ static int __init i8042_create_aux_port(int idx)
 	if (idx < 0) {
 		strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name));
 		strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
+		strlcpy(serio->firmware_id, i8042_aux_firmware_id,
+			sizeof(serio->firmware_id));
 		serio->close = i8042_port_close;
 	} else {
 		snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 03/90] Input: Add INPUT_PROP_TOPBUTTONPAD device property
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 02/90] Input: i8042 - add firmware_id support Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 04/90] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Kamal Mostafa
                   ` (86 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit f37c013409bb78ebb958821aa10d069e707cabac upstream.

On some newer laptops with a trackpoint the physical buttons for the
trackpoint have been removed to allow for a larger touchpad. On these
laptops the buttonpad has clearly marked areas on the top which are to be
used as trackpad buttons.

Users of the event device-node need to know about this, so that they can
properly interpret BTN_LEFT events as being a left / right / middle click
depending on where on the button pad the clicking finger is.

This commits adds a INPUT_PROP_TOPBUTTONPAD device property which drivers
for such buttonpads will use to signal to the user that this buttonpad not
only has the normal bottom button area, but also a top button area.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/uapi/linux/input.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index bd24470..f484952 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -164,6 +164,7 @@ struct input_keymap_entry {
 #define INPUT_PROP_DIRECT		0x01	/* direct input devices */
 #define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
 #define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+#define INPUT_PROP_TOPBUTTONPAD		0x04	/* softbuttons at top of pad */
 
 #define INPUT_PROP_MAX			0x1f
 #define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 04/90] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 03/90] Input: Add INPUT_PROP_TOPBUTTONPAD device property Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 05/90] Input: synaptics - add a matches_pnp_id helper function Kamal Mostafa
                   ` (85 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit 43e19888b1fe2a3e8a5543030c5b286cde38b3f5 upstream.

Check PNP ID of the PS/2 AUX port and report INPUT_PROP_TOPBUTTONPAD
property for for touchpads with top button areas.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 55 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index a9642f5..b9b12f74 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,6 +117,44 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+/* This list has been kindly provided by Synaptics. */
+static const char * const topbuttonpad_pnp_ids[] = {
+	"LEN0017",
+	"LEN0018",
+	"LEN0019",
+	"LEN0023",
+	"LEN002A",
+	"LEN002B",
+	"LEN002C",
+	"LEN002D",
+	"LEN002E",
+	"LEN0033", /* Helix */
+	"LEN0034", /* T431s, T540, X1 Carbon 2nd */
+	"LEN0035", /* X240 */
+	"LEN0036", /* T440 */
+	"LEN0037",
+	"LEN0038",
+	"LEN0041",
+	"LEN0042", /* Yoga */
+	"LEN0045",
+	"LEN0046",
+	"LEN0047",
+	"LEN0048",
+	"LEN0049",
+	"LEN2000",
+	"LEN2001",
+	"LEN2002",
+	"LEN2003",
+	"LEN2004", /* L440 */
+	"LEN2005",
+	"LEN2006",
+	"LEN2007",
+	"LEN2008",
+	"LEN2009",
+	"LEN200A",
+	"LEN200B",
+	NULL
+};
 
 /*****************************************************************************
  *	Synaptics communications functions
@@ -1318,8 +1356,10 @@ static void set_abs_position_params(struct input_dev *dev,
 	input_abs_set_res(dev, y_code, priv->y_res);
 }
 
-static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
+static void set_input_params(struct psmouse *psmouse,
+			     struct synaptics_data *priv)
 {
+	struct input_dev *dev = psmouse->dev;
 	int i;
 
 	/* Things that apply to both modes */
@@ -1388,6 +1428,17 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
+		/* See if this buttonpad has a top button area */
+		if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) {
+			for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
+				if (strstr(psmouse->ps2dev.serio->firmware_id,
+					   topbuttonpad_pnp_ids[i])) {
+					__set_bit(INPUT_PROP_TOPBUTTONPAD,
+						  dev->propbit);
+					break;
+				}
+			}
+		}
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);
 		__clear_bit(BTN_MIDDLE, dev->keybit);
@@ -1732,7 +1783,7 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
 		     priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
 		     priv->board_id, priv->firmware_id);
 
-	set_input_params(psmouse->dev, priv);
+	set_input_params(psmouse, priv);
 
 	/*
 	 * Encode touchpad model so that it can be used to set
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 05/90] Input: synaptics - add a matches_pnp_id helper function
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 04/90] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 06/90] Input: synaptics - change min/max quirk table to pnp-id matching Kamal Mostafa
                   ` (84 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit e2f611029b370bb7a04236215ad4b36aa8cb98cd upstream.

This is a preparation patch for simplifying the min/max quirk table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index b9b12f74..2f0723d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	NULL
 };
 
+static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
+{
+	int i;
+
+	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
+		for (i = 0; ids[i]; i++)
+			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
+				return true;
+
+	return false;
+}
+
 /*****************************************************************************
  *	Synaptics communications functions
  ****************************************************************************/
@@ -1428,17 +1440,8 @@ static void set_input_params(struct psmouse *psmouse,
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
-		/* See if this buttonpad has a top button area */
-		if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) {
-			for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
-				if (strstr(psmouse->ps2dev.serio->firmware_id,
-					   topbuttonpad_pnp_ids[i])) {
-					__set_bit(INPUT_PROP_TOPBUTTONPAD,
-						  dev->propbit);
-					break;
-				}
-			}
-		}
+		if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+			__set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);
 		__clear_bit(BTN_MIDDLE, dev->keybit);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 06/90] Input: synaptics - change min/max quirk table to pnp-id matching
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 05/90] Input: synaptics - add a matches_pnp_id helper function Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 07/90] Input: psmouse - add psmouse_matches_pnp_id helper function Kamal Mostafa
                   ` (83 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit 0f68f39c393bc06ac5ccc8794f0e2ed841e41c3e upstream.

Most of the affected models share pnp-ids for the touchpad. So switching
to pnp-ids give us 2 advantages:
1) It shrinks the quirk list
2) It will lower the new quirk addition frequency, ie the recently added W540
   quirk would not have been necessary since it uses the same LEN0034 pnp ids
   as other models already added before it

As an added bonus it actually puts the quirk on the actual psmouse, rather
then on the machine, which is technically more correct.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ kamal: backport to 3.13-stable: context ]
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 149 ++++++++++------------------------------
 1 file changed, 36 insertions(+), 113 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 2f0723d..f2fbc68 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,6 +117,31 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+struct min_max_quirk {
+	const char * const *pnp_ids;
+	int x_min, x_max, y_min, y_max;
+};
+
+static const struct min_max_quirk min_max_pnpid_table[] = {
+	{
+		(const char * const []){"LEN0033", NULL},
+		1024, 5052, 2258, 4832
+	},
+	{
+		(const char * const []){"LEN0035", "LEN0042", NULL},
+		1232, 5710, 1156, 4696
+	},
+	{
+		(const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL},
+		1024, 5112, 2024, 4832
+	},
+	{
+		(const char * const []){"LEN2001", NULL},
+		1024, 5022, 2508, 4832
+	},
+	{ }
+};
+
 /* This list has been kindly provided by Synaptics. */
 static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0017",
@@ -129,7 +154,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN002D",
 	"LEN002E",
 	"LEN0033", /* Helix */
-	"LEN0034", /* T431s, T540, X1 Carbon 2nd */
+	"LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
 	"LEN0035", /* X240 */
 	"LEN0036", /* T440 */
 	"LEN0037",
@@ -142,7 +167,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0048",
 	"LEN0049",
 	"LEN2000",
-	"LEN2001",
+	"LEN2001", /* Edge E431 */
 	"LEN2002",
 	"LEN2003",
 	"LEN2004", /* L440 */
@@ -320,20 +345,20 @@ static int synaptics_identify(struct psmouse *psmouse)
  * Resolution is left zero if touchpad does not support the query
  */
 
-static const int *quirk_min_max;
-
 static int synaptics_resolution(struct psmouse *psmouse)
 {
 	struct synaptics_data *priv = psmouse->private;
 	unsigned char resp[3];
+	int i;
 
-	if (quirk_min_max) {
-		priv->x_min = quirk_min_max[0];
-		priv->x_max = quirk_min_max[1];
-		priv->y_min = quirk_min_max[2];
-		priv->y_max = quirk_min_max[3];
-		return 0;
-	}
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
+		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+			priv->x_min = min_max_pnpid_table[i].x_min;
+			priv->x_max = min_max_pnpid_table[i].x_max;
+			priv->y_min = min_max_pnpid_table[i].y_min;
+			priv->y_max = min_max_pnpid_table[i].y_max;
+			return 0;
+		}
 
 	if (SYN_ID_MAJOR(priv->identity) < 4)
 		return 0;
@@ -1613,102 +1638,6 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
 	{ }
 };
 
-static const struct dmi_system_id min_max_dmi_table[] __initconst = {
-#if defined(CONFIG_DMI)
-	{
-		/* Lenovo ThinkPad Helix */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
-		},
-		.driver_data = (int []){1024, 5052, 2258, 4832},
-	},
-	{
-		/* Lenovo ThinkPad X240 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
-		},
-		.driver_data = (int []){1232, 5710, 1156, 4696},
-	},
-	{
-		/* Lenovo ThinkPad Edge E431 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"),
-		},
-		.driver_data = (int []){1024, 5022, 2508, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T431s */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T440s */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad L440 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad T540p */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad L540 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo ThinkPad W540 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W540"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-	{
-		/* Lenovo Yoga S1 */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
-					"ThinkPad S1 Yoga"),
-		},
-		.driver_data = (int []){1232, 5710, 1156, 4696},
-	},
-	{
-		/* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION,
-					"ThinkPad X1 Carbon 2nd"),
-		},
-		.driver_data = (int []){1024, 5112, 2024, 4832},
-	},
-#endif
-	{ }
-};
-
 static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
 #if defined(CONFIG_DMI) && defined(CONFIG_X86)
 	{
@@ -1723,15 +1652,9 @@ static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
 
 void __init synaptics_module_init(void)
 {
-	const struct dmi_system_id *min_max_dmi;
-
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
 
-	min_max_dmi = dmi_first_match(min_max_dmi_table);
-	if (min_max_dmi)
-		quirk_min_max = min_max_dmi->driver_data;
-
 	/*
 	 * Unfortunately ForcePad capability is not exported over PS/2,
 	 * so we have to resort to checking DMI.
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 07/90] Input: psmouse - add psmouse_matches_pnp_id helper function
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 06/90] Input: synaptics - change min/max quirk table to pnp-id matching Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 08/90] Input: synaptics - split synaptics_resolution(), query first Kamal Mostafa
                   ` (82 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Timo Aaltonen, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit 2c75ada6250990ea859b0b5498cb0b7c2823a9d7 upstream.

The matches_pnp_id function from the synaptics driver is useful for other
drivers too. Make it a generic psmouse helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/psmouse-base.c | 14 ++++++++++++++
 drivers/input/mouse/psmouse.h      |  1 +
 drivers/input/mouse/synaptics.c    | 17 +++--------------
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index cff065f..bc1bc26 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -462,6 +462,20 @@ static int psmouse_poll(struct psmouse *psmouse)
 			   PSMOUSE_CMD_POLL | (psmouse->pktsize << 8));
 }
 
+/*
+ * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids.
+ */
+bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
+{
+	int i;
+
+	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
+		for (i = 0; ids[i]; i++)
+			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
+				return true;
+
+	return false;
+}
 
 /*
  * Genius NetMouse magic init.
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 2f0b39d..f4cf664 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -108,6 +108,7 @@ void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
 psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse);
 int psmouse_activate(struct psmouse *psmouse);
 int psmouse_deactivate(struct psmouse *psmouse);
+bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]);
 
 struct psmouse_attribute {
 	struct device_attribute dattr;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f2fbc68..ea9c84c 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -181,18 +181,6 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	NULL
 };
 
-static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
-{
-	int i;
-
-	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
-		for (i = 0; ids[i]; i++)
-			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
-				return true;
-
-	return false;
-}
-
 /*****************************************************************************
  *	Synaptics communications functions
  ****************************************************************************/
@@ -352,7 +340,8 @@ static int synaptics_resolution(struct psmouse *psmouse)
 	int i;
 
 	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
-		if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+		if (psmouse_matches_pnp_id(psmouse,
+					   min_max_pnpid_table[i].pnp_ids)) {
 			priv->x_min = min_max_pnpid_table[i].x_min;
 			priv->x_max = min_max_pnpid_table[i].x_max;
 			priv->y_min = min_max_pnpid_table[i].y_min;
@@ -1465,7 +1454,7 @@ static void set_input_params(struct psmouse *psmouse,
 
 	if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
 		__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
-		if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+		if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
 			__set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
 		/* Clickpads report only left button */
 		__clear_bit(BTN_RIGHT, dev->keybit);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 08/90] Input: synaptics - split synaptics_resolution(), query first
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 07/90] Input: psmouse - add psmouse_matches_pnp_id helper function Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 09/90] Input: synaptics - log queried and quirked dimension values Kamal Mostafa
                   ` (81 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Daniel Martin <consume.noise@gmail.com>

commit 8b04baba10b007f8b6c245a50be73cf09cc3a414 upstream.

Split the function synaptics_resolution() into synaptics_resolution() and
synaptics_quirks().  synaptics_resolution() will be called before
synaptics_quirks() to query dimensions and resolutions before overwriting
them with quirks.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index ea9c84c..044f411 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -337,17 +337,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
 {
 	struct synaptics_data *priv = psmouse->private;
 	unsigned char resp[3];
-	int i;
-
-	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
-		if (psmouse_matches_pnp_id(psmouse,
-					   min_max_pnpid_table[i].pnp_ids)) {
-			priv->x_min = min_max_pnpid_table[i].x_min;
-			priv->x_max = min_max_pnpid_table[i].x_max;
-			priv->y_min = min_max_pnpid_table[i].y_min;
-			priv->y_max = min_max_pnpid_table[i].y_max;
-			return 0;
-		}
 
 	if (SYN_ID_MAJOR(priv->identity) < 4)
 		return 0;
@@ -390,6 +379,27 @@ static int synaptics_resolution(struct psmouse *psmouse)
 	return 0;
 }
 
+/*
+ * Apply quirk(s) if the hardware matches
+ */
+
+static void synaptics_apply_quirks(struct psmouse *psmouse)
+{
+	struct synaptics_data *priv = psmouse->private;
+	int i;
+
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
+		if (psmouse_matches_pnp_id(psmouse,
+					   min_max_pnpid_table[i].pnp_ids)) {
+			priv->x_min = min_max_pnpid_table[i].x_min;
+			priv->x_max = min_max_pnpid_table[i].x_max;
+			priv->y_min = min_max_pnpid_table[i].y_min;
+			priv->y_max = min_max_pnpid_table[i].y_max;
+			break;
+		}
+	}
+}
+
 static int synaptics_query_hardware(struct psmouse *psmouse)
 {
 	if (synaptics_identify(psmouse))
@@ -405,6 +415,8 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
 	if (synaptics_resolution(psmouse))
 		return -1;
 
+	synaptics_apply_quirks(psmouse);
+
 	return 0;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 09/90] Input: synaptics - log queried and quirked dimension values
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 08/90] Input: synaptics - split synaptics_resolution(), query first Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 10/90] Input: synaptics - remove obsolete min/max quirk for X240 Kamal Mostafa
                   ` (80 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Daniel Martin <consume.noise@gmail.com>

commit 9aff65982d0f58a78a27769fba7e97bc937b2593 upstream.

Logging the dimension values we queried and the values we use from a quirk
to overwrite can be helpful for debugging.

This partly relates to bug:
    https://bugzilla.kernel.org/show_bug.cgi?id=91541

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 044f411..0e991e0 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -356,6 +356,9 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		} else {
 			priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
 			priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+			psmouse_info(psmouse,
+				     "queried max coordinates: x [..%d], y [..%d]\n",
+				     priv->x_max, priv->y_max);
 		}
 	}
 
@@ -373,6 +376,9 @@ static int synaptics_resolution(struct psmouse *psmouse)
 		} else {
 			priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
 			priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+			psmouse_info(psmouse,
+				     "queried min coordinates: x [%d..], y [%d..]\n",
+				     priv->x_min, priv->y_min);
 		}
 	}
 
@@ -395,6 +401,10 @@ static void synaptics_apply_quirks(struct psmouse *psmouse)
 			priv->x_max = min_max_pnpid_table[i].x_max;
 			priv->y_min = min_max_pnpid_table[i].y_min;
 			priv->y_max = min_max_pnpid_table[i].y_max;
+			psmouse_info(psmouse,
+				     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
+				     priv->x_min, priv->x_max,
+				     priv->y_min, priv->y_max);
 			break;
 		}
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 10/90] Input: synaptics - remove obsolete min/max quirk for X240
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 09/90] Input: synaptics - log queried and quirked dimension values Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 11/90] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Kamal Mostafa
                   ` (79 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Daniel Martin <consume.noise@gmail.com>

commit b05f4d1c332a22f98c037fa64f249aa30877adaf upstream.

The firmware of the X240 (LEN0035, 2013/12) exposes the same values
    x [1232..5710], y [1156..4696]
as the quirk applies.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 0e991e0..5c5ce06 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -128,7 +128,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1024, 5052, 2258, 4832
 	},
 	{
-		(const char * const []){"LEN0035", "LEN0042", NULL},
+		(const char * const []){"LEN0042", NULL},
 		1232, 5710, 1156, 4696
 	},
 	{
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 11/90] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531)
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 10/90] Input: synaptics - remove obsolete min/max quirk for X240 Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 12/90] Input: synaptics - add min/max quirk for Lenovo T440s Kamal Mostafa
                   ` (78 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans de Goede <hdegoede@redhat.com>

commit e76aed9da7189eeb41b9856552ce5721181e8e8d upstream.

https://bugzilla.redhat.com/show_bug.cgi?id=1114768

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 5c5ce06..aec7443 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -132,7 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1232, 5710, 1156, 4696
 	},
 	{
-		(const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL},
+		(const char * const []){"LEN0034", "LEN0036", "LEN2002",
+					"LEN2004", NULL},
 		1024, 5112, 2024, 4832
 	},
 	{
@@ -168,7 +169,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0049",
 	"LEN2000",
 	"LEN2001", /* Edge E431 */
-	"LEN2002",
+	"LEN2002", /* Edge E531 */
 	"LEN2003",
 	"LEN2004", /* L440 */
 	"LEN2005",
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 12/90] Input: synaptics - add min/max quirk for Lenovo T440s
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 11/90] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 13/90] Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd Kamal Mostafa
                   ` (77 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit e4742b1e786ca386e88e6cfb2801e14e15e365cd upstream.

The new Lenovo T440s laptop has a different PnP ID "LEN0039", and it
needs the similar min/max quirk to make its clickpad working.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=903748
Reported-and-tested-by: Joschi Brauchle <joschibrauchle@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index aec7443..6d8b36d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -132,8 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1232, 5710, 1156, 4696
 	},
 	{
-		(const char * const []){"LEN0034", "LEN0036", "LEN2002",
-					"LEN2004", NULL},
+		(const char * const []){"LEN0034", "LEN0036", "LEN0039",
+					"LEN2002", "LEN2004", NULL},
 		1024, 5112, 2024, 4832
 	},
 	{
@@ -160,6 +160,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0036", /* T440 */
 	"LEN0037",
 	"LEN0038",
+	"LEN0039", /* T440s */
 	"LEN0041",
 	"LEN0042", /* Yoga */
 	"LEN0045",
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 13/90] Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 12/90] Input: synaptics - add min/max quirk for Lenovo T440s Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 14/90] Input: synaptics - adjust min/max on Thinkpad E540 Kamal Mostafa
                   ` (76 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hutterer, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Hutterer <peter.hutterer@who-t.net>

commit 8543cf1c247909ce85850ca6e2714adba351d6aa upstream.

LEN0037 found in the Lenovo ThinkPad X1 Carbon 2nd (2014 model)

Reported-and-tested-by: Bjoern Olausson <bjoern@olausson.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 6d8b36d..23f95da 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -132,8 +132,9 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		1232, 5710, 1156, 4696
 	},
 	{
-		(const char * const []){"LEN0034", "LEN0036", "LEN0039",
-					"LEN2002", "LEN2004", NULL},
+		(const char * const []){"LEN0034", "LEN0036", "LEN0037",
+					"LEN0039", "LEN2002", "LEN2004",
+					NULL},
 		1024, 5112, 2024, 4832
 	},
 	{
@@ -158,7 +159,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	"LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
 	"LEN0035", /* X240 */
 	"LEN0036", /* T440 */
-	"LEN0037",
+	"LEN0037", /* X1 Carbon 2nd */
 	"LEN0038",
 	"LEN0039", /* T440s */
 	"LEN0041",
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 14/90] Input: synaptics - adjust min/max on Thinkpad E540
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 13/90] Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 15/90] Input: synaptics - support min/max board id in min_max_pnpid_table Kamal Mostafa
                   ` (75 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Binyamin Sagal, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ben Sagal <bensagal@gmail.com>

commit bce4f9e764c36bc35dd5c9cf9e057c09f422397d upstream.

The LEN2006 Synaptics touchpad (as found in Thinkpad E540) returns wrong
min max values.

touchpad-edge-detector output:
>  Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event6
>  Move one finger around the touchpad to detect the actual edges
>  Kernel says:    x [1472..5674], y [1408..4684]
>  Touchpad sends: x [1264..5675], y [1171..4688]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88211
Signed-off-by: Binyamin Sagal <bensagal@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 23f95da..be56577 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -141,6 +141,10 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		(const char * const []){"LEN2001", NULL},
 		1024, 5022, 2508, 4832
 	},
+	{
+		(const char * const []){"LEN2006", NULL},
+		1264, 5675, 1171, 4688
+	},
 	{ }
 };
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 15/90] Input: synaptics - support min/max board id in min_max_pnpid_table
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 14/90] Input: synaptics - adjust min/max on Thinkpad E540 Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 16/90] Input: synaptics - skip quirks when post-2013 dimensions Kamal Mostafa
                   ` (74 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Martin, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Daniel Martin <daniel.martin@secunet.com>

commit 5b3089ddb540401c1ad2e385a03d7e89ff954585 upstream.

Add a min/max range for board ids to the min/max coordinates quirk. This
makes it possible to restrict quirks to specific models based upon their
board id. The define ANY_BOARD_ID (0) serves as a wild card.

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

Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 42 +++++++++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index be56577..e4908f1 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,32 +117,41 @@ void synaptics_reset(struct psmouse *psmouse)
 }
 
 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+#define ANY_BOARD_ID 0
 struct min_max_quirk {
 	const char * const *pnp_ids;
+	struct {
+		unsigned long int min, max;
+	} board_id;
 	int x_min, x_max, y_min, y_max;
 };
 
 static const struct min_max_quirk min_max_pnpid_table[] = {
 	{
 		(const char * const []){"LEN0033", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5052, 2258, 4832
 	},
 	{
 		(const char * const []){"LEN0042", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1232, 5710, 1156, 4696
 	},
 	{
 		(const char * const []){"LEN0034", "LEN0036", "LEN0037",
 					"LEN0039", "LEN2002", "LEN2004",
 					NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5112, 2024, 4832
 	},
 	{
 		(const char * const []){"LEN2001", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1024, 5022, 2508, 4832
 	},
 	{
 		(const char * const []){"LEN2006", NULL},
+		{ANY_BOARD_ID, ANY_BOARD_ID},
 		1264, 5675, 1171, 4688
 	},
 	{ }
@@ -402,18 +411,27 @@ static void synaptics_apply_quirks(struct psmouse *psmouse)
 	int i;
 
 	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
-		if (psmouse_matches_pnp_id(psmouse,
-					   min_max_pnpid_table[i].pnp_ids)) {
-			priv->x_min = min_max_pnpid_table[i].x_min;
-			priv->x_max = min_max_pnpid_table[i].x_max;
-			priv->y_min = min_max_pnpid_table[i].y_min;
-			priv->y_max = min_max_pnpid_table[i].y_max;
-			psmouse_info(psmouse,
-				     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
-				     priv->x_min, priv->x_max,
-				     priv->y_min, priv->y_max);
-			break;
-		}
+		if (!psmouse_matches_pnp_id(psmouse,
+					    min_max_pnpid_table[i].pnp_ids))
+			continue;
+
+		if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID &&
+		    priv->board_id < min_max_pnpid_table[i].board_id.min)
+			continue;
+
+		if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID &&
+		    priv->board_id > min_max_pnpid_table[i].board_id.max)
+			continue;
+
+		priv->x_min = min_max_pnpid_table[i].x_min;
+		priv->x_max = min_max_pnpid_table[i].x_max;
+		priv->y_min = min_max_pnpid_table[i].y_min;
+		priv->y_max = min_max_pnpid_table[i].y_max;
+		psmouse_info(psmouse,
+			     "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
+			     priv->x_min, priv->x_max,
+			     priv->y_min, priv->y_max);
+		break;
 	}
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 16/90] Input: synaptics - skip quirks when post-2013 dimensions
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 15/90] Input: synaptics - support min/max board id in min_max_pnpid_table Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 17/90] n_tty: Merge .receive_buf() flavors Kamal Mostafa
                   ` (73 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit 02e07492cdfae9c86e3bd21c0beec88dbcc1e9e8 upstream.

Post-2013 Lenovo laptops provide correct min/max dimensions, which are
different with the ones currently quirked.  According to
https://bugzilla.kernel.org/show_bug.cgi?id=91541 the following board ids
are assigned in the post-2013 touchpads:

t440p/t440s: LEN0036 -> 2964/2962
t540p:       LEN0034 -> 2964

Using 2961 as the common minimum makes these 3 laptops OK. We may need
to update those values later if other pnp_ids has a lower board_id.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index e4908f1..19f5022 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -141,7 +141,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
 		(const char * const []){"LEN0034", "LEN0036", "LEN0037",
 					"LEN0039", "LEN2002", "LEN2004",
 					NULL},
-		{ANY_BOARD_ID, ANY_BOARD_ID},
+		{ANY_BOARD_ID, 2961},
 		1024, 5112, 2024, 4832
 	},
 	{
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 17/90] n_tty: Merge .receive_buf() flavors
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 16/90] Input: synaptics - skip quirks when post-2013 dimensions Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 18/90] n_tty: Fix read buffer overwrite when no newline Kamal Mostafa
                   ` (72 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Joseph Salisbury, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Hurley <peter@hurleysoftware.com>

commit 5c32d12378313e0096ea0d450462aa638a90fb6e upstream.

N_TTY's direct and flow-controlled flavors of the .receive_buf()
method are nearly identical; fold together.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ kamal: 3.13-stable prereq for
  fb5ef9e n_tty: Fix read buffer overwrite when no newline ]
Cc: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/n_tty.c | 43 ++++++++++++++++---------------------------
 1 file changed, 16 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7bdaa14..4b24555 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1682,32 +1682,9 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
 	}
 }
 
-static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
-			      char *fp, int count)
-{
-	int room, n;
-
-	down_read(&tty->termios_rwsem);
-
-	while (1) {
-		room = receive_room(tty);
-		n = min(count, room);
-		if (!n)
-			break;
-		__receive_buf(tty, cp, fp, n);
-		cp += n;
-		if (fp)
-			fp += n;
-		count -= n;
-	}
-
-	tty->receive_room = room;
-	n_tty_check_throttle(tty);
-	up_read(&tty->termios_rwsem);
-}
-
-static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
-			      char *fp, int count)
+static int
+n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
+			 char *fp, int count, int flow)
 {
 	struct n_tty_data *ldata = tty->disc_data;
 	int room, n, rcvd = 0;
@@ -1718,7 +1695,7 @@ static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
 		room = receive_room(tty);
 		n = min(count, room);
 		if (!n) {
-			if (!room)
+			if (flow && !room)
 				ldata->no_room = 1;
 			break;
 		}
@@ -1737,6 +1714,18 @@ static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
 	return rcvd;
 }
 
+static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
+			      char *fp, int count)
+{
+	n_tty_receive_buf_common(tty, cp, fp, count, 0);
+}
+
+static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
+			      char *fp, int count)
+{
+	return n_tty_receive_buf_common(tty, cp, fp, count, 1);
+}
+
 int is_ignored(int sig)
 {
 	return (sigismember(&current->blocked, sig) ||
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 18/90] n_tty: Fix read buffer overwrite when no newline
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 17/90] n_tty: Merge .receive_buf() flavors Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 19/90] KVM: x86: Fix lost interrupt on irr_pending race Kamal Mostafa
                   ` (71 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Joseph Salisbury, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Hurley <peter@hurleysoftware.com>

commit fb5ef9e7da39968fec6d6f37f20a23d23740c75e upstream.

BugLink: http://bugs.launchpad.net/bugs/1381005

In canon mode, the read buffer head will advance over the buffer tail
if the input > 4095 bytes without receiving a line termination char.

Discard additional input until a line termination is received.
Before evaluating for overflow, the 'room' value is normalized for
I_PARMRK and 1 byte is reserved for line termination (even in !icanon
mode, in case the mode is switched). The following table shows the
transform:

 actual buffer |  'room' value before overflow calc
  space avail  |    !I_PARMRK    |    I_PARMRK
 --------------------------------------------------
      0        |       -1        |       -1
      1        |        0        |        0
      2        |        1        |        0
      3        |        2        |        0
      4+       |        3        |        1

When !icanon or when icanon and the read buffer contains newlines,
normalized 'room' values of -1 and 0 are clamped to 0, and
'overflow' is 0, so read_head is not adjusted and the input i/o loop
exits (setting no_room if called from flush_to_ldisc()). No input
is discarded since the reader does have input available to read
which ensures forward progress.

When icanon and the read buffer does not contain newlines and the
normalized 'room' value is 0, then overflow and room are reset to 1,
so that the i/o loop will process the next input char normally
(except for parity errors which are ignored). Thus, erasures, signalling
chars, 7-bit mode, etc. will continue to be handled properly.

If the input char processed was not a line termination char, then
the canon_head index will not have advanced, so the normalized 'room'
value will now be -1 and 'overflow' will be set, which indicates the
read_head can safely be reset, effectively erasing the last char
processed.

If the input char processed was a line termination, then the
canon_head index will have advanced, so 'overflow' is cleared to 0,
the read_head is not reset, and 'room' is cleared to 0, which exits
the i/o loop (because the reader now have input available to read
which ensures forward progress).

Note that it is possible for a line termination to be received, and
for the reader to copy the line to the user buffer before the
input i/o loop is ready to process the next input char. This is
why the i/o loop recomputes the room/overflow state with every
input char while handling overflow.

Finally, if the input data was processed without receiving
a line termination (so that overflow is still set), the pty
driver must receive a write wakeup. A pty writer may be waiting
to write more data in n_tty_write() but without unthrottling
here that wakeup will not arrive, and forward progress will halt.
(Normally, the pty writer is woken when the reader reads data out
of the buffer and more space become available).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(backported from commit fb5ef9e7da39968fec6d6f37f20a23d23740c75e)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/n_tty.c | 106 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 79 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 4b24555..0a92635 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -246,8 +246,6 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
 
 static void n_tty_check_throttle(struct tty_struct *tty)
 {
-	if (tty->driver->type == TTY_DRIVER_TYPE_PTY)
-		return;
 	/*
 	 * Check the remaining room for the input canonicalization
 	 * mode.  We don't want to throttle the driver if we're in
@@ -1510,23 +1508,6 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
 		n_tty_receive_char_flagged(tty, c, flag);
 }
 
-/**
- *	n_tty_receive_buf	-	data receive
- *	@tty: terminal device
- *	@cp: buffer
- *	@fp: flag buffer
- *	@count: characters
- *
- *	Called by the terminal driver when a block of characters has
- *	been received. This function must be called from soft contexts
- *	not from interrupt context. The driver is responsible for making
- *	calls one at a time and in order (or using flush_to_ldisc)
- *
- *	n_tty_receive_buf()/producer path:
- *		claims non-exclusive termios_rwsem
- *		publishes read_head and canon_head
- */
-
 static void
 n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp,
 			   char *fp, int count)
@@ -1682,24 +1663,85 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
 	}
 }
 
+/**
+ *	n_tty_receive_buf_common	-	process input
+ *	@tty: device to receive input
+ *	@cp: input chars
+ *	@fp: flags for each char (if NULL, all chars are TTY_NORMAL)
+ *	@count: number of input chars in @cp
+ *
+ *	Called by the terminal driver when a block of characters has
+ *	been received. This function must be called from soft contexts
+ *	not from interrupt context. The driver is responsible for making
+ *	calls one at a time and in order (or using flush_to_ldisc)
+ *
+ *	Returns the # of input chars from @cp which were processed.
+ *
+ *	In canonical mode, the maximum line length is 4096 chars (including
+ *	the line termination char); lines longer than 4096 chars are
+ *	truncated. After 4095 chars, input data is still processed but
+ *	not stored. Overflow processing ensures the tty can always
+ *	receive more input until at least one line can be read.
+ *
+ *	In non-canonical mode, the read buffer will only accept 4095 chars;
+ *	this provides the necessary space for a newline char if the input
+ *	mode is switched to canonical.
+ *
+ *	Note it is possible for the read buffer to _contain_ 4096 chars
+ *	in non-canonical mode: the read buffer could already contain the
+ *	maximum canon line of 4096 chars when the mode is switched to
+ *	non-canonical.
+ *
+ *	n_tty_receive_buf()/producer path:
+ *		claims non-exclusive termios_rwsem
+ *		publishes commit_head or canon_head
+ */
 static int
 n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 			 char *fp, int count, int flow)
 {
 	struct n_tty_data *ldata = tty->disc_data;
-	int room, n, rcvd = 0;
+	int room, n, rcvd = 0, overflow;
 
 	down_read(&tty->termios_rwsem);
 
 	while (1) {
-		room = receive_room(tty);
+		/*
+		 * When PARMRK is set, each input char may take up to 3 chars
+		 * in the read buf; reduce the buffer space avail by 3x
+		 *
+		 * If we are doing input canonicalization, and there are no
+		 * pending newlines, let characters through without limit, so
+		 * that erase characters will be handled.  Other excess
+		 * characters will be beeped.
+		 *
+		 * paired with store in *_copy_from_read_buf() -- guarantees
+		 * the consumer has loaded the data in read_buf up to the new
+		 * read_tail (so this producer will not overwrite unread data)
+		 */
+		size_t tail = ldata->read_tail;
+
+		room = N_TTY_BUF_SIZE - (ldata->read_head - tail);
+		if (I_PARMRK(tty))
+			room = (room + 2) / 3;
+		room--;
+		if (room <= 0) {
+			overflow = ldata->icanon && ldata->canon_head == tail;
+			if (overflow && room < 0)
+				ldata->read_head--;
+			room = overflow;
+			ldata->no_room = flow && !room;
+		} else
+			overflow = 0;
+
 		n = min(count, room);
-		if (!n) {
-			if (flow && !room)
-				ldata->no_room = 1;
+		if (!n)
 			break;
-		}
-		__receive_buf(tty, cp, fp, n);
+
+		/* ignore parity errors if handling overflow */
+		if (!overflow || !fp || *fp != TTY_PARITY)
+			__receive_buf(tty, cp, fp, n);
+
 		cp += n;
 		if (fp)
 			fp += n;
@@ -1708,7 +1750,17 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 	}
 
 	tty->receive_room = room;
-	n_tty_check_throttle(tty);
+
+	/* Unthrottle if handling overflow on pty */
+	if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
+		if (overflow) {
+			tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
+			tty_unthrottle_safe(tty);
+			__tty_set_flow_change(tty, 0);
+		}
+	} else
+		n_tty_check_throttle(tty);
+
 	up_read(&tty->termios_rwsem);
 
 	return rcvd;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 19/90] KVM: x86: Fix lost interrupt on irr_pending race
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 18/90] n_tty: Fix read buffer overwrite when no newline Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 20/90] fs: take i_mutex during prepare_binprm for set[ug]id executables Kamal Mostafa
                   ` (70 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nadav Amit, Paolo Bonzini, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nadav Amit <namit@cs.technion.ac.il>

commit f210f7572bedf3320599e8b2d8e8ec2d96270d0b upstream.

apic_find_highest_irr assumes irr_pending is set if any vector in APIC_IRR is
set.  If this assumption is broken and apicv is disabled, the injection of
interrupts may be deferred until another interrupt is delivered to the guest.
Ultimately, if no other interrupt should be injected to that vCPU, the pending
interrupt may be lost.

commit 56cc2406d68c ("KVM: nVMX: fix "acknowledge interrupt on exit" when APICv
is in use") changed the behavior of apic_clear_irr so irr_pending is cleared
after setting APIC_IRR vector. After this commit, if apic_set_irr and
apic_clear_irr run simultaneously, a race may occur, resulting in APIC_IRR
vector set, and irr_pending cleared. In the following example, assume a single
vector is set in IRR prior to calling apic_clear_irr:

apic_set_irr				apic_clear_irr
------------				--------------
apic->irr_pending = true;
					apic_clear_vector(...);
					vec = apic_search_irr(apic);
					// => vec == -1
apic_set_vector(...);
					apic->irr_pending = (vec != -1);
					// => apic->irr_pending == false

Nonetheless, it appears the race might even occur prior to this commit:

apic_set_irr				apic_clear_irr
------------				--------------
apic->irr_pending = true;
					apic->irr_pending = false;
					apic_clear_vector(...);
					if (apic_search_irr(apic) != -1)
						apic->irr_pending = true;
					// => apic->irr_pending == false
apic_set_vector(...);

Fixing this issue by:
1. Restoring the previous behavior of apic_clear_irr: clear irr_pending, call
   apic_clear_vector, and then if APIC_IRR is non-zero, set irr_pending.
2. On apic_set_irr: first call apic_set_vector, then set irr_pending.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kvm/lapic.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index f52e300..4a0de62 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -323,8 +323,12 @@ EXPORT_SYMBOL_GPL(kvm_apic_update_irr);
 
 static inline void apic_set_irr(int vec, struct kvm_lapic *apic)
 {
-	apic->irr_pending = true;
 	apic_set_vector(vec, apic->regs + APIC_IRR);
+	/*
+	 * irr_pending must be true if any interrupt is pending; set it after
+	 * APIC_IRR to avoid race with apic_clear_irr
+	 */
+	apic->irr_pending = true;
 }
 
 static inline int apic_search_irr(struct kvm_lapic *apic)
@@ -356,13 +360,15 @@ static inline void apic_clear_irr(int vec, struct kvm_lapic *apic)
 
 	vcpu = apic->vcpu;
 
-	apic_clear_vector(vec, apic->regs + APIC_IRR);
-	if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
+	if (unlikely(kvm_apic_vid_enabled(vcpu->kvm))) {
 		/* try to update RVI */
+		apic_clear_vector(vec, apic->regs + APIC_IRR);
 		kvm_make_request(KVM_REQ_EVENT, vcpu);
-	else {
-		vec = apic_search_irr(apic);
-		apic->irr_pending = (vec != -1);
+	} else {
+		apic->irr_pending = false;
+		apic_clear_vector(vec, apic->regs + APIC_IRR);
+		if (apic_search_irr(apic) != -1)
+			apic->irr_pending = true;
 	}
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 20/90] fs: take i_mutex during prepare_binprm for set[ug]id executables
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 19/90] KVM: x86: Fix lost interrupt on irr_pending race Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 21/90] tcp: Fix crash in TCP Fast Open Kamal Mostafa
                   ` (69 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jann Horn, Linus Torvalds, Luis Henriques, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jann Horn <jann@thejh.net>

commit 8b01fc86b9f425899f8a3a8fc1c47d73c2c20543 upstream.

This prevents a race between chown() and execve(), where chowning a
setuid-user binary to root would momentarily make the binary setuid
root.

This patch was mostly written by Linus Torvalds.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.16:
  - relaced task_no_new_privs() by current->no_new_privs
  - replaced READ_ONCE() by ACCESS_ONCE() ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/exec.c | 76 ++++++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 28 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 5743b8f..f1a8244 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1267,6 +1267,53 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
 	return res;
 }
 
+static void bprm_fill_uid(struct linux_binprm *bprm)
+{
+	struct inode *inode;
+	unsigned int mode;
+	kuid_t uid;
+	kgid_t gid;
+
+	/* clear any previous set[ug]id data from a previous binary */
+	bprm->cred->euid = current_euid();
+	bprm->cred->egid = current_egid();
+
+	if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
+		return;
+
+	if (current->no_new_privs)
+		return;
+
+	inode = file_inode(bprm->file);
+	mode = ACCESS_ONCE(inode->i_mode);
+	if (!(mode & (S_ISUID|S_ISGID)))
+		return;
+
+	/* Be careful if suid/sgid is set */
+	mutex_lock(&inode->i_mutex);
+
+	/* reload atomically mode/uid/gid now that lock held */
+	mode = inode->i_mode;
+	uid = inode->i_uid;
+	gid = inode->i_gid;
+	mutex_unlock(&inode->i_mutex);
+
+	/* We ignore suid/sgid if there are no mappings for them in the ns */
+	if (!kuid_has_mapping(bprm->cred->user_ns, uid) ||
+		 !kgid_has_mapping(bprm->cred->user_ns, gid))
+		return;
+
+	if (mode & S_ISUID) {
+		bprm->per_clear |= PER_CLEAR_ON_SETID;
+		bprm->cred->euid = uid;
+	}
+
+	if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+		bprm->per_clear |= PER_CLEAR_ON_SETID;
+		bprm->cred->egid = gid;
+	}
+}
+
 /* 
  * Fill the binprm structure from the inode. 
  * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
@@ -1275,36 +1322,9 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
  */
 int prepare_binprm(struct linux_binprm *bprm)
 {
-	struct inode *inode = file_inode(bprm->file);
-	umode_t mode = inode->i_mode;
 	int retval;
 
-
-	/* clear any previous set[ug]id data from a previous binary */
-	bprm->cred->euid = current_euid();
-	bprm->cred->egid = current_egid();
-
-	if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) &&
-	    !current->no_new_privs &&
-	    kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) &&
-	    kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) {
-		/* Set-uid? */
-		if (mode & S_ISUID) {
-			bprm->per_clear |= PER_CLEAR_ON_SETID;
-			bprm->cred->euid = inode->i_uid;
-		}
-
-		/* Set-gid? */
-		/*
-		 * If setgid is set but no group execute bit then this
-		 * is a candidate for mandatory locking, not a setgid
-		 * executable.
-		 */
-		if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
-			bprm->per_clear |= PER_CLEAR_ON_SETID;
-			bprm->cred->egid = inode->i_gid;
-		}
-	}
+	bprm_fill_uid(bprm);
 
 	/* fill in binprm security blob */
 	retval = security_bprm_set_creds(bprm);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 21/90] tcp: Fix crash in TCP Fast Open
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (19 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 20/90] fs: take i_mutex during prepare_binprm for set[ug]id executables Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 22/90] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Kamal Mostafa
                   ` (68 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ben Hutchings, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ben Hutchings <ben@decadent.org.uk>

Commit 355a901e6cf1 ("tcp: make connect() mem charging friendly")
changed tcp_send_syn_data() to perform an open-coded copy of the 'syn'
skb rather than using skb_copy_expand().

The open-coded copy does not cover the skb_shared_info::gso_segs
field, so in the new skb it is left set to 0.  When this commit was
backported into stable branches between 3.10.y and 3.16.7-ckty
inclusive, it triggered the BUG() in tcp_transmit_skb().

Since Linux 3.18 the GSO segment count is kept in the
tcp_skb_cb::tcp_gso_segs field and tcp_send_syn_data() does copy the
tcp_skb_cb structure to the new skb, so mainline and newer stable
branches are not affected.

Set skb_shared_info::gso_segs to the correct value of 1.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Eric Dumazet <edumazet@google.com>
[ kamal: pre-3.18-stable only; no upstream commit ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b692b0b..918f2db 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2907,6 +2907,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 		goto fallback;
 	syn_data->ip_summed = CHECKSUM_PARTIAL;
 	memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
+	skb_shinfo(syn_data)->gso_segs = 1;
 	if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space),
 					 fo->data->msg_iov, 0, space))) {
 		kfree_skb(syn_data);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 22/90] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 21/90] tcp: Fix crash in TCP Fast Open Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 23/90] nbd: fix possible memory leak Kamal Mostafa
                   ` (67 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tejun Heo, Wu Fengguang, Jens Axboe, Jens Axboe, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Tejun Heo <tj@kernel.org>

commit 7d70e15480c0450d2bfafaad338a32e884fc215e upstream.

global_update_bandwidth() uses static variable update_time as the
timestamp for the last update but forgets to initialize it to
INITIALIZE_JIFFIES.

This means that global_dirty_limit will be 5 mins into the future on
32bit and some large amount jiffies into the past on 64bit.  This
isn't critical as the only effect is that global_dirty_limit won't be
updated for the first 5 mins after booting on 32bit machines,
especially given the auxiliary nature of global_dirty_limit's role -
protecting against global dirty threshold's sudden dips; however, it
does lead to unintended suboptimal behavior.  Fix it.

Fixes: c42843f2f0bb ("writeback: introduce smoothed global dirty limit")
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 145044b..890eccc 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -943,7 +943,7 @@ static void global_update_bandwidth(unsigned long thresh,
 				    unsigned long now)
 {
 	static DEFINE_SPINLOCK(dirty_lock);
-	static unsigned long update_time;
+	static unsigned long update_time = INITIAL_JIFFIES;
 
 	/*
 	 * check locklessly first to optimize away locking for the most time
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 23/90] nbd: fix possible memory leak
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 22/90] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 24/90] mfd: kempld-core: Fix callback return value check Kamal Mostafa
                   ` (66 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sudip Mukherjee, Markus Pargmann, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

commit ff6b8090e26ef7649ef0cc6b42389141ef48b0cf upstream.

we have already allocated memory for nbd_dev, but we were not
releasing that memory and just returning the error value.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Paul Clements <Paul.Clements@SteelEye.com>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/nbd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 2dc3b51..b71f439 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -814,10 +814,6 @@ static int __init nbd_init(void)
 		return -EINVAL;
 	}
 
-	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
-	if (!nbd_dev)
-		return -ENOMEM;
-
 	part_shift = 0;
 	if (max_part > 0) {
 		part_shift = fls(max_part);
@@ -839,6 +835,10 @@ static int __init nbd_init(void)
 	if (nbds_max > 1UL << (MINORBITS - part_shift))
 		return -EINVAL;
 
+	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+	if (!nbd_dev)
+		return -ENOMEM;
+
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
 		if (!disk)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 24/90] mfd: kempld-core: Fix callback return value check
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 23/90] nbd: fix possible memory leak Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 25/90] KVM: nVMX: mask unrestricted_guest if disabled on L0 Kamal Mostafa
                   ` (65 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ameya Palande, Lee Jones, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ameya Palande <2ameya@gmail.com>

commit c8648508ebfc597058d2cd00b6c539110264a167 upstream.

On success, callback function returns 0. So invert the if condition
check so that we can break out of loop.

Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mfd/kempld-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
index 38917a8..2df3cbc 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -629,7 +629,7 @@ static int __init kempld_init(void)
 	if (force_device_id[0]) {
 		for (id = kempld_dmi_table; id->matches[0].slot != DMI_NONE; id++)
 			if (strstr(id->ident, force_device_id))
-				if (id->callback && id->callback(id))
+				if (id->callback && !id->callback(id))
 					break;
 		if (id->matches[0].slot == DMI_NONE)
 			return -ENODEV;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 25/90] KVM: nVMX: mask unrestricted_guest if disabled on L0
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 24/90] mfd: kempld-core: Fix callback return value check Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 26/90] spi: trigger trace event for message-done before mesg->complete Kamal Mostafa
                   ` (64 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Marcelo Tosatti, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com>

commit 0790ec172de1bd2e23f1dbd4925426b6cc3c1b72 upstream.

If EPT was enabled, unrestricted_guest was allowed in L1 regardless of
L0.  L1 triple faulted when running L2 guest that required emulation.

Another side effect was 'WARN_ON_ONCE(vmx->nested.nested_run_pending)'
in L0's dmesg:
  WARNING: CPU: 0 PID: 0 at arch/x86/kvm/vmx.c:9190 nested_vmx_vmexit+0x96e/0xb00 [kvm_intel] ()

Prevent this scenario by masking SECONDARY_EXEC_UNRESTRICTED_GUEST when
the host doesn't have it enabled.

Fixes: 78051e3b7e35 ("KVM: nVMX: Disable unrestricted mode if ept=0")
Tested-By: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kvm/vmx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2ff437d..9c2c662 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2260,8 +2260,8 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 
 	if (enable_ept) {
 		/* nested EPT: emulate EPT also to L1 */
-		nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT |
-			SECONDARY_EXEC_UNRESTRICTED_GUEST;
+		nested_vmx_secondary_ctls_high |=
+			SECONDARY_EXEC_ENABLE_EPT;
 		nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
 			 VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT |
 			 VMX_EPT_INVEPT_BIT;
@@ -2276,6 +2276,10 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 	} else
 		nested_vmx_ept_caps = 0;
 
+	if (enable_unrestricted_guest)
+		nested_vmx_secondary_ctls_high |=
+			SECONDARY_EXEC_UNRESTRICTED_GUEST;
+
 	/* miscellaneous data */
 	rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
 	nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK |
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 26/90] spi: trigger trace event for message-done before mesg->complete
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 25/90] KVM: nVMX: mask unrestricted_guest if disabled on L0 Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 27/90] powerpc/pseries: Little endian fixes for post mobility device tree update Kamal Mostafa
                   ` (63 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Mark Brown, Kamal Mostafa

3.13.11-ckt20 -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 391949b6f02121371e3d7d9082c6d17fd9853034 upstream.

With spidev the mesg->complete callback points to spidev_complete.
Calling this unblocks spidev_sync and so spidev_sync_write finishes. As
the struct spi_message just read is a local variable in
spidev_sync_write and recording the trace event accesses this message
the recording is better done first. The same can happen for
spidev_sync_read.

This fixes an oops observed on a 3.14-rt system with spidev activity
after

	echo 1 > /sys/kernel/debug/tracing/events/spi/enable

.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/spi/spi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a416aec..5fc2f0a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -829,13 +829,14 @@ void spi_finalize_current_message(struct spi_master *master)
 				"failed to unprepare message: %d\n", ret);
 		}
 	}
+
+	trace_spi_message_done(mesg);
+
 	master->cur_msg_prepared = false;
 
 	mesg->state = NULL;
 	if (mesg->complete)
 		mesg->complete(mesg->context);
-
-	trace_spi_message_done(mesg);
 }
 EXPORT_SYMBOL_GPL(spi_finalize_current_message);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 27/90] powerpc/pseries: Little endian fixes for post mobility device tree update
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 26/90] spi: trigger trace event for message-done before mesg->complete Kamal Mostafa
@ 2015-05-05 20:53 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 28/90] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Kamal Mostafa
                   ` (62 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:53 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tyrel Datwyler, Nathan Fontenot, Cyril Bur, Michael Ellerman,
	Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

commit f6ff04149637723261aa4738958b0098b929ee9e upstream.

We currently use the device tree update code in the kernel after resuming
from a suspend operation to re-sync the kernels view of the device tree with
that of the hypervisor. The code as it stands is not endian safe as it relies
on parsing buffers returned by RTAS calls that thusly contains data in big
endian format.

This patch annotates variables and structure members with __be types as well
as performing necessary byte swaps to cpu endian for data that needs to be
parsed.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 44 ++++++++++++++++---------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index cde4e0a..bf38292 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -24,10 +24,10 @@
 static struct kobject *mobility_kobj;
 
 struct update_props_workarea {
-	u32 phandle;
-	u32 state;
-	u64 reserved;
-	u32 nprops;
+	__be32 phandle;
+	__be32 state;
+	__be64 reserved;
+	__be32 nprops;
 } __packed;
 
 #define NODE_ACTION_MASK	0xff000000
@@ -53,11 +53,11 @@ static int mobility_rtas_call(int token, char *buf, s32 scope)
 	return rc;
 }
 
-static int delete_dt_node(u32 phandle)
+static int delete_dt_node(__be32 phandle)
 {
 	struct device_node *dn;
 
-	dn = of_find_node_by_phandle(phandle);
+	dn = of_find_node_by_phandle(be32_to_cpu(phandle));
 	if (!dn)
 		return -ENOENT;
 
@@ -126,7 +126,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
 	return 0;
 }
 
-static int update_dt_node(u32 phandle, s32 scope)
+static int update_dt_node(__be32 phandle, s32 scope)
 {
 	struct update_props_workarea *upwa;
 	struct device_node *dn;
@@ -135,6 +135,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 	char *prop_data;
 	char *rtas_buf;
 	int update_properties_token;
+	u32 nprops;
 	u32 vd;
 
 	update_properties_token = rtas_token("ibm,update-properties");
@@ -145,7 +146,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 	if (!rtas_buf)
 		return -ENOMEM;
 
-	dn = of_find_node_by_phandle(phandle);
+	dn = of_find_node_by_phandle(be32_to_cpu(phandle));
 	if (!dn) {
 		kfree(rtas_buf);
 		return -ENOENT;
@@ -161,6 +162,7 @@ static int update_dt_node(u32 phandle, s32 scope)
 			break;
 
 		prop_data = rtas_buf + sizeof(*upwa);
+		nprops = be32_to_cpu(upwa->nprops);
 
 		/* On the first call to ibm,update-properties for a node the
 		 * the first property value descriptor contains an empty
@@ -169,17 +171,17 @@ static int update_dt_node(u32 phandle, s32 scope)
 		 */
 		if (*prop_data == 0) {
 			prop_data++;
-			vd = *(u32 *)prop_data;
+			vd = be32_to_cpu(*(__be32 *)prop_data);
 			prop_data += vd + sizeof(vd);
-			upwa->nprops--;
+			nprops--;
 		}
 
-		for (i = 0; i < upwa->nprops; i++) {
+		for (i = 0; i < nprops; i++) {
 			char *prop_name;
 
 			prop_name = prop_data;
 			prop_data += strlen(prop_name) + 1;
-			vd = *(u32 *)prop_data;
+			vd = be32_to_cpu(*(__be32 *)prop_data);
 			prop_data += sizeof(vd);
 
 			switch (vd) {
@@ -211,13 +213,13 @@ static int update_dt_node(u32 phandle, s32 scope)
 	return 0;
 }
 
-static int add_dt_node(u32 parent_phandle, u32 drc_index)
+static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
 {
 	struct device_node *dn;
 	struct device_node *parent_dn;
 	int rc;
 
-	parent_dn = of_find_node_by_phandle(parent_phandle);
+	parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle));
 	if (!parent_dn)
 		return -ENOENT;
 
@@ -236,7 +238,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index)
 int pseries_devicetree_update(s32 scope)
 {
 	char *rtas_buf;
-	u32 *data;
+	__be32 *data;
 	int update_nodes_token;
 	int rc;
 
@@ -253,17 +255,17 @@ int pseries_devicetree_update(s32 scope)
 		if (rc && rc != 1)
 			break;
 
-		data = (u32 *)rtas_buf + 4;
-		while (*data & NODE_ACTION_MASK) {
+		data = (__be32 *)rtas_buf + 4;
+		while (be32_to_cpu(*data) & NODE_ACTION_MASK) {
 			int i;
-			u32 action = *data & NODE_ACTION_MASK;
-			int node_count = *data & NODE_COUNT_MASK;
+			u32 action = be32_to_cpu(*data) & NODE_ACTION_MASK;
+			u32 node_count = be32_to_cpu(*data) & NODE_COUNT_MASK;
 
 			data++;
 
 			for (i = 0; i < node_count; i++) {
-				u32 phandle = *data++;
-				u32 drc_index;
+				__be32 phandle = *data++;
+				__be32 drc_index;
 
 				switch (action) {
 				case DELETE_DT_NODE:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 28/90] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5}
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2015-05-05 20:53 ` [PATCH 3.13.y-ckt 27/90] powerpc/pseries: Little endian fixes for post mobility device tree update Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 29/90] perf: Fix irq_work 'tail' recursion Kamal Mostafa
                   ` (61 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: netdev, Don Fry, Markos Chandras, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Markos Chandras <markos.chandras@imgtec.com>

commit 87f966d97b89774162df04d2106c6350c8fe4cb3 upstream.

On a MIPS Malta board, tons of fifo underflow errors have been observed
when using u-boot as bootloader instead of YAMON. The reason for that
is that YAMON used to set the pcnet device to SRAM mode but u-boot does
not. As a result, the default Tx threshold (64 bytes) is now too small to
keep the fifo relatively used and it can result to Tx fifo underflow errors.
As a result of which, it's best to setup the SRAM on supported controllers
so we can always use the NOUFLO bit.

Cc: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Cc: Don Fry <pcnet32@frontier.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/amd/pcnet32.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index 38492e0..26e0653 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1516,7 +1516,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 {
 	struct pcnet32_private *lp;
 	int i, media;
-	int fdx, mii, fset, dxsuflo;
+	int fdx, mii, fset, dxsuflo, sram;
 	int chip_version;
 	char *chipname;
 	struct net_device *dev;
@@ -1553,7 +1553,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 	}
 
 	/* initialize variables */
-	fdx = mii = fset = dxsuflo = 0;
+	fdx = mii = fset = dxsuflo = sram = 0;
 	chip_version = (chip_version >> 12) & 0xffff;
 
 	switch (chip_version) {
@@ -1586,6 +1586,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		chipname = "PCnet/FAST III 79C973";	/* PCI */
 		fdx = 1;
 		mii = 1;
+		sram = 1;
 		break;
 	case 0x2626:
 		chipname = "PCnet/Home 79C978";	/* PCI */
@@ -1609,6 +1610,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		chipname = "PCnet/FAST III 79C975";	/* PCI */
 		fdx = 1;
 		mii = 1;
+		sram = 1;
 		break;
 	case 0x2628:
 		chipname = "PCnet/PRO 79C976";
@@ -1637,6 +1639,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 		dxsuflo = 1;
 	}
 
+	/*
+	 * The Am79C973/Am79C975 controllers come with 12K of SRAM
+	 * which we can use for the Tx/Rx buffers but most importantly,
+	 * the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid
+	 * Tx fifo underflows.
+	 */
+	if (sram) {
+		/*
+		 * The SRAM is being configured in two steps. First we
+		 * set the SRAM size in the BCR25:SRAM_SIZE bits. According
+		 * to the datasheet, each bit corresponds to a 512-byte
+		 * page so we can have at most 24 pages. The SRAM_SIZE
+		 * holds the value of the upper 8 bits of the 16-bit SRAM size.
+		 * The low 8-bits start at 0x00 and end at 0xff. So the
+		 * address range is from 0x0000 up to 0x17ff. Therefore,
+		 * the SRAM_SIZE is set to 0x17. The next step is to set
+		 * the BCR26:SRAM_BND midway through so the Tx and Rx
+		 * buffers can share the SRAM equally.
+		 */
+		a->write_bcr(ioaddr, 25, 0x17);
+		a->write_bcr(ioaddr, 26, 0xc);
+		/* And finally enable the NOUFLO bit */
+		a->write_bcr(ioaddr, 18, a->read_bcr(ioaddr, 18) | (1 << 11));
+	}
+
 	dev = alloc_etherdev(sizeof(*lp));
 	if (!dev) {
 		ret = -ENOMEM;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 29/90] perf: Fix irq_work 'tail' recursion
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 28/90] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 30/90] arm64: Use the reserved TTBR0 if context switching to the init_mm Kamal Mostafa
                   ` (60 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra (Intel),
	Arnaldo Carvalho de Melo, Jiri Olsa, Paul Mackerras,
	Steven Rostedt, Ingo Molnar, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Zijlstra <peterz@infradead.org>

commit d525211f9d1be8b523ec7633f080f2116f5ea536 upstream.

Vince reported a watchdog lockup like:

	[<ffffffff8115e114>] perf_tp_event+0xc4/0x210
	[<ffffffff810b4f8a>] perf_trace_lock+0x12a/0x160
	[<ffffffff810b7f10>] lock_release+0x130/0x260
	[<ffffffff816c7474>] _raw_spin_unlock_irqrestore+0x24/0x40
	[<ffffffff8107bb4d>] do_send_sig_info+0x5d/0x80
	[<ffffffff811f69df>] send_sigio_to_task+0x12f/0x1a0
	[<ffffffff811f71ce>] send_sigio+0xae/0x100
	[<ffffffff811f72b7>] kill_fasync+0x97/0xf0
	[<ffffffff8115d0b4>] perf_event_wakeup+0xd4/0xf0
	[<ffffffff8115d103>] perf_pending_event+0x33/0x60
	[<ffffffff8114e3fc>] irq_work_run_list+0x4c/0x80
	[<ffffffff8114e448>] irq_work_run+0x18/0x40
	[<ffffffff810196af>] smp_trace_irq_work_interrupt+0x3f/0xc0
	[<ffffffff816c99bd>] trace_irq_work_interrupt+0x6d/0x80

Which is caused by an irq_work generating new irq_work and therefore
not allowing forward progress.

This happens because processing the perf irq_work triggers another
perf event (tracepoint stuff) which in turn generates an irq_work ad
infinitum.

Avoid this by raising the recursion counter in the irq_work -- which
effectively disables all software events (including tracepoints) from
actually triggering again.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20150219170311.GH21418@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/events/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 68105f2..c0c8911 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4185,6 +4185,13 @@ static void perf_pending_event(struct irq_work *entry)
 {
 	struct perf_event *event = container_of(entry,
 			struct perf_event, pending);
+	int rctx;
+
+	rctx = perf_swevent_get_recursion_context();
+	/*
+	 * If we 'fail' here, that's OK, it means recursion is already disabled
+	 * and we won't recurse 'further'.
+	 */
 
 	if (event->pending_disable) {
 		event->pending_disable = 0;
@@ -4195,6 +4202,9 @@ static void perf_pending_event(struct irq_work *entry)
 		event->pending_wakeup = 0;
 		perf_event_wakeup(event);
 	}
+
+	if (rctx >= 0)
+		perf_swevent_put_recursion_context(rctx);
 }
 
 /*
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 30/90] arm64: Use the reserved TTBR0 if context switching to the init_mm
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 29/90] perf: Fix irq_work 'tail' recursion Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 31/90] selinux: fix sel_write_enforce broken return value Kamal Mostafa
                   ` (59 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Catalin Marinas, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Catalin Marinas <catalin.marinas@arm.com>

commit e53f21bce4d35a93b23d8fa1a840860f6c74f59e upstream.

The idle_task_exit() function may call switch_mm() with next ==
&init_mm. On arm64, init_mm.pgd cannot be used for user mappings, so
this patch simply sets the reserved TTBR0.

Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Tested-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm64/include/asm/mmu_context.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index a9eee33..101a42b 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -151,6 +151,15 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
 {
 	unsigned int cpu = smp_processor_id();
 
+	/*
+	 * init_mm.pgd does not contain any user mappings and it is always
+	 * active for kernel addresses in TTBR1. Just set the reserved TTBR0.
+	 */
+	if (next == &init_mm) {
+		cpu_set_reserved_ttbr0();
+		return;
+	}
+
 	if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
 		check_and_switch_context(next, tsk);
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 31/90] selinux: fix sel_write_enforce broken return value
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 30/90] arm64: Use the reserved TTBR0 if context switching to the init_mm Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 32/90] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Kamal Mostafa
                   ` (58 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Joe Perches, Paul Moore, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Joe Perches <joe@perches.com>

commit 6436a123a147db51a0b06024a8350f4c230e73ff upstream.

Return a negative error value like the rest of the entries in this function.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
[PM: tweaked subject line]
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 392ab0f..9977902 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
 		goto out;
 
 	/* No partial writes. */
-	length = EINVAL;
+	length = -EINVAL;
 	if (*ppos != 0)
 		goto out;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 32/90] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 31/90] selinux: fix sel_write_enforce broken return value Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 33/90] mm/memory hotplug: postpone the reset of obsolete pgdat Kamal Mostafa
                   ` (57 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Leon Yu, Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Leon Yu <chianglungyu@gmail.com>

commit 3fe89b3e2a7bbf3e97657104b9b33a9d81b950b3 upstream.

I have constantly stumbled upon "kernel BUG at mm/rmap.c:399!" after
upgrading to 3.19 and had no luck with 4.0-rc1 neither.

So, after looking into new logic introduced by commit 7a3ef208e662 ("mm:
prevent endless growth of anon_vma hierarchy"), I found chances are that
unlink_anon_vmas() is called without incrementing dst->anon_vma->degree
in anon_vma_clone() due to allocation failure.  If dst->anon_vma is not
NULL in error path, its degree will be incorrectly decremented in
unlink_anon_vmas() and eventually underflow when exiting as a result of
another call to unlink_anon_vmas().  That's how "kernel BUG at
mm/rmap.c:399!" is triggered for me.

This patch fixes the underflow by dropping dst->anon_vma when allocation
fails.  It's safe to do so regardless of original value of dst->anon_vma
because dst->anon_vma doesn't have valid meaning if anon_vma_clone()
fails.  Besides, callers don't care dst->anon_vma in such case neither.

Also suggested by Michal Hocko, we can clean up vma_adjust() a bit as
anon_vma_clone() now does the work.

[akpm@linux-foundation.org: tweak comment]
Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
Signed-off-by: Leon Yu <chianglungyu@gmail.com>
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/mmap.c | 4 +---
 mm/rmap.c | 7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index e359e9e..e3bd471 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -746,10 +746,8 @@ again:			remove_next = 1 + (end > next->vm_end);
 
 			importer->anon_vma = exporter->anon_vma;
 			error = anon_vma_clone(importer, exporter);
-			if (error) {
-				importer->anon_vma = NULL;
+			if (error)
 				return error;
-			}
 		}
 	}
 
diff --git a/mm/rmap.c b/mm/rmap.c
index ea81a86..f748513 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -287,6 +287,13 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
 	return 0;
 
  enomem_failure:
+	/*
+	 * dst->anon_vma is dropped here otherwise its degree can be incorrectly
+	 * decremented in unlink_anon_vmas().
+	 * We can safely do this because callers of anon_vma_clone() don't care
+	 * about dst->anon_vma if anon_vma_clone() failed.
+	 */
+	dst->anon_vma = NULL;
 	unlink_anon_vmas(dst);
 	return -ENOMEM;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 33/90] mm/memory hotplug: postpone the reset of obsolete pgdat
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 32/90] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 34/90] hfsplus: fix B-tree corruption after insertion at position 0 Kamal Mostafa
                   ` (56 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gu Zheng, David Rientjes, Yasuaki Ishimatsu, Taku Izumi,
	Tang Chen, Xie XiuQi, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Gu Zheng <guz.fnst@cn.fujitsu.com>

commit b0dc3a342af36f95a68fe229b8f0f73552c5ca08 upstream.

Qiu Xishi reported the following BUG when testing hot-add/hot-remove node under
stress condition:

  BUG: unable to handle kernel paging request at 0000000000025f60
  IP: next_online_pgdat+0x1/0x50
  PGD 0
  Oops: 0000 [#1] SMP
  ACPI: Device does not support D3cold
  Modules linked in: fuse nls_iso8859_1 nls_cp437 vfat fat loop dm_mod coretemp mperf crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 pcspkr microcode igb dca i2c_algo_bit ipv6 megaraid_sas iTCO_wdt i2c_i801 i2c_core iTCO_vendor_support tg3 sg hwmon ptp lpc_ich pps_core mfd_core acpi_pad rtc_cmos button ext3 jbd mbcache sd_mod crc_t10dif scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh ahci libahci libata scsi_mod [last unloaded: rasf]
  CPU: 23 PID: 238 Comm: kworker/23:1 Tainted: G           O 3.10.15-5885-euler0302 #1
  Hardware name: HUAWEI TECHNOLOGIES CO.,LTD. Huawei N1/Huawei N1, BIOS V100R001 03/02/2015
  Workqueue: events vmstat_update
  task: ffffa800d32c0000 ti: ffffa800d32ae000 task.ti: ffffa800d32ae000
  RIP: 0010: next_online_pgdat+0x1/0x50
  RSP: 0018:ffffa800d32afce8  EFLAGS: 00010286
  RAX: 0000000000001440 RBX: ffffffff81da53b8 RCX: 0000000000000082
  RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000000
  RBP: ffffa800d32afd28 R08: ffffffff81c93bfc R09: ffffffff81cbdc96
  R10: 00000000000040ec R11: 00000000000000a0 R12: ffffa800fffb3440
  R13: ffffa800d32afd38 R14: 0000000000000017 R15: ffffa800e6616800
  FS:  0000000000000000(0000) GS:ffffa800e6600000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000025f60 CR3: 0000000001a0b000 CR4: 00000000001407e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
    refresh_cpu_vm_stats+0xd0/0x140
    vmstat_update+0x11/0x50
    process_one_work+0x194/0x3d0
    worker_thread+0x12b/0x410
    kthread+0xc6/0xd0
    ret_from_fork+0x7c/0xb0

The cause is the "memset(pgdat, 0, sizeof(*pgdat))" at the end of
try_offline_node, which will reset all the content of pgdat to 0, as the
pgdat is accessed lock-free, so that the users still using the pgdat
will panic, such as the vmstat_update routine.

process A:				offline node XX:

vmstat_updat()
   refresh_cpu_vm_stats()
     for_each_populated_zone()
       find online node XX
     cond_resched()
					offline cpu and memory, then try_offline_node()
					node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat))
       zone = next_zone(zone)
         pg_data_t *pgdat = zone->zone_pgdat;  // here pgdat is NULL now
           next_online_pgdat(pgdat)
             next_online_node(pgdat->node_id);  // NULL pointer access

So the solution here is postponing the reset of obsolete pgdat from
try_offline_node() to hotadd_new_pgdat(), and just resetting
pgdat->nr_zones and pgdat->classzone_idx to be 0 rather than the memset
0 to avoid breaking pointer information in pgdat.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Reported-by: Xishi Qiu <qiuxishi@huawei.com>
Suggested-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/memory_hotplug.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 489f235..38c966a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1017,6 +1017,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
 			return NULL;
 
 		arch_refresh_nodedata(nid, pgdat);
+	} else {
+		/* Reset the nr_zones and classzone_idx to 0 before reuse */
+		pgdat->nr_zones = 0;
+		pgdat->classzone_idx = 0;
 	}
 
 	/* we can use NODE_DATA(nid) from here */
@@ -1862,15 +1866,6 @@ void try_offline_node(int nid)
 		if (is_vmalloc_addr(zone->wait_table))
 			vfree(zone->wait_table);
 	}
-
-	/*
-	 * Since there is no way to guarentee the address of pgdat/zone is not
-	 * on stack of any kernel threads or used by other kernel objects
-	 * without reference counting or other symchronizing method, do not
-	 * reset node_data and free pgdat here. Just reset it to 0 and reuse
-	 * the memory when the node is online again.
-	 */
-	memset(pgdat, 0, sizeof(*pgdat));
 }
 EXPORT_SYMBOL(try_offline_node);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 34/90] hfsplus: fix B-tree corruption after insertion at position 0
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 33/90] mm/memory hotplug: postpone the reset of obsolete pgdat Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 35/90] ARC: SA_SIGINFO ucontext regs off-by-one Kamal Mostafa
                   ` (55 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Antonov, Joe Perches, Anton Altaparmakov, Al Viro,
	Christoph Hellwig, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sergei Antonov <saproj@gmail.com>

commit 98cf21c61a7f5419d82f847c4d77bf6e96a76f5f upstream.

Fix B-tree corruption when a new record is inserted at position 0 in the
node in hfs_brec_insert().  In this case a hfs_brec_update_parent() is
called to update the parent index node (if exists) and it is passed
hfs_find_data with a search_key containing a newly inserted key instead
of the key to be updated.  This results in an inconsistent index node.
The bug reproduces on my machine after an extents overflow record for
the catalog file (CNID=4) is inserted into the extents overflow B-tree.
Because of a low (reserved) value of CNID=4, it has to become the first
record in the first leaf node.

The resulting first leaf node is correct:

  ----------------------------------------------------
  | key0.CNID=4 | key1.CNID=123 | key2.CNID=456, ... |
  ----------------------------------------------------

But the parent index key0 still contains the previous key CNID=123:

  -----------------------
  | key0.CNID=123 | ... |
  -----------------------

A change in hfs_brec_insert() makes hfs_brec_update_parent() work
correctly by preventing it from getting fd->record=-1 value from
__hfs_brec_find().

Along the way, I removed duplicate code with unification of the if
condition.  The resulting code is equivalent to the original code
because node is never 0.

Also hfs_brec_update_parent() will now return an error after getting a
negative fd->record value.  However, the return value of
hfs_brec_update_parent() is not checked anywhere in the file and I'm
leaving it unchanged by this patch.  brec.c lacks error checking after
some other calls too, but this issue is of less importance than the one
being fixed by this patch.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Cc: Joe Perches <joe@perches.com>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/hfsplus/brec.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
index 6e560d5..754fdf8 100644
--- a/fs/hfsplus/brec.c
+++ b/fs/hfsplus/brec.c
@@ -131,13 +131,16 @@ skip:
 	hfs_bnode_write(node, entry, data_off + key_len, entry_len);
 	hfs_bnode_dump(node);
 
-	if (new_node) {
-		/* update parent key if we inserted a key
-		 * at the start of the first node
-		 */
-		if (!rec && new_node != node)
-			hfs_brec_update_parent(fd);
+	/*
+	 * update parent key if we inserted a key
+	 * at the start of the node and it is not the new node
+	 */
+	if (!rec && new_node != node) {
+		hfs_bnode_read_key(node, fd->search_key, data_off + size);
+		hfs_brec_update_parent(fd);
+	}
 
+	if (new_node) {
 		hfs_bnode_put(fd->bnode);
 		if (!new_node->parent) {
 			hfs_btree_inc_height(tree);
@@ -168,9 +171,6 @@ skip:
 		goto again;
 	}
 
-	if (!rec)
-		hfs_brec_update_parent(fd);
-
 	return 0;
 }
 
@@ -370,6 +370,8 @@ again:
 	if (IS_ERR(parent))
 		return PTR_ERR(parent);
 	__hfs_brec_find(parent, fd, hfs_find_rec_by_key);
+	if (fd->record < 0)
+		return -ENOENT;
 	hfs_bnode_dump(parent);
 	rec = fd->record;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 35/90] ARC: SA_SIGINFO ucontext regs off-by-one
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 34/90] hfsplus: fix B-tree corruption after insertion at position 0 Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 36/90] writeback: fix possible underflow in write bandwidth calculation Kamal Mostafa
                   ` (54 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Vineet Gupta <vgupta@synopsys.com>

commit 6914e1e3f63caa829431160f0f7093292daef2d5 upstream.

The regfile provided to SA_SIGINFO signal handler as ucontext was off by
one due to pt_regs gutter cleanups in 2013.

Before handling signal, user pt_regs are copied onto user_regs_struct and copied
back later. Both structs are binary compatible. This was all fine until
commit 2fa919045b72 (ARC: pt_regs update #2) which removed the empty stack slot
at top of pt_regs (corresponding to first pad) and made the corresponding
fixup in struct user_regs_struct (the pad in there was moved out of
@scratch - not removed altogether as it is part of ptrace ABI)

 struct user_regs_struct {
+       long pad;
        struct {
-               long pad;
                long bta, lp_start, lp_end,....
        } scratch;
 ...
 }

This meant that now user_regs_struct was off by 1 reg w.r.t pt_regs and
signal code needs to user_regs_struct.scratch to reflect it as pt_regs,
which is what this commit does.

This problem was hidden for 2 years, because both save/restore, despite
using wrong location, were using the same location. Only an interim
inspection (reproducer below) exposed the issue.

     void handle_segv(int signo, siginfo_t *info, void *context)
     {
 	ucontext_t *uc = context;
	struct user_regs_struct *regs = &(uc->uc_mcontext.regs);

	printf("regs %x %x\n",               <=== prints 7 8 (vs. 8 9)
               regs->scratch.r8, regs->scratch.r9);
     }

     int main()
     {
	struct sigaction sa;

	sa.sa_sigaction = handle_segv;
	sa.sa_flags = SA_SIGINFO;
	sigemptyset(&sa.sa_mask);
	sigaction(SIGSEGV, &sa, NULL);

	asm volatile(
	"mov	r7, 7	\n"
	"mov	r8, 8	\n"
	"mov	r9, 9	\n"
	"mov	r10, 10	\n"
	:::"r7","r8","r9","r10");

	*((unsigned int*)0x10) = 0;
     }

Fixes: 2fa919045b72ec892e "ARC: pt_regs update #2: Remove unused gutter at start of pt_regs"
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arc/kernel/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index 7e95e1a..d68b410 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
 	       sigset_t *set)
 {
 	int err;
-	err = __copy_to_user(&(sf->uc.uc_mcontext.regs), regs,
+	err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs,
 			     sizeof(sf->uc.uc_mcontext.regs.scratch));
 	err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
 
@@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
 	if (!err)
 		set_current_blocked(&set);
 
-	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs),
+	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch),
 				sizeof(sf->uc.uc_mcontext.regs.scratch));
 
 	return err;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 36/90] writeback: fix possible underflow in write bandwidth calculation
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 35/90] ARC: SA_SIGINFO ucontext regs off-by-one Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 37/90] iio: fix drivers that check buffer->scan_mask Kamal Mostafa
                   ` (53 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tejun Heo, Jens Axboe, Jan Kara, Wu Fengguang, Greg Thelen,
	Jens Axboe, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Tejun Heo <tj@kernel.org>

commit c72efb658f7c8b27ca3d0efb5cfd5ded9fcac89e upstream.

>From 1ebf33901ecc75d9496862dceb1ef0377980587c Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 23 Mar 2015 00:08:19 -0400

2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
introduced account_page_redirty() which reverts stat updates for a
redirtied page, making BDI_DIRTIED no longer monotonically increasing.

bdi_update_write_bandwidth() uses the delta in BDI_DIRTIED as the
basis for bandwidth calculation.  While unlikely, since the above
patch, the newer value may be lower than the recorded past value and
underflow the bandwidth calculation leading to a wild result.

Fix it by subtracing min of the old and new values when calculating
delta.  AFAIK, there hasn't been any report of it happening but the
resulting erratic behavior would be non-critical and temporary, so
it's possible that the issue is happening without being reported.  The
risk of the fix is very low, so tagged for -stable.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Greg Thelen <gthelen@google.com>
Fixes: 2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/page-writeback.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 890eccc..1802b62 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -878,8 +878,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi,
 	 *                   bw * elapsed + write_bandwidth * (period - elapsed)
 	 * write_bandwidth = ---------------------------------------------------
 	 *                                          period
+	 *
+	 * @written may have decreased due to account_page_redirty().
+	 * Avoid underflowing @bw calculation.
 	 */
-	bw = written - bdi->written_stamp;
+	bw = written - min(written, bdi->written_stamp);
 	bw *= HZ;
 	if (unlikely(elapsed > period)) {
 		do_div(bw, elapsed);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 37/90] iio: fix drivers that check buffer->scan_mask
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (35 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 36/90] writeback: fix possible underflow in write bandwidth calculation Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 38/90] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Kamal Mostafa
                   ` (52 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Octavian Purdila, Jonathan Cameron, Luis Henriques, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Octavian Purdila <octavian.purdila@intel.com>

commit 70dddeee8945a0e62525a278ae7b91778f82f765 upstream.

If the in-kernel push interface is used we may have a different masks
on the device buffer and the kernel buffer and in this case the device
should generate data for the reunion of the buffers, which is
available at indio_dev->active_scan_mask.

Compiled tested only except for bmc150-accel which was tested at
runtime with the hardware.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[ luis: backported to 3.16: dropped changes to:
  - drivers/iio/accel/bmc150-accel.c
  - drivers/iio/accel/kxcjk-1013.c
  - drivers/iio/gyro/bmg160.c
  - drivers/iio/imu/kmx61.c
  - drivers/iio/proximity/sx9500.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/iio/accel/bma180.c      | 2 +-
 drivers/iio/adc/at91_adc.c      | 5 ++---
 drivers/iio/adc/ti_am335x_adc.c | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index d079baa..0db6d71 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -478,7 +478,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
 
 	mutex_lock(&data->mutex);
 
-	for_each_set_bit(bit, indio_dev->buffer->scan_mask,
+	for_each_set_bit(bit, indio_dev->active_scan_mask,
 			 indio_dev->masklength) {
 		ret = bma180_get_acc_reg(data, bit);
 		if (ret < 0) {
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 059946e..c42bace 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -356,7 +356,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 {
 	struct iio_dev *idev = iio_trigger_get_drvdata(trig);
 	struct at91_adc_state *st = iio_priv(idev);
-	struct iio_buffer *buffer = idev->buffer;
 	struct at91_adc_reg_desc *reg = st->registers;
 	u32 status = at91_adc_readl(st, reg->trigger_register);
 	int value;
@@ -376,7 +375,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 		at91_adc_writel(st, reg->trigger_register,
 				status | value);
 
-		for_each_set_bit(bit, buffer->scan_mask,
+		for_each_set_bit(bit, idev->active_scan_mask,
 				 st->num_channels) {
 			struct iio_chan_spec const *chan = idev->channels + bit;
 			at91_adc_writel(st, AT91_ADC_CHER,
@@ -391,7 +390,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
 		at91_adc_writel(st, reg->trigger_register,
 				status & ~value);
 
-		for_each_set_bit(bit, buffer->scan_mask,
+		for_each_set_bit(bit, idev->active_scan_mask,
 				 st->num_channels) {
 			struct iio_chan_spec const *chan = idev->channels + bit;
 			at91_adc_writel(st, AT91_ADC_CHDR,
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 6721a43..60dc32d 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -172,12 +172,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
 static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
 {
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
-	struct iio_buffer *buffer = indio_dev->buffer;
 	unsigned int enb = 0;
 	u8 bit;
 
 	tiadc_step_config(indio_dev);
-	for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels)
+	for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels)
 		enb |= (get_adc_step_bit(adc_dev, bit) << 1);
 	adc_dev->buffer_en_ch_steps = enb;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 38/90] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 37/90] iio: fix drivers that check buffer->scan_mask Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 39/90] iio: core: Fix double free Kamal Mostafa
                   ` (51 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Viorel Suman, Jonathan Cameron, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Viorel Suman <viorel.suman@gmail.com>

commit 4dac0a8eefd55bb1f157d1a5a084531334a2d74c upstream.

A hardware fifo reset always imply an invalidation of the
existing timestamps, so we'll clear timestamps fifo on
successfull hardware fifo reset.

Signed-off-by: Viorel Suman <viorel.suman@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 4295171..30fce67 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -25,6 +25,16 @@
 #include <linux/poll.h>
 #include "inv_mpu_iio.h"
 
+static void inv_clear_kfifo(struct inv_mpu6050_state *st)
+{
+	unsigned long flags;
+
+	/* take the spin lock sem to avoid interrupt kick in */
+	spin_lock_irqsave(&st->time_stamp_lock, flags);
+	kfifo_reset(&st->timestamps);
+	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
+}
+
 int inv_reset_fifo(struct iio_dev *indio_dev)
 {
 	int result;
@@ -51,6 +61,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev)
 					INV_MPU6050_BIT_FIFO_RST);
 	if (result)
 		goto reset_fifo_fail;
+
+	/* clear timestamps fifo */
+	inv_clear_kfifo(st);
+
 	/* enable interrupt */
 	if (st->chip_config.accl_fifo_enable ||
 	    st->chip_config.gyro_fifo_enable) {
@@ -84,16 +98,6 @@ reset_fifo_fail:
 	return result;
 }
 
-static void inv_clear_kfifo(struct inv_mpu6050_state *st)
-{
-	unsigned long flags;
-
-	/* take the spin lock sem to avoid interrupt kick in */
-	spin_lock_irqsave(&st->time_stamp_lock, flags);
-	kfifo_reset(&st->timestamps);
-	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
-}
-
 /**
  * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
  */
@@ -185,7 +189,6 @@ end_session:
 flush_fifo:
 	/* Flush HW and SW FIFOs. */
 	inv_reset_fifo(indio_dev);
-	inv_clear_kfifo(st);
 	mutex_unlock(&indio_dev->mlock);
 	iio_trigger_notify_done(indio_dev->trig);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 39/90] iio: core: Fix double free.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 38/90] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 40/90] USB: ftdi_sio: Added custom PID for Synapse Wireless product Kamal Mostafa
                   ` (50 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Fuzzey, Jonathan Cameron, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Martin Fuzzey <mfuzzey@parkeon.com>

commit c1b03ab5e886760bdd38c9c7a27af149046ffe01 upstream.

When an error occurred during event registration memory was freed twice
resulting in kernel memory corruption and a crash in unrelated code.

The problem was caused by
	iio_device_unregister_eventset()
	iio_device_unregister_sysfs()

being called twice, once on the error path and then
again via iio_dev_release().

Fix this by making these two functions idempotent so they
may be called multiple times.

The problem was observed before applying
	78b33216 iio:core: Handle error when mask type is not separate

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/iio/industrialio-core.c  | 5 +++--
 drivers/iio/industrialio-event.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 18f72e3..6e4858d 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -812,8 +812,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
  * @attr_list: List of IIO device attributes
  *
  * This function frees the memory allocated for each of the IIO device
- * attributes in the list. Note: if you want to reuse the list after calling
- * this function you have to reinitialize it using INIT_LIST_HEAD().
+ * attributes in the list.
  */
 void iio_free_chan_devattr_list(struct list_head *attr_list)
 {
@@ -821,6 +820,7 @@ void iio_free_chan_devattr_list(struct list_head *attr_list)
 
 	list_for_each_entry_safe(p, n, attr_list, l) {
 		kfree(p->dev_attr.attr.name);
+		list_del(&p->l);
 		kfree(p);
 	}
 }
@@ -901,6 +901,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
 
 	iio_free_chan_devattr_list(&indio_dev->channel_attr_list);
 	kfree(indio_dev->chan_attr_group.attrs);
+	indio_dev->chan_attr_group.attrs = NULL;
 }
 
 static void iio_dev_release(struct device *device)
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index c531839..7c35689 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -596,6 +596,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
 error_free_setup_event_lines:
 	iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list);
 	kfree(indio_dev->event_interface);
+	indio_dev->event_interface = NULL;
 error_ret:
 
 	return ret;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 40/90] USB: ftdi_sio: Added custom PID for Synapse Wireless product
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 39/90] iio: core: Fix double free Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 41/90] iwlwifi: dvm: run INIT firmware again upon .start() Kamal Mostafa
                   ` (49 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Doug Goldstein, Johan Hovold, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Doug Goldstein <cardoe@cardoe.com>

commit 4899c054a90439477b24da8977db8d738376fe90 upstream.

Synapse Wireless uses the FTDI VID with a custom PID of 0x9090 for their
SNAP Stick 200 product.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 1 +
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c8ee4c0..c63990c 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -618,6 +618,7 @@ static struct usb_device_id id_table_combined [] = {
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+	{ USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
 	/*
 	 * ELV devices:
 	 */
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 56b1b55..4e4f46f 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -561,6 +561,12 @@
  */
 #define FTDI_NT_ORIONLXM_PID	0x7c90	/* OrionLXm Substation Automation Platform */
 
+/*
+ * Synapse Wireless product ids (FTDI_VID)
+ * http://www.synapse-wireless.com
+ */
+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
+
 
 /********************************/
 /** third-party VID/PID combos **/
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 41/90] iwlwifi: dvm: run INIT firmware again upon .start()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 40/90] USB: ftdi_sio: Added custom PID for Synapse Wireless product Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 42/90] USB: keyspan_pda: add new device id Kamal Mostafa
                   ` (48 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Emmanuel Grumbach, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

commit 9c8928f5176766bec79f272bd47b7124e11cccbd upstream.

The assumption before this patch was that we don't need to
run again the INIT firmware after the system booted. The
INIT firmware runs calibrations which impact the physical
layer's behavior.
Users reported that it may be helpful to run these
calibrations again every time the interface is brought up.
The penatly is minimal, since the calibrations run fast.
This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=94341

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/dvm/dev.h   | 1 -
 drivers/net/wireless/iwlwifi/dvm/ucode.c | 5 -----
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 7434d9e..0db52ca 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -708,7 +708,6 @@ struct iwl_priv {
 	unsigned long reload_jiffies;
 	int reload_count;
 	bool ucode_loaded;
-	bool init_ucode_run;		/* Don't run init uCode again */
 
 	u8 plcp_delta_threshold;
 
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index 6363794..0223d06 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -424,9 +424,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
 	if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
 		return 0;
 
-	if (priv->init_ucode_run)
-		return 0;
-
 	iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
 				   calib_complete, ARRAY_SIZE(calib_complete),
 				   iwlagn_wait_calib, priv);
@@ -446,8 +443,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
 	 */
 	ret = iwl_wait_notification(&priv->notif_wait, &calib_wait,
 					UCODE_CALIB_TIMEOUT);
-	if (!ret)
-		priv->init_ucode_run = true;
 
 	goto out;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 42/90] USB: keyspan_pda: add new device id
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 41/90] iwlwifi: dvm: run INIT firmware again upon .start() Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 43/90] cifs: smb2_clone_range() - exit on unhandled error Kamal Mostafa
                   ` (47 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nathaniel Wesley Filardo, Johan Hovold, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nathaniel W Filardo <nwf@cs.jhu.edu>

commit 5e71fc8629cefae5f3c1a4f498de3fe4f631924a upstream.

Add USB VID/PID for Xircom PGMFHUB USB/serial component.  (The hub and SCSI
bridge on that hardware are recognized out of the box by existing drivers.)
Tested VID/PID using new_id and loopback connection and was met with
success, but that's all the testing done.

Signed-off-by: Nathaniel Wesley Filardo <nwf@cs.jhu.edu>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/keyspan_pda.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 5f1d382..47e0de0 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -62,6 +62,7 @@ struct keyspan_pda_private {
 /* For Xircom PGSDB9 and older Entregra version of the same device */
 #define XIRCOM_VENDOR_ID		0x085a
 #define XIRCOM_FAKE_ID			0x8027
+#define XIRCOM_FAKE_ID_2		0x8025 /* "PGMFHUB" serial */
 #define ENTREGRA_VENDOR_ID		0x1645
 #define ENTREGRA_FAKE_ID		0x8093
 
@@ -71,6 +72,7 @@ static const struct usb_device_id id_table_combined[] = {
 #endif
 #ifdef XIRCOM
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
+	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
 	{ USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
 #endif
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
@@ -94,6 +96,7 @@ static const struct usb_device_id id_table_fake[] = {
 #ifdef XIRCOM
 static const struct usb_device_id id_table_fake_xircom[] = {
 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
+	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
 	{ USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
 	{ }
 };
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 43/90] cifs: smb2_clone_range() - exit on unhandled error
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 42/90] USB: keyspan_pda: add new device id Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 44/90] cifs: fix use-after-free bug in find_writable_file Kamal Mostafa
                   ` (46 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sachin Prabhu, Steve French, Steve French, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sachin Prabhu <sprabhu@redhat.com>

commit 2477bc58d49edb1c0baf59df7dc093dce682af2b upstream.

While attempting to clone a file on a samba server, we receive a
STATUS_INVALID_DEVICE_REQUEST. This is mapped to -EOPNOTSUPP which
isn't handled in smb2_clone_range(). We end up looping in the while loop
making same call to the samba server over and over again.

The proposed fix is to exit and return the error value when encountered
with an unhandled error.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steve French <steve.french@primarydata.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/smb2ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 34a17d4..30f3eb5 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -630,7 +630,8 @@ smb2_clone_range(const unsigned int xid,
 
 			/* No need to change MaxChunks since already set to 1 */
 			chunk_sizes_updated = true;
-		}
+		} else
+			goto cchunk_out;
 	}
 
 cchunk_out:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 44/90] cifs: fix use-after-free bug in find_writable_file
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 43/90] cifs: smb2_clone_range() - exit on unhandled error Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 45/90] can: flexcan: Deferred on Regulator return EPROBE_DEFER Kamal Mostafa
                   ` (45 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Disseldorp, Steve French, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: David Disseldorp <ddiss@suse.de>

commit e1e9bda22d7ddf88515e8fe401887e313922823e upstream.

Under intermittent network outages, find_writable_file() is susceptible
to the following race condition, which results in a user-after-free in
the cifs_writepages code-path:

Thread 1                                        Thread 2
========                                        ========

inv_file = NULL
refind = 0
spin_lock(&cifs_file_list_lock)

// invalidHandle found on openFileList

inv_file = open_file
// inv_file->count currently 1

cifsFileInfo_get(inv_file)
// inv_file->count = 2

spin_unlock(&cifs_file_list_lock);

cifs_reopen_file()                            cifs_close()
// fails (rc != 0)                            ->cifsFileInfo_put()
                                       spin_lock(&cifs_file_list_lock)
                                       // inv_file->count = 1
                                       spin_unlock(&cifs_file_list_lock)

spin_lock(&cifs_file_list_lock);
list_move_tail(&inv_file->flist,
      &cifs_inode->openFileList);
spin_unlock(&cifs_file_list_lock);

cifsFileInfo_put(inv_file);
->spin_lock(&cifs_file_list_lock)

  // inv_file->count = 0
  list_del(&cifs_file->flist);
  // cleanup!!
  kfree(cifs_file);

  spin_unlock(&cifs_file_list_lock);

spin_lock(&cifs_file_list_lock);
++refind;
// refind = 1
goto refind_writable;

At this point we loop back through with an invalid inv_file pointer
and a refind value of 1. On second pass, inv_file is not overwritten on
openFileList traversal, and is subsequently dereferenced.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 3530d7c..6bc5b78 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1821,6 +1821,7 @@ refind_writable:
 			cifsFileInfo_put(inv_file);
 			spin_lock(&cifs_file_list_lock);
 			++refind;
+			inv_file = NULL;
 			goto refind_writable;
 		}
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 45/90] can: flexcan: Deferred on Regulator return EPROBE_DEFER
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 44/90] cifs: fix use-after-free bug in find_writable_file Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 46/90] usb: xhci: handle Config Error Change (CEC) in xhci driver Kamal Mostafa
                   ` (44 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Werner, Marc Kleine-Budde, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Andreas Werner <kernel@andy89.org>

commit 555828ef45f825d6ee06559f0304163550eed380 upstream.

Return EPROBE_DEFER if Regulator returns EPROBE_DEFER

If the Flexcan driver is built into kernel and a regulator is used to
enable the CAN transceiver, the Flexcan driver may not use the regulator.

When initializing the Flexcan device with a regulator defined in the device
tree, but not initialized, the regulator subsystem returns EPROBE_DEFER, hence
the Flexcan init fails.

The solution for this is to return EPROBE_DEFER if regulator is not initialized
and wait until the regulator is initialized.

Signed-off-by: Andreas Werner <kernel@andy89.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/can/flexcan.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index deea3a9..0542497 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1081,12 +1081,19 @@ static int flexcan_probe(struct platform_device *pdev)
 	const struct flexcan_devtype_data *devtype_data;
 	struct net_device *dev;
 	struct flexcan_priv *priv;
+	struct regulator *reg_xceiver;
 	struct resource *mem;
 	struct clk *clk_ipg = NULL, *clk_per = NULL;
 	void __iomem *base;
 	int err, irq;
 	u32 clock_freq = 0;
 
+	reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
+	if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	else if (IS_ERR(reg_xceiver))
+		reg_xceiver = NULL;
+
 	if (pdev->dev.of_node)
 		of_property_read_u32(pdev->dev.of_node,
 						"clock-frequency", &clock_freq);
@@ -1148,9 +1155,7 @@ static int flexcan_probe(struct platform_device *pdev)
 	priv->pdata = dev_get_platdata(&pdev->dev);
 	priv->devtype_data = devtype_data;
 
-	priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
-	if (IS_ERR(priv->reg_xceiver))
-		priv->reg_xceiver = NULL;
+	priv->reg_xceiver = reg_xceiver;
 
 	netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 46/90] usb: xhci: handle Config Error Change (CEC) in xhci driver
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 45/90] can: flexcan: Deferred on Regulator return EPROBE_DEFER Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 47/90] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Kamal Mostafa
                   ` (43 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 9425183d177aa4a2f09d01a74925124f0778b595 upstream.

Linux xHCI driver doesn't report and handle port cofig error change.
If Port Configure Error for root hub port occurs, CEC bit in PORTSC
would be set by xHC and remains 1. This happends when the root port
fails to configure its link partner, e.g. the port fails to exchange
port capabilities information using Port Capability LMPs.

Then the Port Status Change Events will be blocked until all status
change bits(CEC is one of the change bits) are cleared('0') (refer to
xHCI spec 4.19.2). Otherwise, the port status change event for this
root port will not be generated anymore, then root port would look
like dead for user and can't be recovered until a Host Controller
Reset(HCRST).

This patch is to check CEC bit in PORTSC in xhci_get_port_status()
and set a Config Error in the return status if CEC is set. This will
cause a ClearPortFeature request, where CEC bit is cleared in
xhci_clear_port_change_bit().

[The commit log is based on initial Marvell patch posted at
http://marc.info/?l=linux-kernel&m=142323612321434&w=2]

Reported-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci-hub.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 44f152d..9b69daf 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -383,6 +383,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
 		status = PORT_PLC;
 		port_change_bit = "link state";
 		break;
+	case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
+		status = PORT_CEC;
+		port_change_bit = "config error";
+		break;
 	default:
 		/* Should never happen */
 		return;
@@ -584,6 +588,8 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
 			status |= USB_PORT_STAT_C_LINK_STATE << 16;
 		if ((raw_port_status & PORT_WRC))
 			status |= USB_PORT_STAT_C_BH_RESET << 16;
+		if ((raw_port_status & PORT_CEC))
+			status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
 	}
 
 	if (hcd->speed != HCD_USB3) {
@@ -1002,6 +1008,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 		case USB_PORT_FEAT_C_OVER_CURRENT:
 		case USB_PORT_FEAT_C_ENABLE:
 		case USB_PORT_FEAT_C_PORT_LINK_STATE:
+		case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
 			xhci_clear_port_change_bit(xhci, wValue, wIndex,
 					port_array[wIndex], temp);
 			break;
@@ -1067,7 +1074,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 	 */
 	status = bus_state->resuming_ports;
 
-	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;
+	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
 
 	spin_lock_irqsave(&xhci->lock, flags);
 	/* For each port, did anything change?  If so, set that bit in buf. */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 47/90] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 46/90] usb: xhci: handle Config Error Change (CEC) in xhci driver Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 48/90] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Kamal Mostafa
                   ` (42 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 227a4fd801c8a9fa2c4700ab98ec1aec06e3b44d upstream.

When a device with an isochronous endpoint is plugged into the Intel
xHCI host controller, and the driver submits multiple frames per URB,
the xHCI driver will set the Block Event Interrupt (BEI) flag on all
but the last TD for the URB. This causes the host controller to place
an event on the event ring, but not send an interrupt. When the last
TD for the URB completes, BEI is cleared, and we get an interrupt for
the whole URB.

However, under Intel xHCI host controllers, if the event ring is full
of events from transfers with BEI set,  an "Event Ring is Full" event
will be posted to the last entry of the event ring,  but no interrupt
is generated. Host will cease all transfer and command executions and
wait until software completes handling the pending events in the event
ring.  That means xHC stops, but event of "event ring is full" is not
notified. As the result, the xHC looks like dead to user.

This patch is to apply XHCI_AVOID_BEI quirk to Intel xHC devices. And
it should be backported to kernels as old as 3.0, that contains the
commit 69e848c2090a ("Intel xhci: Support EHCI/xHCI port switching.").

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Tested-by: Alistair Grant <akgrant0710@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index d7f2e18c..e681201 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -111,6 +111,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 		xhci->quirks |= XHCI_INTEL_HOST;
+		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 			pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
@@ -126,7 +127,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		 * PPT chipsets.
 		 */
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
-		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 		pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 48/90] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 47/90] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 49/90] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Kamal Mostafa
                   ` (41 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Doug Goldstein, Johan Hovold, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Doug Goldstein <cardoe@cardoe.com>

commit b229a0f840f774d29d8fedbf5deb344ca36b7f1a upstream.

This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
to avoid attaching a TTY to the JTAG port as this board is based on the
CALAO Systems reference design and needs the same fix up.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
[johan: clean up probe logic ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index c63990c..60591ae 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1906,8 +1906,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
 {
 	struct usb_device *udev = serial->dev;
 
-	if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) ||
-	    (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2")))
+	if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
+		return ftdi_jtag_probe(serial);
+
+	if (udev->product &&
+		(!strcmp(udev->product, "BeagleBone/XDS100V2") ||
+		 !strcmp(udev->product, "SNAP Connect E10")))
 		return ftdi_jtag_probe(serial);
 
 	return 0;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 49/90] tty: serial: fsl_lpuart: clear receive flag on FIFO flush
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 48/90] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 50/90] radeon: Do not directly dereference pointers to BIOS area Kamal Mostafa
                   ` (40 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Agner, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Stefan Agner <stefan@agner.ch>

commit 8e4934c6d6c659e22b1b746af4196683e77ce6ca upstream.

When the receiver was enabled during startup, a character could
have been in the FIFO when the UART get initially used. The
driver configures the (receive) watermark level, and flushes the
FIFO. However, the receive flag (RDRF) could still be set at that
stage (as mentioned in the register description of UARTx_RWFIFO).
This leads to an interrupt which won't be handled properly in
interrupt mode: The receive interrupt function lpuart_rxint checks
the FIFO count, which is 0 at that point (due to the flush
during initialization). The problem does not manifest when using
DMA to receive characters.

Fix this situation by explicitly read the status register, which
leads to clearing of the RDRF flag. Due to the flush just after
the status flag read, a explicit data read is not to required.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/fsl_lpuart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 8978dc9..8eeb118 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -362,6 +362,9 @@ static void lpuart_setup_watermark(struct lpuart_port *sport)
 	writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE,
 			sport->port.membase + UARTPFIFO);
 
+	/* explicitly clear RDRF */
+	readb(sport->port.membase + UARTSR1);
+
 	/* flush Tx and Rx FIFO */
 	writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH,
 			sport->port.membase + UARTCFIFO);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 50/90] radeon: Do not directly dereference pointers to BIOS area.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 49/90] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 51/90] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Kamal Mostafa
                   ` (39 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David S. Miller, Alex Deucher, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: David Miller <davem@davemloft.net>

commit f2c9e560b406f2f6b14b345c7da33467dee9cdf2 upstream.

Use readb() and memcpy_fromio() accessors instead.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_bios.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 9ab3097..c43335c 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 
 static bool radeon_read_bios(struct radeon_device *rdev)
 {
-	uint8_t __iomem *bios;
+	uint8_t __iomem *bios, val1, val2;
 	size_t size;
 
 	rdev->bios = NULL;
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 		return false;
 	}
 
-	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+	val1 = readb(&bios[0]);
+	val2 = readb(&bios[1]);
+
+	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
-	rdev->bios = kmemdup(bios, size, GFP_KERNEL);
+	rdev->bios = kzalloc(size, GFP_KERNEL);
 	if (rdev->bios == NULL) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
+	memcpy_fromio(rdev->bios, bios, size);
 	pci_unmap_rom(rdev->pdev, bios);
 	return true;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 51/90] iio: imu: Use iio_trigger_get for indio_dev->trig assignment
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 50/90] radeon: Do not directly dereference pointers to BIOS area Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 52/90] dmaengine: edma: fix memory leak when terminating running transfers Kamal Mostafa
                   ` (38 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Darshana Padmadas, Jonathan Cameron, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Darshana Padmadas <darshanapadmadas@gmail.com>

commit 4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 upstream.

This patch uses iio_trigger_get to increment the reference
count of trigger device, to avoid incorrect assignment.
Can result in a null pointer dereference during removal if the
trigger has been changed before removal.

This patch refers to a similar situation encountered through the
following discussion:
http://www.spinics.net/lists/linux-iio/msg13669.html

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/iio/imu/adis_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index e0017c2..f53e9a8 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
 	iio_trigger_set_drvdata(adis->trig, adis);
 	ret = iio_trigger_register(adis->trig);
 
-	indio_dev->trig = adis->trig;
+	indio_dev->trig = iio_trigger_get(adis->trig);
 	if (ret)
 		goto error_free_irq;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 52/90] dmaengine: edma: fix memory leak when terminating running transfers
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 51/90] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 53/90] dmaengine: omap-dma: Fix memory leak when terminating running transfer Kamal Mostafa
                   ` (37 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Petr Kulhavy, Peter Ujfalusi, linux-omap, Vinod Koul,
	Luis Henriques, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Petr Kulhavy <petr@barix.com>

commit 5ca9e7ce6eebec53362ff779264143860ccf68cd upstream.

If edma_terminate_all() was called while a transfer was running (i.e. after
edma_execute() but before edma_callback()) the echan->edesc was not freed.

This was due to the fact that a running transfer is on none of the
vchan lists: desc_submitted, desc_issued, desc_completed (edma_execute()
removes it from the desc_issued list), so the vchan_dma_desc_free_list()
called at the end of edma_terminate_all() didn't find it and didn't free it.

This bug was found on an AM1808 based hardware (very similar to da850evm,
however using the second MMC/SD controller), where intense operations on the SD
card wasted the device 128MB RAM within a couple of days.

Peter Ujfalusi:
The issue is even more severe since it affects cyclic (audio) transfers as
well. In this case starting/stopping audio will results memory leak.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: <linux-omap@vger.kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/dma/edma.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 037443c..52a3884 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -219,6 +219,12 @@ static int edma_terminate_all(struct edma_chan *echan)
 	 * echan->edesc is NULL and exit.)
 	 */
 	if (echan->edesc) {
+		/*
+		 * free the running request descriptor
+		 * since it is not in any of the vdesc lists
+		 */
+		edma_desc_free(&echan->edesc->vdesc);
+
 		echan->edesc = NULL;
 		edma_stop(echan->ch_num);
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 53/90] dmaengine: omap-dma: Fix memory leak when terminating running transfer
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 52/90] dmaengine: edma: fix memory leak when terminating running transfers Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 54/90] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Kamal Mostafa
                   ` (36 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Ujfalusi, linux-omap, Vinod Koul, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

commit 02d88b735f5a60f04dbf6d051b76e1877a0d0844 upstream.

In omap_dma_start_desc the vdesc->node is removed from the virt-dma
framework managed lists (to be precise from the desc_issued list).
If a terminate_all comes before the transfer finishes the omap_desc will
not be freed up because it is not in any of the lists and we stopped the
DMA channel so the transfer will not going to complete.
There is no special sequence for leaking memory when using cyclic (audio)
transfer: with every start and stop of a cyclic transfer the driver leaks
struct omap_desc worth of memory.

Free up the allocated memory directly in omap_dma_terminate_all() since the
framework will not going to do that for us.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: <linux-omap@vger.kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/dma/omap-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 2f66cf4..d1cb93d 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -487,6 +487,7 @@ static int omap_dma_terminate_all(struct omap_chan *c)
 	 * c->desc is NULL and exit.)
 	 */
 	if (c->desc) {
+		omap_dma_desc_free(&c->desc->vd);
 		c->desc = NULL;
 		/* Avoid stopping the dma twice */
 		if (!c->paused)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 54/90] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 53/90] dmaengine: omap-dma: Fix memory leak when terminating running transfer Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 55/90] mac80211: fix RX A-MPDU session reorder timer deletion Kamal Mostafa
                   ` (35 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Lippers-Hollmann, Matt Fleming, Ingo Molnar, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Stefan Lippers-Hollmann <s.l-h@gmx.de>

commit 80313b3078fcd2ca51970880d90757f05879a193 upstream.

The ASRock Q1900DC-ITX mainboard (Baytrail-D) hangs randomly in
both BIOS and UEFI mode while rebooting unless reboot=pci is
used. Add a quirk to reboot via the pci method.

The problem is very intermittent and hard to debug, it might succeed
rebooting just fine 40 times in a row - but fails half a dozen times
the next day. It seems to be slightly less common in BIOS CSM mode
than native UEFI (with the CSM disabled), but it does happen in either
mode. Since I've started testing this patch in late january, rebooting
has been 100% reliable.

Most of the time it already hangs during POST, but occasionally it
might even make it through the bootloader and the kernel might even
start booting, but then hangs before the mode switch. The same symptoms
occur with grub-efi, gummiboot and grub-pc, just as well as (at least)
kernel 3.16-3.19 and 4.0-rc6 (I haven't tried older kernels than 3.16).
Upgrading to the most current mainboard firmware of the ASRock
Q1900DC-ITX, version 1.20, does not improve the situation.

( Searching the web seems to suggest that other Bay Trail-D mainboards
  might be affected as well. )
--
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/20150330224427.0fb58e42@mir
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/reboot.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index c752cb4..a6aa91f 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -181,6 +181,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
 		},
 	},
 
+	/* ASRock */
+	{	/* Handle problems with rebooting on ASRock Q1900DC-ITX */
+		.callback = set_pci_reboot,
+		.ident = "ASRock Q1900DC-ITX",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
+			DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
+		},
+	},
+
 	/* ASUS */
 	{	/* Handle problems with rebooting on ASUS P4S800 */
 		.callback = set_bios_reboot,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 55/90] mac80211: fix RX A-MPDU session reorder timer deletion
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 54/90] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 56/90] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Kamal Mostafa
                   ` (34 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johannes Berg, Luis Henriques, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Johannes Berg <johannes.berg@intel.com>

commit 788211d81bfdf9b6a547d0530f206ba6ee76b107 upstream.

There's an issue with the way the RX A-MPDU reorder timer is
deleted that can cause a kernel crash like this:

 * tid_rx is removed - call_rcu(ieee80211_free_tid_rx)
 * station is destroyed
 * reorder timer fires before ieee80211_free_tid_rx() runs,
   accessing the station, thus potentially crashing due to
   the use-after-free

The station deletion is protected by synchronize_net(), but
that isn't enough -- ieee80211_free_tid_rx() need not have
run when that returns (it deletes the timer.) We could use
rcu_barrier() instead of synchronize_net(), but that's much
more expensive.

Instead, to fix this, add a field tracking that the session
is being deleted. In this case, the only re-arming of the
timer happens with the reorder spinlock held, so make that
code not rearm it if the session is being deleted and also
delete the timer after setting that field. This ensures the
timer cannot fire after ___ieee80211_stop_rx_ba_session()
returns, which fixes the problem.

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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/agg-rx.c   | 8 ++++++--
 net/mac80211/rx.c       | 7 ++++---
 net/mac80211/sta_info.h | 2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 31bf258..9608c6e 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -49,8 +49,6 @@ static void ieee80211_free_tid_rx(struct rcu_head *h)
 		container_of(h, struct tid_ampdu_rx, rcu_head);
 	int i;
 
-	del_timer_sync(&tid_rx->reorder_timer);
-
 	for (i = 0; i < tid_rx->buf_size; i++)
 		dev_kfree_skb(tid_rx->reorder_buf[i]);
 	kfree(tid_rx->reorder_buf);
@@ -93,6 +91,12 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
 
 	del_timer_sync(&tid_rx->session_timer);
 
+	/* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */
+	spin_lock_bh(&tid_rx->reorder_lock);
+	tid_rx->removed = true;
+	spin_unlock_bh(&tid_rx->reorder_lock);
+	del_timer_sync(&tid_rx->reorder_timer);
+
 	call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx);
 }
 
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 94c9df7..0c0b3f7 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -811,9 +811,10 @@ static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata,
 
  set_release_timer:
 
-		mod_timer(&tid_agg_rx->reorder_timer,
-			  tid_agg_rx->reorder_time[j] + 1 +
-			  HT_RX_REORDER_BUF_TIMEOUT);
+		if (!tid_agg_rx->removed)
+			mod_timer(&tid_agg_rx->reorder_timer,
+				  tid_agg_rx->reorder_time[j] + 1 +
+				  HT_RX_REORDER_BUF_TIMEOUT);
 	} else {
 		del_timer(&tid_agg_rx->reorder_timer);
 	}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 69bfe88..20443ee 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -162,6 +162,7 @@ struct tid_ampdu_tx {
  * @dialog_token: dialog token for aggregation session
  * @rcu_head: RCU head used for freeing this struct
  * @reorder_lock: serializes access to reorder buffer, see below.
+ * @removed: this session is removed (but might have been found due to RCU)
  *
  * This structure's lifetime is managed by RCU, assignments to
  * the array holding it must hold the aggregation mutex.
@@ -185,6 +186,7 @@ struct tid_ampdu_rx {
 	u16 buf_size;
 	u16 timeout;
 	u8 dialog_token;
+	bool removed;
 };
 
 /**
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 56/90] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 55/90] mac80211: fix RX A-MPDU session reorder timer deletion Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 57/90] tcp: prevent fetching dst twice in early demux code Kamal Mostafa
                   ` (33 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shachar Raindel, Jack Morgenstein, Or Gerlitz, Roland Dreier,
	Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Shachar Raindel <raindel@mellanox.com>

commit 8494057ab5e40df590ef6ef7d66324d3ae33356b upstream.

Properly verify that the resulting page aligned end address is larger
than both the start address and the length of the memory area requested.

Both the start and length arguments for ib_umem_get are controlled by
the user. A misbehaving user can provide values which will cause an
integer overflow when calculating the page aligned end address.

This overflow can cause also miscalculation of the number of pages
mapped, and additional logic issues.

Addresses: CVE-2014-8159
Signed-off-by: Shachar Raindel <raindel@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/core/umem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index a841123..055ebeb 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	if (dmasync)
 		dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
 
+	/*
+	 * If the combination of the addr and size requested for this memory
+	 * region causes an integer overflow, return error.
+	 */
+	if ((PAGE_ALIGN(addr + size) <= size) ||
+	    (PAGE_ALIGN(addr + size) <= addr))
+		return ERR_PTR(-EINVAL);
+
 	if (!can_do_mlock())
 		return ERR_PTR(-EPERM);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 57/90] tcp: prevent fetching dst twice in early demux code
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 56/90] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 58/90] net: use for_each_netdev_safe() in rtnl_group_changelink() Kamal Mostafa
                   ` (32 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit d0c294c53a771ae7e84506dfbd8c18c30f078735 ]

On s390x, gcc 4.8 compiles this part of tcp_v6_early_demux()

        struct dst_entry *dst = sk->sk_rx_dst;

        if (dst)
                dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);

to code reading sk->sk_rx_dst twice, once for the test and once for
the argument of ip6_dst_check() (dst_check() is inline). This allows
ip6_dst_check() to be called with null first argument, causing a crash.

Protect sk->sk_rx_dst access by ACCESS_ONCE() both in IPv4 and IPv6
TCP early demux code.

Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.")
Fixes: c7109986db3c ("ipv6: Early TCP socket demux")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_ipv4.c | 2 +-
 net/ipv6/tcp_ipv6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9f627b9..1f2cd0f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1875,7 +1875,7 @@ void tcp_v4_early_demux(struct sk_buff *skb)
 		skb->sk = sk;
 		skb->destructor = sock_edemux;
 		if (sk->sk_state != TCP_TIME_WAIT) {
-			struct dst_entry *dst = sk->sk_rx_dst;
+			struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst);
 
 			if (dst)
 				dst = dst_check(dst, 0);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index d540da2..c5851aa 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1605,7 +1605,7 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
 		skb->sk = sk;
 		skb->destructor = sock_edemux;
 		if (sk->sk_state != TCP_TIME_WAIT) {
-			struct dst_entry *dst = sk->sk_rx_dst;
+			struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst);
 
 			if (dst)
 				dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 58/90] net: use for_each_netdev_safe() in rtnl_group_changelink()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 57/90] tcp: prevent fetching dst twice in early demux code Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 59/90] xen-netfront: transmit fully GSO-sized packets Kamal Mostafa
                   ` (31 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cong Wang, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: WANG Cong <xiyou.wangcong@gmail.com>

commit d079535d5e1bf5e2e7c856bae2483414ea21e137 upstream.

In case we move the whole dev group to another netns,
we should call for_each_netdev_safe(), otherwise we get
a soft lockup:

 NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [ip:798]
 irq event stamp: 255424
 hardirqs last  enabled at (255423): [<ffffffff81a2aa95>] restore_args+0x0/0x30
 hardirqs last disabled at (255424): [<ffffffff81a2ad5a>] apic_timer_interrupt+0x6a/0x80
 softirqs last  enabled at (255422): [<ffffffff81079ebc>] __do_softirq+0x2c1/0x3a9
 softirqs last disabled at (255417): [<ffffffff8107a190>] irq_exit+0x41/0x95
 CPU: 0 PID: 798 Comm: ip Not tainted 4.0.0-rc4+ #881
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: ffff8800d1b88000 ti: ffff880119530000 task.ti: ffff880119530000
 RIP: 0010:[<ffffffff810cad11>]  [<ffffffff810cad11>] debug_lockdep_rcu_enabled+0x28/0x30
 RSP: 0018:ffff880119533778  EFLAGS: 00000246
 RAX: ffff8800d1b88000 RBX: 0000000000000002 RCX: 0000000000000038
 RDX: 0000000000000000 RSI: ffff8800d1b888c8 RDI: ffff8800d1b888c8
 RBP: ffff880119533778 R08: 0000000000000000 R09: 0000000000000000
 R10: 0000000000000000 R11: 000000000000b5c2 R12: 0000000000000246
 R13: ffff880119533708 R14: 00000000001d5a40 R15: ffff88011a7d5a40
 FS:  00007fc01315f740(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 00007f367a120988 CR3: 000000011849c000 CR4: 00000000000007f0
 Stack:
  ffff880119533798 ffffffff811ac868 ffffffff811ac831 ffffffff811ac828
  ffff8801195337c8 ffffffff811ac8c9 ffff8801195339b0 ffff8801197633e0
  0000000000000000 ffff8801195339b0 ffff8801195337d8 ffffffff811ad2d7
 Call Trace:
  [<ffffffff811ac868>] rcu_read_lock+0x37/0x6e
  [<ffffffff811ac831>] ? rcu_read_unlock+0x5f/0x5f
  [<ffffffff811ac828>] ? rcu_read_unlock+0x56/0x5f
  [<ffffffff811ac8c9>] __fget+0x2a/0x7a
  [<ffffffff811ad2d7>] fget+0x13/0x15
  [<ffffffff811be732>] proc_ns_fget+0xe/0x38
  [<ffffffff817c7714>] get_net_ns_by_fd+0x11/0x59
  [<ffffffff817df359>] rtnl_link_get_net+0x33/0x3e
  [<ffffffff817df3d7>] do_setlink+0x73/0x87b
  [<ffffffff810b28ce>] ? trace_hardirqs_off+0xd/0xf
  [<ffffffff81a2aa95>] ? retint_restore_args+0xe/0xe
  [<ffffffff817e0301>] rtnl_newlink+0x40c/0x699
  [<ffffffff817dffe0>] ? rtnl_newlink+0xeb/0x699
  [<ffffffff81a29246>] ? _raw_spin_unlock+0x28/0x33
  [<ffffffff8143ed1e>] ? security_capable+0x18/0x1a
  [<ffffffff8107da51>] ? ns_capable+0x4d/0x65
  [<ffffffff817de5ce>] rtnetlink_rcv_msg+0x181/0x194
  [<ffffffff817de407>] ? rtnl_lock+0x17/0x19
  [<ffffffff817de407>] ? rtnl_lock+0x17/0x19
  [<ffffffff817de44d>] ? __rtnl_unlock+0x17/0x17
  [<ffffffff818327c6>] netlink_rcv_skb+0x4d/0x93
  [<ffffffff817de42f>] rtnetlink_rcv+0x26/0x2d
  [<ffffffff81830f18>] netlink_unicast+0xcb/0x150
  [<ffffffff8183198e>] netlink_sendmsg+0x501/0x523
  [<ffffffff8115cba9>] ? might_fault+0x59/0xa9
  [<ffffffff817b5398>] ? copy_from_user+0x2a/0x2c
  [<ffffffff817b7b74>] sock_sendmsg+0x34/0x3c
  [<ffffffff817b7f6d>] ___sys_sendmsg+0x1b8/0x255
  [<ffffffff8115c5eb>] ? handle_pte_fault+0xbd5/0xd4a
  [<ffffffff8100a2b0>] ? native_sched_clock+0x35/0x37
  [<ffffffff8109e94b>] ? sched_clock_local+0x12/0x72
  [<ffffffff8109eb9c>] ? sched_clock_cpu+0x9e/0xb7
  [<ffffffff810cadbf>] ? rcu_read_lock_held+0x3b/0x3d
  [<ffffffff811ac1d8>] ? __fcheck_files+0x4c/0x58
  [<ffffffff811ac946>] ? __fget_light+0x2d/0x52
  [<ffffffff817b8adc>] __sys_sendmsg+0x42/0x60
  [<ffffffff817b8b0c>] SyS_sendmsg+0x12/0x1c
  [<ffffffff81a29e32>] system_call_fastpath+0x12/0x17

Fixes: e7ed828f10bd8 ("netlink: support setting devgroup parameters")
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/rtnetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index c538d8a..76b86c7 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1762,10 +1762,10 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
 		struct ifinfomsg *ifm,
 		struct nlattr **tb)
 {
-	struct net_device *dev;
+	struct net_device *dev, *aux;
 	int err;
 
-	for_each_netdev(net, dev) {
+	for_each_netdev_safe(net, dev, aux) {
 		if (dev->group == group) {
 			err = do_setlink(skb, dev, ifm, tb, NULL, 0);
 			if (err < 0)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 59/90] xen-netfront: transmit fully GSO-sized packets
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 58/90] net: use for_each_netdev_safe() in rtnl_group_changelink() Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 60/90] tcp: fix FRTO undo on cumulative ACK of SACKed range Kamal Mostafa
                   ` (30 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jonathan Davies, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jonathan Davies <jonathan.davies@citrix.com>

commit 0c36820e2ab7d943ab1188230fdf2149826d33c0 upstream.

xen-netfront limits transmitted skbs to be at most 44 segments in size. However,
GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448
bytes each. This slight reduction in the size of packets means a slight loss in
efficiency.

Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
    XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.

The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s
6c09fa09d) in determining when to split an skb into two is
    sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.

So the maximum permitted size of an skb is calculated to be
    (XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.

Intuitively, this looks like the wrong formula -- we don't need two TCP headers.
Instead, there is no need to deviate from the default gso_max_size of 65536 as
this already accommodates the size of the header.

Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments
of 1448 bytes each), as observed via tcpdump. This patch makes netfront send
skbs of up to 65160 bytes (45 segments of 1448 bytes each).

Similarly, the maximum allowable mtu does not need to subtract MAX_TCP_HEADER as
it relates to the size of the whole packet, including the header.

Fixes: 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/xen-netfront.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 9f02c5a..ef22ea8 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1074,8 +1074,7 @@ err:
 
 static int xennet_change_mtu(struct net_device *dev, int mtu)
 {
-	int max = xennet_can_sg(dev) ?
-		XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER : ETH_DATA_LEN;
+	int max = xennet_can_sg(dev) ? XEN_NETIF_MAX_TX_SIZE : ETH_DATA_LEN;
 
 	if (mtu > max)
 		return -EINVAL;
@@ -1356,8 +1355,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops);
 	SET_NETDEV_DEV(netdev, &dev->dev);
 
-	netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
-
 	np->netdev = netdev;
 
 	netif_carrier_off(netdev);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 60/90] tcp: fix FRTO undo on cumulative ACK of SACKed range
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 59/90] xen-netfront: transmit fully GSO-sized packets Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 61/90] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Kamal Mostafa
                   ` (29 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neal Cardwell, Yuchung Cheng, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Neal Cardwell <ncardwell@google.com>

[ Upstream commit 666b805150efd62f05810ff0db08f44a2370c937 ]

On processing cumulative ACKs, the FRTO code was not checking the
SACKed bit, meaning that there could be a spurious FRTO undo on a
cumulative ACK of a previously SACKed skb.

The FRTO code should only consider a cumulative ACK to indicate that
an original/unretransmitted skb is newly ACKed if the skb was not yet
SACKed.

The effect of the spurious FRTO undo would typically be to make the
connection think that all previously-sent packets were in flight when
they really weren't, leading to a stall and an RTO.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Fixes: e33099f96d99c ("tcp: implement RFC5682 F-RTO")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_input.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2ab6b821..2cc1313 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3060,10 +3060,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 			if (seq_rtt < 0) {
 				seq_rtt = ca_seq_rtt;
 			}
-			if (!(sacked & TCPCB_SACKED_ACKED))
+			if (!(sacked & TCPCB_SACKED_ACKED)) {
 				reord = min(pkts_acked, reord);
-			if (!after(scb->end_seq, tp->high_seq))
-				flag |= FLAG_ORIG_SACK_ACKED;
+				if (!after(scb->end_seq, tp->high_seq))
+					flag |= FLAG_ORIG_SACK_ACKED;
+			}
 		}
 
 		if (sacked & TCPCB_SACKED_ACKED)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 61/90] PCI: cpcihp: Add missing curly braces in cpci_configure_slot()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 60/90] tcp: fix FRTO undo on cumulative ACK of SACKed range Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 62/90] [media] sh_veu: v4l2_dev wasn't set Kamal Mostafa
                   ` (28 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Bjorn Helgaas, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit bc3b5b47c80da8838758731d423179262c9c36ec upstream.

I don't have this hardware but it looks like we weren't adding bridge
devices as intended.  Maybe the bridge is always the last device?

Fixes: 05b125004815 ("PCI: cpcihp: Iterate over all devices in slot, not functions 0-7")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/hotplug/cpci_hotplug_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index d3add98..4bc53f2 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -282,12 +282,13 @@ int __ref cpci_configure_slot(struct slot *slot)
 	}
 	parent = slot->dev->bus;
 
-	list_for_each_entry(dev, &parent->devices, bus_list)
+	list_for_each_entry(dev, &parent->devices, bus_list) {
 		if (PCI_SLOT(dev->devfn) != PCI_SLOT(slot->devfn))
 			continue;
 		if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
 		    (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
 			pci_hp_add_bridge(dev);
+	}
 
 
 	pci_assign_unassigned_bridge_resources(parent->self);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 62/90] [media] sh_veu: v4l2_dev wasn't set
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 61/90] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 63/90] [media] media: s5p-mfc: fix mmap support for 64bit arch Kamal Mostafa
                   ` (27 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans Verkuil <hverkuil@xs4all.nl>

commit ab3120300be067a2d41a027c41db0b2c662ab200 upstream.

The v4l2_dev field of struct video_device must be set correctly.
This was never done for this driver, so no video nodes were created
anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/platform/sh_veu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
index 744e43b..f698e32 100644
--- a/drivers/media/platform/sh_veu.c
+++ b/drivers/media/platform/sh_veu.c
@@ -1183,6 +1183,7 @@ static int sh_veu_probe(struct platform_device *pdev)
 	}
 
 	*vdev = sh_veu_videodev;
+	vdev->v4l2_dev = &veu->v4l2_dev;
 	spin_lock_init(&veu->lock);
 	mutex_init(&veu->fop_lock);
 	vdev->lock = &veu->fop_lock;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 63/90] [media] media: s5p-mfc: fix mmap support for 64bit arch
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 62/90] [media] sh_veu: v4l2_dev wasn't set Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 64/90] cpuidle: ACPI: do not overwrite name and description of C0 Kamal Mostafa
                   ` (26 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Kamil Debski, Mauro Carvalho Chehab, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 05b676ab42f624425d5f6519276e506b812fa058 upstream.

TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it
should not be used for defining offset boundary for mmaping buffers for
CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on
the CAPTURE queue on 64bit architectures (like ARM64).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 823812c..b8734ed 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -30,7 +30,7 @@
 
 /* Offset base used to differentiate between CAPTURE and OUTPUT
 *  while mmaping */
-#define DST_QUEUE_OFF_BASE      (TASK_SIZE / 2)
+#define DST_QUEUE_OFF_BASE	(1 << 30)
 
 #define MFC_BANK1_ALLOC_CTX	0
 #define MFC_BANK2_ALLOC_CTX	1
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 64/90] cpuidle: ACPI: do not overwrite name and description of C0
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (62 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 63/90] [media] media: s5p-mfc: fix mmap support for 64bit arch Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 65/90] ioctx_alloc(): fix vma (and file) leak on failure Kamal Mostafa
                   ` (25 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Schlichter, Rafael J. Wysocki, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Thomas Schlichter <thomas.schlichter@web.de>

commit c7e8bdf5872c5a8f5a6494e16fe839c38a0d3d3d upstream.

Fix a bug that leads to showing the name and description of C-state C0
as "<null>" in sysfs after the ACPI C-states changed (e.g. after AC->DC
or DC->AC
transition).

The function poll_idle_init() in drivers/cpuidle/driver.c initializes the
state 0 during cpuidle_register_driver(), so we better do not overwrite it
again with '\0' during acpi_processor_cst_has_changed().

Signed-off-by: Thomas Schlichter <thomas.schlichter@web.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/processor_idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ba60290..f1df2e4 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -973,7 +973,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
 		return -EINVAL;
 
 	drv->safe_state_index = -1;
-	for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
+	for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) {
 		drv->states[i].name[0] = '\0';
 		drv->states[i].desc[0] = '\0';
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 65/90] ioctx_alloc(): fix vma (and file) leak on failure
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 64/90] cpuidle: ACPI: do not overwrite name and description of C0 Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 66/90] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Kamal Mostafa
                   ` (24 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit deeb8525f9bcea60f5e86521880c1161de7a5829 upstream.

If we fail past the aio_setup_ring(), we need to destroy the
mapping.  We don't need to care about anybody having found ctx,
or added requests to it, since the last failure exit is exactly
the failure to make ctx visible to lookups.

Reproducer (based on one by Joe Mario <jmario@redhat.com>):

void count(char *p)
{
	char s[80];
	printf("%s: ", p);
	fflush(stdout);
	sprintf(s, "/bin/cat /proc/%d/maps|/bin/fgrep -c '/[aio] (deleted)'", getpid());
	system(s);
}

int main()
{
	io_context_t *ctx;
	int created, limit, i, destroyed;
	FILE *f;

	count("before");
	if ((f = fopen("/proc/sys/fs/aio-max-nr", "r")) == NULL)
		perror("opening aio-max-nr");
	else if (fscanf(f, "%d", &limit) != 1)
		fprintf(stderr, "can't parse aio-max-nr\n");
	else if ((ctx = calloc(limit, sizeof(io_context_t))) == NULL)
		perror("allocating aio_context_t array");
	else {
		for (i = 0, created = 0; i < limit; i++) {
			if (io_setup(1000, ctx + created) == 0)
				created++;
		}
		for (i = 0, destroyed = 0; i < created; i++)
			if (io_destroy(ctx[i]) == 0)
				destroyed++;
		printf("created %d, failed %d, destroyed %d\n",
			created, limit - created, destroyed);
		count("after");
	}
}

Found-by: Joe Mario <jmario@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/aio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/aio.c b/fs/aio.c
index a17e9ac..08bcd65 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -709,6 +709,9 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
 err_cleanup:
 	aio_nr_sub(ctx->max_reqs);
 err_ctx:
+	atomic_set(&ctx->dead, 1);
+	if (ctx->mmap_size)
+		vm_munmap(ctx->mmap_base, ctx->mmap_size);
 	aio_free_ring(ctx);
 err:
 	mutex_unlock(&ctx->ring_lock);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 66/90] ALSA: hda/realtek - Make more stable to get pin sense for ALC283
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 65/90] ioctx_alloc(): fix vma (and file) leak on failure Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 67/90] be2iscsi: Fix kernel panic when device initialization fails Kamal Mostafa
                   ` (23 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kailang Yang, Takashi Iwai, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Kailang Yang <kailang@realtek.com>

commit a59d7199f62b8336570972dcc288321d0ec999fe upstream.

Pin sense will active when power pin is wake up.
Power pin will not wake up immediately during resume state.
Add some delay to wait for power pin activated.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index deec881..c7b1917 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2830,6 +2830,8 @@ static void alc283_init(struct hda_codec *codec)
 
 	if (!hp_pin)
 		return;
+
+	msleep(30);
 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
 
 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 67/90] be2iscsi: Fix kernel panic when device initialization fails
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 66/90] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 68/90] Defer processing of REQ_PREEMPT requests for blocked devices Kamal Mostafa
                   ` (22 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: John Soni Jose, James Bottomley, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: John Soni Jose <sony.john-n@emulex.com>

commit 2e7cee027b26cbe7e6685a7a14bd2850bfe55d33 upstream.

Kernel panic was happening as iscsi_host_remove() was called on
a host which was not yet added.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 2d5a97d..4fbc8db 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5684,9 +5684,9 @@ free_port:
 hba_free:
 	if (phba->msix_enabled)
 		pci_disable_msix(phba->pcidev);
-	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
+	pci_set_drvdata(pcidev, NULL);
 disable_pci:
 	pci_disable_device(pcidev);
 	return ret;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 68/90] Defer processing of REQ_PREEMPT requests for blocked devices
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 67/90] be2iscsi: Fix kernel panic when device initialization fails Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 69/90] ALSA: hda - Fix headphone pin config for Lifebook T731 Kamal Mostafa
                   ` (21 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, James Bottomley, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit bba0bdd7ad4713d82338bcd9b72d57e9335a664b upstream.

SCSI transport drivers and SCSI LLDs block a SCSI device if the
transport layer is not operational. This means that in this state
no requests should be processed, even if the REQ_PREEMPT flag has
been set. This patch avoids that a rescan shortly after a cable
pull sporadically triggers the following kernel oops:

BUG: unable to handle kernel paging request at ffffc9001a6bc084
IP: [<ffffffffa04e08f2>] mlx4_ib_post_send+0xd2/0xb30 [mlx4_ib]
Process rescan-scsi-bus (pid: 9241, threadinfo ffff88053484a000, task ffff880534aae100)
Call Trace:
 [<ffffffffa0718135>] srp_post_send+0x65/0x70 [ib_srp]
 [<ffffffffa071b9df>] srp_queuecommand+0x1cf/0x3e0 [ib_srp]
 [<ffffffffa0001ff1>] scsi_dispatch_cmd+0x101/0x280 [scsi_mod]
 [<ffffffffa0009ad1>] scsi_request_fn+0x411/0x4d0 [scsi_mod]
 [<ffffffff81223b37>] __blk_run_queue+0x27/0x30
 [<ffffffff8122a8d2>] blk_execute_rq_nowait+0x82/0x110
 [<ffffffff8122a9c2>] blk_execute_rq+0x62/0xf0
 [<ffffffffa000b0e8>] scsi_execute+0xe8/0x190 [scsi_mod]
 [<ffffffffa000b2f3>] scsi_execute_req+0xa3/0x130 [scsi_mod]
 [<ffffffffa000c1aa>] scsi_probe_lun+0x17a/0x450 [scsi_mod]
 [<ffffffffa000ce86>] scsi_probe_and_add_lun+0x156/0x480 [scsi_mod]
 [<ffffffffa000dc2f>] __scsi_scan_target+0xdf/0x1f0 [scsi_mod]
 [<ffffffffa000dfa3>] scsi_scan_host_selected+0x183/0x1c0 [scsi_mod]
 [<ffffffffa000edfb>] scsi_scan+0xdb/0xe0 [scsi_mod]
 [<ffffffffa000ee13>] store_scan+0x13/0x20 [scsi_mod]
 [<ffffffff811c8d9b>] sysfs_write_file+0xcb/0x160
 [<ffffffff811589de>] vfs_write+0xce/0x140
 [<ffffffff81158b53>] sys_write+0x53/0xa0
 [<ffffffff81464592>] system_call_fastpath+0x16/0x1b
 [<00007f611c9d9300>] 0x7f611c9d92ff

Reported-by: Max Gurtuvoy <maxg@mellanox.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/scsi_lib.c   | 4 +++-
 include/linux/blk_types.h | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 64e487a..719bd82 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1258,9 +1258,11 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
 				    "rejecting I/O to dead device\n");
 			ret = BLKPREP_KILL;
 			break;
-		case SDEV_QUIESCE:
 		case SDEV_BLOCK:
 		case SDEV_CREATED_BLOCK:
+			ret = BLKPREP_DEFER;
+			break;
+		case SDEV_QUIESCE:
 			/*
 			 * If the devices is blocked we defer normal commands.
 			 */
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 238ef0e..484d48b 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -170,7 +170,9 @@ enum rq_flag_bits {
 	__REQ_ELVPRIV,		/* elevator private data attached */
 	__REQ_FAILED,		/* set if the request failed */
 	__REQ_QUIET,		/* don't worry about errors */
-	__REQ_PREEMPT,		/* set for "ide_preempt" requests */
+	__REQ_PREEMPT,		/* set for "ide_preempt" requests and also
+				   for requests for which the SCSI "quiesce"
+				   state must be ignored. */
 	__REQ_ALLOCED,		/* request came from our alloc pool */
 	__REQ_COPY_USER,	/* contains copies of user pages */
 	__REQ_FLUSH_SEQ,	/* request for flush sequence */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 69/90] ALSA: hda - Fix headphone pin config for Lifebook T731
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (67 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 68/90] Defer processing of REQ_PREEMPT requests for blocked devices Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 70/90] ocfs2: _really_ sync the right range Kamal Mostafa
                   ` (20 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit cc7016ab1a22fb26f388c2fb2b692b89897cbc3e upstream.

Some BIOS version of Fujitsu Lifebook T731 seems to set up the
headphone pin (0x21) without the assoc number 0x0f while it's set only
to the output on the docking port (0x1a).  With the recent commit
[03ad6a8c93b6: ALSA: hda - Fix "PCM" name being used on one DAC when
 there are two DACs], this resulted in the weird mixer element
mapping where the headphone on the laptop is assigned as a shared
volume with the speaker and the docking port is assigned as an
individual headphone.

This patch improves the situation by correcting the headphone pin
config to the more appropriate value.

Reported-and-tested-by: Taylor Smock <smocktaylor@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c7b1917..1bfebba 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3979,6 +3979,7 @@ enum {
 	ALC269_FIXUP_QUANTA_MUTE,
 	ALC269_FIXUP_LIFEBOOK,
 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
+	ALC269_FIXUP_LIFEBOOK_HP_PIN,
 	ALC269_FIXUP_AMIC,
 	ALC269_FIXUP_DMIC,
 	ALC269VB_FIXUP_AMIC,
@@ -4109,6 +4110,13 @@ static const struct hda_fixup alc269_fixups[] = {
 			{ }
 		},
 	},
+	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x21, 0x0221102f }, /* HP out */
+			{ }
+		},
+	},
 	[ALC269_FIXUP_AMIC] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
@@ -4534,6 +4542,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
+	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 70/90] ocfs2: _really_ sync the right range
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 69/90] ALSA: hda - Fix headphone pin config for Lifebook T731 Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 71/90] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Kamal Mostafa
                   ` (19 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 64b4e2526d1cf6e6a4db6213d6e2b6e6ab59479a upstream.

"ocfs2 syncs the wrong range" had been broken; prior to it the
code was doing the wrong thing in case of O_APPEND, all right,
but _after_ it we were syncing the wrong range in 100% cases.
*ppos, aka iocb->ki_pos is incremented prior to that point,
so we are always doing sync on the area _after_ the one we'd
written to.

Spotted by Joseph Qi <joseph.qi@huawei.com> back in January;
unfortunately, I'd missed his mail back then ;-/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ocfs2/file.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5850a81..7f47331 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2368,10 +2368,14 @@ out_dio:
 	/* buffered aio wouldn't have proper lock coverage today */
 	BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
 
+	if (unlikely(written <= 0))
+		goto no_sync;
+
 	if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
 	    ((file->f_flags & O_DIRECT) && !direct_io)) {
-		ret = filemap_fdatawrite_range(file->f_mapping, *ppos,
-					       *ppos + count - 1);
+		ret = filemap_fdatawrite_range(file->f_mapping,
+					       iocb->ki_pos - written,
+					       iocb->ki_pos - 1);
 		if (ret < 0)
 			written = ret;
 
@@ -2384,10 +2388,12 @@ out_dio:
 		}
 
 		if (!ret)
-			ret = filemap_fdatawait_range(file->f_mapping, *ppos,
-						      *ppos + count - 1);
+			ret = filemap_fdatawait_range(file->f_mapping,
+						      iocb->ki_pos - written,
+						      iocb->ki_pos - 1);
 	}
 
+no_sync:
 	/*
 	 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
 	 * function pointer which is called when o_direct io completes so that
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 71/90] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 70/90] ocfs2: _really_ sync the right range Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 72/90] iscsi target: fix oops when adding reject pdu Kamal Mostafa
                   ` (18 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry M. Fedin, Takashi Iwai, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Dmitry M. Fedin" <dmitry.fedin@gmail.com>

commit 3dc8523fa7412e731441c01fb33f003eb3cfece1 upstream.

Adds an entry for Creative USB X-Fi to the rc_config array in
mixer_quirks.c to allow use of volume knob on the device.
Adds support for newer X-Fi Pro card, known as "Model No. SB1095"
with USB ID "041e:3237"

Signed-off-by: Dmitry M. Fedin <dmitry.fedin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/mixer_quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 5a723df..a82ec53 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -178,6 +178,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
 	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x30df), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
+	{ USB_ID(0x041e, 0x3237), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 72/90] iscsi target: fix oops when adding reject pdu
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 71/90] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 73/90] net/mlx4_en: Call register_netdevice in the proper location Kamal Mostafa
                   ` (17 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Christie, Nicholas Bellinger, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mike Christie <michaelc@cs.wisc.edu>

commit b815fc12d4dd2b5586184fb4f867caff05a810d4 upstream.

This fixes a oops due to a double list add when adding a reject PDU for
iscsit_allocate_iovecs allocation failures. The cmd has already been
added to the conn_cmd_list in iscsit_setup_scsi_cmd, so this has us call
iscsit_reject_cmd.

Note that for ERL0 the reject PDU is not actually sent, so this patch
is not completely tested. Just verified we do not oops. The problem is the
add reject functions return -1 which is returned all the way up to
iscsi_target_rx_thread which for ERL0 will drop the connection.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 8789ba0..505aa4e 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1164,7 +1164,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	 * traditional iSCSI block I/O.
 	 */
 	if (iscsit_allocate_iovecs(cmd) < 0) {
-		return iscsit_add_reject_cmd(cmd,
+		return iscsit_reject_cmd(cmd,
 				ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
 	}
 	immed_data = cmd->immediate_data;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 73/90] net/mlx4_en: Call register_netdevice in the proper location
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 72/90] iscsi target: fix oops when adding reject pdu Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 74/90] ipv6: protect skb->sk accesses from recursive dereference inside the stack Kamal Mostafa
                   ` (16 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ido Shamay, Or Gerlitz, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ido Shamay <idos@mellanox.com>

[ Upstream commit e5eda89d97ec256ba14e7e861387cc0468259c18 ]

Netdevice registration should be performed a the end of the driver
initialization flow. If we don't do that, after calling register_netdevice,
device callbacks may be issued by higher layers of the stack before
final configuration of the device is done.

For example (VXLAN configuration race), mlx4_SET_PORT_VXLAN was issued
after the register_netdev command. System network scripts may configure
the interface (UP) right after the registration, which also attach
unicast VXLAN steering rule, before mlx4_SET_PORT_VXLAN was called,
causing the firmware to fail the rule attachment.

Fixes: 837052d0ccc5 ("net/mlx4_en: Add netdev support for TCP/IP offloads of vxlan tunneling")
Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index c23f2ae..8126b04 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2366,13 +2366,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 	netif_carrier_off(dev);
 	mlx4_en_set_default_moderation(priv);
 
-	err = register_netdev(dev);
-	if (err) {
-		en_err(priv, "Netdev registration failed for port %d\n", port);
-		goto out;
-	}
-	priv->registered = 1;
-
 	en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
 	en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
 
@@ -2403,6 +2396,14 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		queue_delayed_work(mdev->workqueue, &priv->service_task,
 				   SERVICE_TASK_DELAY);
 
+	err = register_netdev(dev);
+	if (err) {
+		en_err(priv, "Netdev registration failed for port %d\n", port);
+		goto out;
+	}
+
+	priv->registered = 1;
+
 	return 0;
 
 out:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 74/90] ipv6: protect skb->sk accesses from recursive dereference inside the stack
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 73/90] net/mlx4_en: Call register_netdevice in the proper location Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 75/90] tcp: tcp_make_synack() should clear skb->tstamp Kamal Mostafa
                   ` (15 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Pirko, Hannes Frederic Sowa, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "hannes@stressinduktion.org" <hannes@stressinduktion.org>

[ Upstream commit f60e5990d9c1424af9dbca60a23ba2a1c7c1ce90 ]

We should not consult skb->sk for output decisions in xmit recursion
levels > 0 in the stack. Otherwise local socket settings could influence
the result of e.g. tunnel encapsulation process.

ipv6 does not conform with this in three places:

1) ip6_fragment: we do consult ipv6_npinfo for frag_size

2) sk_mc_loop in ipv6 uses skb->sk and checks if we should
   loop the packet back to the local socket

3) ip6_skb_dst_mtu could query the settings from the user socket and
   force a wrong MTU

Furthermore:
In sk_mc_loop we could potentially land in WARN_ON(1) if we use a
PF_PACKET socket ontop of an IPv6-backed vxlan device.

Reuse xmit_recursion as we are currently only interested in protecting
tunnel devices.

Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/netdevice.h |  6 ++++++
 include/net/ip.h          | 16 ----------------
 include/net/ip6_route.h   |  3 ++-
 include/net/sock.h        |  2 ++
 net/core/dev.c            |  4 +++-
 net/core/sock.c           | 19 +++++++++++++++++++
 net/ipv6/ip6_output.c     |  3 ++-
 7 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index dfc5271..abe5098 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1838,6 +1838,12 @@ void netdev_freemem(struct net_device *dev);
 void synchronize_net(void);
 int init_dummy_netdev(struct net_device *dev);
 
+DECLARE_PER_CPU(int, xmit_recursion);
+static inline int dev_recursion_level(void)
+{
+	return this_cpu_read(xmit_recursion);
+}
+
 struct net_device *dev_get_by_index(struct net *net, int ifindex);
 struct net_device *__dev_get_by_index(struct net *net, int ifindex);
 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
diff --git a/include/net/ip.h b/include/net/ip.h
index 4613b19..9651ebf 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -379,22 +379,6 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
 
 #endif
 
-static inline int sk_mc_loop(struct sock *sk)
-{
-	if (!sk)
-		return 1;
-	switch (sk->sk_family) {
-	case AF_INET:
-		return inet_sk(sk)->mc_loop;
-#if IS_ENABLED(CONFIG_IPV6)
-	case AF_INET6:
-		return inet6_sk(sk)->mc_loop;
-#endif
-	}
-	WARN_ON(1);
-	return 1;
-}
-
 bool ip_call_ra_chain(struct sk_buff *skb);
 
 /*
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 9302699..299833a 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -181,7 +181,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
 
 static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
 {
-	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
+	struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
+				inet6_sk(skb->sk) : NULL;
 
 	return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ?
 	       skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
diff --git a/include/net/sock.h b/include/net/sock.h
index 5db5b7f..c4f2c65 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1798,6 +1798,8 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
 
 struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
 
+bool sk_mc_loop(struct sock *sk);
+
 static inline bool sk_can_gso(const struct sock *sk)
 {
 	return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
diff --git a/net/core/dev.c b/net/core/dev.c
index 7fb4317..36e12a3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2768,7 +2768,9 @@ static void skb_update_prio(struct sk_buff *skb)
 #define skb_update_prio(skb)
 #endif
 
-static DEFINE_PER_CPU(int, xmit_recursion);
+DEFINE_PER_CPU(int, xmit_recursion);
+EXPORT_SYMBOL(xmit_recursion);
+
 #define RECURSION_LIMIT 10
 
 /**
diff --git a/net/core/sock.c b/net/core/sock.c
index ee847676..8235166 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -659,6 +659,25 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
 		sock_reset_flag(sk, bit);
 }
 
+bool sk_mc_loop(struct sock *sk)
+{
+	if (dev_recursion_level())
+		return false;
+	if (!sk)
+		return true;
+	switch (sk->sk_family) {
+	case AF_INET:
+		return inet_sk(sk)->mc_loop;
+#if IS_ENABLED(CONFIG_IPV6)
+	case AF_INET6:
+		return inet6_sk(sk)->mc_loop;
+#endif
+	}
+	WARN_ON(1);
+	return true;
+}
+EXPORT_SYMBOL(sk_mc_loop);
+
 /*
  *	This is meant for all protocols to use and covers goings on
  *	at the socket level. Everything here is generic.
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 66fe1f64..627ce5a 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -534,7 +534,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 {
 	struct sk_buff *frag;
 	struct rt6_info *rt = (struct rt6_info*)skb_dst(skb);
-	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
+	struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
+				inet6_sk(skb->sk) : NULL;
 	struct ipv6hdr *tmp_hdr;
 	struct frag_hdr *fh;
 	unsigned int mtu, hlen, left, len;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 75/90] tcp: tcp_make_synack() should clear skb->tstamp
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 74/90] ipv6: protect skb->sk accesses from recursive dereference inside the stack Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 76/90] 8139cp: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
                   ` (14 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit b50edd7812852d989f2ef09dcfc729690f54a42d ]

I noticed tcpdump was giving funky timestamps for locally
generated SYNACK messages on loopback interface.

11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
945476042:945476042(0) win 43690 <mss 65495,nop,nop,sackOK,nop,wscale 7>

20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
3160535375:3160535375(0) ack 945476043 win 43690 <mss
65495,nop,nop,sackOK,nop,wscale 7>

This is because we need to clear skb->tstamp before
entering lower stack, otherwise net_timestamp_check()
does not set skb->tstamp.

Fixes: 7faee5c0d514 ("tcp: remove TCP_SKB_CB(skb)->when")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_output.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 918f2db..cfb4389 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2770,6 +2770,8 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 	}
 #endif
 
+	/* Do not fool tcpdump (if any), clean our debris */
+	skb->tstamp.tv64 = 0;
 	return skb;
 }
 EXPORT_SYMBOL(tcp_make_synack);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 76/90] 8139cp: Call dev_kfree_skby_any instead of kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 75/90] tcp: tcp_make_synack() should clear skb->tstamp Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 77/90] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
                   ` (13 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 508f81d517ed1f3f0197df63ea7ab5cd91b6f3b3 upstream.

Replace kfree_skb with dev_kfree_skb_any in cp_start_xmit
as it can be called in both hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/realtek/8139cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 737c1a8..a3c1daa 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -899,7 +899,7 @@ out_unlock:
 
 	return NETDEV_TX_OK;
 out_dma_error:
-	kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 	cp->dev->stats.tx_dropped++;
 	goto out_unlock;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 77/90] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 76/90] 8139cp: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 78/90] r8169: " Kamal Mostafa
                   ` (12 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit a2ccd2e4bd70122523a7bf21cec4dd6e34427089 upstream.

Replace dev_kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/realtek/8139too.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index da5972e..8cb2f35 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1717,9 +1717,9 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
 		if (len < ETH_ZLEN)
 			memset(tp->tx_buf[entry], 0, ETH_ZLEN);
 		skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 	} else {
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		dev->stats.tx_dropped++;
 		return NETDEV_TX_OK;
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 78/90] r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 77/90] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 79/90] bonding: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
                   ` (11 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 989c9ba104d9ce53c1ca918262f3fdfb33aca12a upstream.

Replace dev_kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/realtek/r8169.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index c737f0e..7202311 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5835,7 +5835,7 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start,
 					     tp->TxDescArray + entry);
 			if (skb) {
 				tp->dev->stats.tx_dropped++;
-				dev_kfree_skb(skb);
+				dev_kfree_skb_any(skb);
 				tx_skb->skb = NULL;
 			}
 		}
@@ -6060,7 +6060,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 err_dma_1:
 	rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd);
 err_dma_0:
-	dev_kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 err_update_stats:
 	dev->stats.tx_dropped++;
 	return NETDEV_TX_OK;
@@ -6143,7 +6143,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 			tp->tx_stats.packets++;
 			tp->tx_stats.bytes += tx_skb->skb->len;
 			u64_stats_update_end(&tp->tx_stats.syncp);
-			dev_kfree_skb(tx_skb->skb);
+			dev_kfree_skb_any(tx_skb->skb);
 			tx_skb->skb = NULL;
 		}
 		dirty_tx++;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 79/90] bonding: Call dev_kfree_skby_any instead of kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 78/90] r8169: " Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 80/90] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
                   ` (10 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 2bb77ab42a6a40162a367b80394b96bb756ad5f1 upstream.

Replace kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/bonding/bond_3ad.c  |  2 +-
 drivers/net/bonding/bond_alb.c  |  2 +-
 drivers/net/bonding/bond_main.c | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index dcf2ee8..dc0c56a 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2456,7 +2456,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
 out:
 	if (res) {
 		/* no suitable interface, frame not sent */
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 	}
 
 	return NETDEV_TX_OK;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index b215df1..51d09f9 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1481,7 +1481,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
 
 	if (res) {
 		/* no suitable interface, frame not sent */
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 	}
 
 	return NETDEV_TX_OK;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a656d4c..db8844d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3577,7 +3577,7 @@ void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id)
 		}
 	}
 	/* no slave that can tx has been found */
-	kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 }
 
 /**
@@ -3656,7 +3656,7 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
 	if (slave)
 		bond_dev_queue_xmit(bond, skb, slave->dev);
 	else
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 
 	return NETDEV_TX_OK;
 }
@@ -3704,7 +3704,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
 	if (slave && IS_UP(slave->dev) && slave->link == BOND_LINK_UP)
 		bond_dev_queue_xmit(bond, skb, slave->dev);
 	else
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 
 	return NETDEV_TX_OK;
 }
@@ -3795,7 +3795,7 @@ static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev
 		pr_err("%s: Error: Unknown bonding mode %d\n",
 		       dev->name, bond->params.mode);
 		WARN_ON_ONCE(1);
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		return NETDEV_TX_OK;
 	}
 }
@@ -3816,7 +3816,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (bond_has_slaves(bond))
 		ret = __bond_start_xmit(skb, dev);
 	else
-		kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 	rcu_read_unlock();
 
 	return ret;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 80/90] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 79/90] bonding: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 81/90] tg3: " Kamal Mostafa
                   ` (9 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit f458b2ee93ee3606c83f76213fbe49e026bac754 upstream.

Replace dev_kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/broadcom/bnx2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 8409bc1..fc40022 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -2869,7 +2869,7 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 		sw_cons = BNX2_NEXT_TX_BD(sw_cons);
 
 		tx_bytes += skb->len;
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		tx_pkt++;
 		if (tx_pkt == budget)
 			break;
@@ -6622,7 +6622,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	mapping = dma_map_single(&bp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE);
 	if (dma_mapping_error(&bp->pdev->dev, mapping)) {
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		return NETDEV_TX_OK;
 	}
 
@@ -6715,7 +6715,7 @@ dma_error:
 			       PCI_DMA_TODEVICE);
 	}
 
-	dev_kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 	return NETDEV_TX_OK;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 81/90] tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 80/90] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 82/90] ixgb: " Kamal Mostafa
                   ` (8 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 497a27b9e1bcf6dbaea7a466cfcd866927e1b431 upstream.

Replace dev_kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index fd16844..a2b0e6a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6577,7 +6577,7 @@ static void tg3_tx(struct tg3_napi *tnapi)
 		pkts_compl++;
 		bytes_compl += skb->len;
 
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 
 		if (unlikely(tx_bug)) {
 			tg3_tx_recover(tp);
@@ -6909,7 +6909,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
 		if (len > (tp->dev->mtu + ETH_HLEN) &&
 		    skb->protocol != htons(ETH_P_8021Q) &&
 		    skb->protocol != htons(ETH_P_8021AD)) {
-			dev_kfree_skb(skb);
+			dev_kfree_skb_any(skb);
 			goto drop_it_no_recycle;
 		}
 
@@ -7792,7 +7792,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
 					  PCI_DMA_TODEVICE);
 		/* Make sure the mapping succeeded */
 		if (pci_dma_mapping_error(tp->pdev, new_addr)) {
-			dev_kfree_skb(new_skb);
+			dev_kfree_skb_any(new_skb);
 			ret = -1;
 		} else {
 			u32 save_entry = *entry;
@@ -7807,13 +7807,13 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
 					    new_skb->len, base_flags,
 					    mss, vlan)) {
 				tg3_tx_skb_unmap(tnapi, save_entry, -1);
-				dev_kfree_skb(new_skb);
+				dev_kfree_skb_any(new_skb);
 				ret = -1;
 			}
 		}
 	}
 
-	dev_kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 	*pskb = new_skb;
 	return ret;
 }
@@ -7856,7 +7856,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
 	} while (segs);
 
 tg3_tso_bug_end:
-	dev_kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 
 	return NETDEV_TX_OK;
 }
@@ -8094,7 +8094,7 @@ dma_error:
 	tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, --i);
 	tnapi->tx_buffers[tnapi->tx_prod].skb = NULL;
 drop:
-	dev_kfree_skb(skb);
+	dev_kfree_skb_any(skb);
 drop_nofree:
 	tp->tx_dropped++;
 	return NETDEV_TX_OK;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 82/90] ixgb: Call dev_kfree_skby_any instead of dev_kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 81/90] tg3: " Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 83/90] benet: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
                   ` (7 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit f7e79913a1d6a6139211ead3b03579b317d25a1f upstream.

Replace dev_kfree_skb with dev_kfree_skb_any in functions that can
be called in hard irq and other contexts.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index 57e390c..f42c201 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1521,12 +1521,12 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	int tso;
 
 	if (test_bit(__IXGB_DOWN, &adapter->flags)) {
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		return NETDEV_TX_OK;
 	}
 
 	if (skb->len <= 0) {
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		return NETDEV_TX_OK;
 	}
 
@@ -1543,7 +1543,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
 	tso = ixgb_tso(adapter, skb);
 	if (tso < 0) {
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		return NETDEV_TX_OK;
 	}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 83/90] benet: Call dev_kfree_skby_any instead of kfree_skb.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 82/90] ixgb: " Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 84/90] gianfar: Carefully free skbs in functions called by netpoll Kamal Mostafa
                   ` (6 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit d8ec2c02caa3515f35d6c33eedf529394c419298 upstream.

Replace free_skb with dev_kfree_skb_any in be_tx_compl_process as
which can be called in hard irq by netpoll, softirq context
by normal napi polling, and in normal sleepable context
by the network device close method.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index a67ddf8..8e410b5 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1881,7 +1881,7 @@ static u16 be_tx_compl_process(struct be_adapter *adapter,
 		queue_tail_inc(txq);
 	} while (cur_index != last_index);
 
-	kfree_skb(sent_skb);
+	dev_kfree_skb_any(sent_skb);
 	return num_wrbs;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 84/90] gianfar: Carefully free skbs in functions called by netpoll.
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 83/90] benet: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 85/90] ip_forward: Drop frames with attached skb->sk Kamal Mostafa
                   ` (5 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit c9974ad4aeb36003860100221a594f3c0ccc3f78 upstream.

netpoll can call functions in hard irq context that are ordinarily
called in lesser contexts.  For those functions use dev_kfree_skb_any
and dev_consume_skb_any so skbs are freed safely from hard irq
context.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/freescale/gianfar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index b14d790..fd66535 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2139,13 +2139,13 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		skb_new = skb_realloc_headroom(skb, fcb_len);
 		if (!skb_new) {
 			dev->stats.tx_errors++;
-			kfree_skb(skb);
+			dev_kfree_skb_any(skb);
 			return NETDEV_TX_OK;
 		}
 
 		if (skb->sk)
 			skb_set_owner_w(skb_new, skb->sk);
-		consume_skb(skb);
+		dev_consume_skb_any(skb);
 		skb = skb_new;
 	}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 85/90] ip_forward: Drop frames with attached skb->sk
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 84/90] gianfar: Carefully free skbs in functions called by netpoll Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 86/90] tcp: fix possible deadlock in tcp_send_fin() Kamal Mostafa
                   ` (4 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Poehn, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: =?UTF-8?q?Sebastian=20P=C3=B6hn?= <sebastian.poehn@gmail.com>

[ Upstream commit 2ab957492d13bb819400ac29ae55911d50a82a13 ]

Initial discussion was:
[FYI] xfrm: Don't lookup sk_policy for timewait sockets

Forwarded frames should not have a socket attached. Especially
tw sockets will lead to panics later-on in the stack.

This was observed with TPROXY assigning a tw socket and broken
policy routing (misconfigured). As a result frame enters
forwarding path instead of input. We cannot solve this in
TPROXY as it cannot know that policy routing is broken.

v2:
Remove useless comment

Signed-off-by: Sebastian Poehn <sebastian.poehn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/ip_forward.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 31ee5c6..479e8a6 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -126,6 +126,9 @@ int ip_forward(struct sk_buff *skb)
 	struct rtable *rt;	/* Route we use */
 	struct ip_options *opt	= &(IPCB(skb)->opt);
 
+	if (unlikely(skb->sk))
+		goto drop;
+
 	if (skb_warn_if_lro(skb))
 		goto drop;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 86/90] tcp: fix possible deadlock in tcp_send_fin()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 85/90] ip_forward: Drop frames with attached skb->sk Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 87/90] tcp: avoid looping " Kamal Mostafa
                   ` (3 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit d83769a580f1132ac26439f50068a29b02be535e ]

Using sk_stream_alloc_skb() in tcp_send_fin() is dangerous in
case a huge process is killed by OOM, and tcp_mem[2] is hit.

To be able to free memory we need to make progress, so this
patch allows FIN packets to not care about tcp_mem[2], if
skb allocation succeeded.

In a follow-up patch, we might abort tcp_send_fin() infinite loop
in case TIF_MEMDIE is set on this thread, as memory allocator
did its best getting extra memory already.

This patch reverts d22e15371811 ("tcp: fix tcp fin memory accounting")

Fixes: d22e15371811 ("tcp: fix tcp fin memory accounting")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_output.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index cfb4389..4a9bce5 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2569,6 +2569,21 @@ begin_fwd:
 	}
 }
 
+/* We allow to exceed memory limits for FIN packets to expedite
+ * connection tear down and (memory) recovery.
+ * Otherwise tcp_send_fin() could loop forever.
+ */
+static void sk_forced_wmem_schedule(struct sock *sk, int size)
+{
+	int amt, status;
+
+	if (size <= sk->sk_forward_alloc)
+		return;
+	amt = sk_mem_pages(size);
+	sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
+	sk_memory_allocated_add(sk, amt, &status);
+}
+
 /* Send a fin.  The caller locks the socket for us.  This cannot be
  * allowed to fail queueing a FIN frame under any circumstances.
  */
@@ -2591,11 +2606,14 @@ void tcp_send_fin(struct sock *sk)
 	} else {
 		/* Socket is locked, keep trying until memory is available. */
 		for (;;) {
-			skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
+			skb = alloc_skb_fclone(MAX_TCP_HEADER,
+					       sk->sk_allocation);
 			if (skb)
 				break;
 			yield();
 		}
+		skb_reserve(skb, MAX_TCP_HEADER);
+		sk_forced_wmem_schedule(sk, skb->truesize);
 		/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
 		tcp_init_nondata_skb(skb, tp->write_seq,
 				     TCPHDR_ACK | TCPHDR_FIN);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 87/90] tcp: avoid looping in tcp_send_fin()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 86/90] tcp: fix possible deadlock in tcp_send_fin() Kamal Mostafa
@ 2015-05-05 20:54 ` Kamal Mostafa
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 88/90] net: do not deplete pfmemalloc reserve Kamal Mostafa
                   ` (2 subsequent siblings)
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:54 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 845704a535e9b3c76448f52af1b70e4422ea03fd ]

Presence of an unbound loop in tcp_send_fin() had always been hard
to explain when analyzing crash dumps involving gigantic dying processes
with millions of sockets.

Lets try a different strategy :

In case of memory pressure, try to add the FIN flag to last packet
in write queue, even if packet was already sent. TCP stack will
be able to deliver this FIN after a timeout event. Note that this
FIN being delivered by a retransmit, it also carries a Push flag
given our current implementation.

By checking sk_under_memory_pressure(), we anticipate that cooking
many FIN packets might deplete tcp memory.

In the case we could not allocate a packet, even with __GFP_WAIT
allocation, then not sending a FIN seems quite reasonable if it allows
to get rid of this socket, free memory, and not block the process from
eventually doing other useful work.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_output.c | 50 +++++++++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 4a9bce5..3adf183 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2571,7 +2571,8 @@ begin_fwd:
 
 /* We allow to exceed memory limits for FIN packets to expedite
  * connection tear down and (memory) recovery.
- * Otherwise tcp_send_fin() could loop forever.
+ * Otherwise tcp_send_fin() could be tempted to either delay FIN
+ * or even be forced to close flow without any FIN.
  */
 static void sk_forced_wmem_schedule(struct sock *sk, int size)
 {
@@ -2584,33 +2585,40 @@ static void sk_forced_wmem_schedule(struct sock *sk, int size)
 	sk_memory_allocated_add(sk, amt, &status);
 }
 
-/* Send a fin.  The caller locks the socket for us.  This cannot be
- * allowed to fail queueing a FIN frame under any circumstances.
+/* Send a FIN. The caller locks the socket for us.
+ * We should try to send a FIN packet really hard, but eventually give up.
  */
 void tcp_send_fin(struct sock *sk)
 {
+	struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
-	struct sk_buff *skb = tcp_write_queue_tail(sk);
-	int mss_now;
 
-	/* Optimization, tack on the FIN if we have a queue of
-	 * unsent frames.  But be careful about outgoing SACKS
-	 * and IP options.
+	/* Optimization, tack on the FIN if we have one skb in write queue and
+	 * this skb was not yet sent, or we are under memory pressure.
+	 * Note: in the latter case, FIN packet will be sent after a timeout,
+	 * as TCP stack thinks it has already been transmitted.
 	 */
-	mss_now = tcp_current_mss(sk);
-
-	if (tcp_send_head(sk) != NULL) {
-		TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN;
-		TCP_SKB_CB(skb)->end_seq++;
+	if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) {
+coalesce:
+		TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN;
+		TCP_SKB_CB(tskb)->end_seq++;
 		tp->write_seq++;
+		if (!tcp_send_head(sk)) {
+			/* This means tskb was already sent.
+			 * Pretend we included the FIN on previous transmit.
+			 * We need to set tp->snd_nxt to the value it would have
+			 * if FIN had been sent. This is because retransmit path
+			 * does not change tp->snd_nxt.
+			 */
+			tp->snd_nxt++;
+			return;
+		}
 	} else {
-		/* Socket is locked, keep trying until memory is available. */
-		for (;;) {
-			skb = alloc_skb_fclone(MAX_TCP_HEADER,
-					       sk->sk_allocation);
-			if (skb)
-				break;
-			yield();
+		skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation);
+		if (unlikely(!skb)) {
+			if (tskb)
+				goto coalesce;
+			return;
 		}
 		skb_reserve(skb, MAX_TCP_HEADER);
 		sk_forced_wmem_schedule(sk, skb->truesize);
@@ -2619,7 +2627,7 @@ void tcp_send_fin(struct sock *sk)
 				     TCPHDR_ACK | TCPHDR_FIN);
 		tcp_queue_skb(sk, skb);
 	}
-	__tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF);
+	__tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF);
 }
 
 /* We get here when a process closes a file descriptor (either due to
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 88/90] net: do not deplete pfmemalloc reserve
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2015-05-05 20:54 ` [PATCH 3.13.y-ckt 87/90] tcp: avoid looping " Kamal Mostafa
@ 2015-05-05 20:55 ` Kamal Mostafa
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 89/90] net: fix crash in build_skb() Kamal Mostafa
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 90/90] ipv4: Missing sk_nulls_node_init() in ping_unhash() Kamal Mostafa
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:55 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 79930f5892e134c6da1254389577fffb8bd72c66 ]

build_skb() should look at the page pfmemalloc status.
If set, this means page allocator allocated this page in the
expectation it would help to free other pages. Networking
stack can do that only if skb->pfmemalloc is also set.

Also, we must refrain using high order pages from the pfmemalloc
reserve, so __page_frag_refill() must also use __GFP_NOMEMALLOC for
them. Under memory pressure, using order-0 pages is probably the best
strategy.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/skbuff.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6e42045..0885955 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -307,7 +307,11 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	memset(skb, 0, offsetof(struct sk_buff, tail));
 	skb->truesize = SKB_TRUESIZE(size);
-	skb->head_frag = frag_size != 0;
+	if (frag_size) {
+		skb->head_frag = 1;
+		if (virt_to_head_page(data)->pfmemalloc)
+			skb->pfmemalloc = 1;
+	}
 	atomic_set(&skb->users, 1);
 	skb->head = data;
 	skb->data = data;
@@ -350,7 +354,8 @@ refill:
 			gfp_t gfp = gfp_mask;
 
 			if (order)
-				gfp |= __GFP_COMP | __GFP_NOWARN;
+				gfp |= __GFP_COMP | __GFP_NOWARN |
+				       __GFP_NOMEMALLOC;
 			nc->frag.page = alloc_pages(gfp, order);
 			if (likely(nc->frag.page))
 				break;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 89/90] net: fix crash in build_skb()
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 88/90] net: do not deplete pfmemalloc reserve Kamal Mostafa
@ 2015-05-05 20:55 ` Kamal Mostafa
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 90/90] ipv4: Missing sk_nulls_node_init() in ping_unhash() Kamal Mostafa
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:55 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 2ea2f62c8bda242433809c7f4e9eae1c52c40bbe ]

When I added pfmemalloc support in build_skb(), I forgot netlink
was using build_skb() with a vmalloc() area.

In this patch I introduce __build_skb() for netlink use,
and build_skb() is a wrapper handling both skb->head_frag and
skb->pfmemalloc

This means netlink no longer has to hack skb->head_frag

[ 1567.700067] kernel BUG at arch/x86/mm/physaddr.c:26!
[ 1567.700067] invalid opcode: 0000 [#1] PREEMPT SMP KASAN
[ 1567.700067] Dumping ftrace buffer:
[ 1567.700067]    (ftrace buffer empty)
[ 1567.700067] Modules linked in:
[ 1567.700067] CPU: 9 PID: 16186 Comm: trinity-c182 Not tainted 4.0.0-next-20150424-sasha-00037-g4796e21 #2167
[ 1567.700067] task: ffff880127efb000 ti: ffff880246770000 task.ti: ffff880246770000
[ 1567.700067] RIP: __phys_addr (arch/x86/mm/physaddr.c:26 (discriminator 3))
[ 1567.700067] RSP: 0018:ffff8802467779d8  EFLAGS: 00010202
[ 1567.700067] RAX: 000041000ed8e000 RBX: ffffc9008ed8e000 RCX: 000000000000002c
[ 1567.700067] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffffb3fd6049
[ 1567.700067] RBP: ffff8802467779f8 R08: 0000000000000019 R09: ffff8801d0168000
[ 1567.700067] R10: ffff8801d01680c7 R11: ffffed003a02d019 R12: ffffc9000ed8e000
[ 1567.700067] R13: 0000000000000f40 R14: 0000000000001180 R15: ffffc9000ed8e000
[ 1567.700067] FS:  00007f2a7da3f700(0000) GS:ffff8801d1000000(0000) knlGS:0000000000000000
[ 1567.700067] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1567.700067] CR2: 0000000000738308 CR3: 000000022e329000 CR4: 00000000000007e0
[ 1567.700067] Stack:
[ 1567.700067]  ffffc9000ed8e000 ffff8801d0168000 ffffc9000ed8e000 ffff8801d0168000
[ 1567.700067]  ffff880246777a28 ffffffffad7c0a21 0000000000001080 ffff880246777c08
[ 1567.700067]  ffff88060d302e68 ffff880246777b58 ffff880246777b88 ffffffffad9a6821
[ 1567.700067] Call Trace:
[ 1567.700067] build_skb (include/linux/mm.h:508 net/core/skbuff.c:316)
[ 1567.700067] netlink_sendmsg (net/netlink/af_netlink.c:1633 net/netlink/af_netlink.c:2329)
[ 1567.774369] ? sched_clock_cpu (kernel/sched/clock.c:311)
[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
[ 1567.774369] ? netlink_unicast (net/netlink/af_netlink.c:2273)
[ 1567.774369] sock_sendmsg (net/socket.c:614 net/socket.c:623)
[ 1567.774369] sock_write_iter (net/socket.c:823)
[ 1567.774369] ? sock_sendmsg (net/socket.c:806)
[ 1567.774369] __vfs_write (fs/read_write.c:479 fs/read_write.c:491)
[ 1567.774369] ? get_lock_stats (kernel/locking/lockdep.c:249)
[ 1567.774369] ? default_llseek (fs/read_write.c:487)
[ 1567.774369] ? vtime_account_user (kernel/sched/cputime.c:701)
[ 1567.774369] ? rw_verify_area (fs/read_write.c:406 (discriminator 4))
[ 1567.774369] vfs_write (fs/read_write.c:539)
[ 1567.774369] SyS_write (fs/read_write.c:586 fs/read_write.c:577)
[ 1567.774369] ? SyS_read (fs/read_write.c:577)
[ 1567.774369] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 1567.774369] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2594 kernel/locking/lockdep.c:2636)
[ 1567.774369] ? trace_hardirqs_on_thunk (arch/x86/lib/thunk_64.S:42)
[ 1567.774369] system_call_fastpath (arch/x86/kernel/entry_64.S:261)

Fixes: 79930f5892e ("net: do not deplete pfmemalloc reserve")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/skbuff.h   |  1 +
 net/core/skbuff.c        | 31 ++++++++++++++++++++++---------
 net/netlink/af_netlink.c |  6 ++----
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 1389001..f06c9a8a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -638,6 +638,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
 
 struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags,
 			    int node);
+struct sk_buff *__build_skb(void *data, unsigned int frag_size);
 struct sk_buff *build_skb(void *data, unsigned int frag_size);
 static inline struct sk_buff *alloc_skb(unsigned int size,
 					gfp_t priority)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0885955..1008034 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -276,13 +276,14 @@ nodata:
 EXPORT_SYMBOL(__alloc_skb);
 
 /**
- * build_skb - build a network buffer
+ * __build_skb - build a network buffer
  * @data: data buffer provided by caller
- * @frag_size: size of fragment, or 0 if head was kmalloced
+ * @frag_size: size of data, or 0 if head was kmalloced
  *
  * Allocate a new &sk_buff. Caller provides space holding head and
  * skb_shared_info. @data must have been allocated by kmalloc() only if
- * @frag_size is 0, otherwise data should come from the page allocator.
+ * @frag_size is 0, otherwise data should come from the page allocator
+ *  or vmalloc()
  * The return is the new skb buffer.
  * On a failure the return is %NULL, and @data is not freed.
  * Notes :
@@ -293,7 +294,7 @@ EXPORT_SYMBOL(__alloc_skb);
  *  before giving packet to stack.
  *  RX rings only contains data buffers, not full skbs.
  */
-struct sk_buff *build_skb(void *data, unsigned int frag_size)
+struct sk_buff *__build_skb(void *data, unsigned int frag_size)
 {
 	struct skb_shared_info *shinfo;
 	struct sk_buff *skb;
@@ -307,11 +308,6 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	memset(skb, 0, offsetof(struct sk_buff, tail));
 	skb->truesize = SKB_TRUESIZE(size);
-	if (frag_size) {
-		skb->head_frag = 1;
-		if (virt_to_head_page(data)->pfmemalloc)
-			skb->pfmemalloc = 1;
-	}
 	atomic_set(&skb->users, 1);
 	skb->head = data;
 	skb->data = data;
@@ -328,6 +324,23 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
 
 	return skb;
 }
+
+/* build_skb() is wrapper over __build_skb(), that specifically
+ * takes care of skb->head and skb->pfmemalloc
+ * This means that if @frag_size is not zero, then @data must be backed
+ * by a page fragment, not kmalloc() or vmalloc()
+ */
+struct sk_buff *build_skb(void *data, unsigned int frag_size)
+{
+	struct sk_buff *skb = __build_skb(data, frag_size);
+
+	if (skb && frag_size) {
+		skb->head_frag = 1;
+		if (virt_to_head_page(data)->pfmemalloc)
+			skb->pfmemalloc = 1;
+	}
+	return skb;
+}
 EXPORT_SYMBOL(build_skb);
 
 struct netdev_alloc_cache {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a4fbf5d..8a2b386 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1616,13 +1616,11 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
 	if (data == NULL)
 		return NULL;
 
-	skb = build_skb(data, size);
+	skb = __build_skb(data, size);
 	if (skb == NULL)
 		vfree(data);
-	else {
-		skb->head_frag = 0;
+	else
 		skb->destructor = netlink_skb_destructor;
-	}
 
 	return skb;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 90/90] ipv4: Missing sk_nulls_node_init() in ping_unhash().
  2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2015-05-05 20:55 ` [PATCH 3.13.y-ckt 89/90] net: fix crash in build_skb() Kamal Mostafa
@ 2015-05-05 20:55 ` Kamal Mostafa
  89 siblings, 0 replies; 91+ messages in thread
From: Kamal Mostafa @ 2015-05-05 20:55 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Kamal Mostafa

3.13.11-ckt20 -stable review patch.  If anyone has any objections, please let me know.

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

From: "David S. Miller" <davem@davemloft.net>

[ Upstream commit a134f083e79fb4c3d0a925691e732c56911b4326 ]

If we don't do that, then the poison value is left in the ->pprev
backlink.

This can cause crashes if we do a disconnect, followed by a connect().

Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Wen Xu <hotdog3645@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/ping.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 7e079a2..64735ad 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -154,6 +154,7 @@ void ping_unhash(struct sock *sk)
 	if (sk_hashed(sk)) {
 		write_lock_bh(&ping_table.lock);
 		hlist_nulls_del(&sk->sk_nulls_node);
+		sk_nulls_node_init(&sk->sk_nulls_node);
 		sock_put(sk);
 		isk->inet_num = 0;
 		isk->inet_sport = 0;
-- 
1.9.1


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

end of thread, other threads:[~2015-05-05 20:56 UTC | newest]

Thread overview: 91+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-05 20:53 [3.13.y-ckt stable] Linux 3.13.11-ckt20 stable review Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 01/90] Input: serio - add firmware_id sysfs attribute Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 02/90] Input: i8042 - add firmware_id support Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 03/90] Input: Add INPUT_PROP_TOPBUTTONPAD device property Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 04/90] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 05/90] Input: synaptics - add a matches_pnp_id helper function Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 06/90] Input: synaptics - change min/max quirk table to pnp-id matching Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 07/90] Input: psmouse - add psmouse_matches_pnp_id helper function Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 08/90] Input: synaptics - split synaptics_resolution(), query first Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 09/90] Input: synaptics - log queried and quirked dimension values Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 10/90] Input: synaptics - remove obsolete min/max quirk for X240 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 11/90] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 12/90] Input: synaptics - add min/max quirk for Lenovo T440s Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 13/90] Input: synaptics - adjust min/max for Lenovo ThinkPad X1 Carbon 2nd Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 14/90] Input: synaptics - adjust min/max on Thinkpad E540 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 15/90] Input: synaptics - support min/max board id in min_max_pnpid_table Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 16/90] Input: synaptics - skip quirks when post-2013 dimensions Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 17/90] n_tty: Merge .receive_buf() flavors Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 18/90] n_tty: Fix read buffer overwrite when no newline Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 19/90] KVM: x86: Fix lost interrupt on irr_pending race Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 20/90] fs: take i_mutex during prepare_binprm for set[ug]id executables Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 21/90] tcp: Fix crash in TCP Fast Open Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 22/90] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 23/90] nbd: fix possible memory leak Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 24/90] mfd: kempld-core: Fix callback return value check Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 25/90] KVM: nVMX: mask unrestricted_guest if disabled on L0 Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 26/90] spi: trigger trace event for message-done before mesg->complete Kamal Mostafa
2015-05-05 20:53 ` [PATCH 3.13.y-ckt 27/90] powerpc/pseries: Little endian fixes for post mobility device tree update Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 28/90] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 29/90] perf: Fix irq_work 'tail' recursion Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 30/90] arm64: Use the reserved TTBR0 if context switching to the init_mm Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 31/90] selinux: fix sel_write_enforce broken return value Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 32/90] mm: fix anon_vma->degree underflow in anon_vma endless growing prevention Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 33/90] mm/memory hotplug: postpone the reset of obsolete pgdat Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 34/90] hfsplus: fix B-tree corruption after insertion at position 0 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 35/90] ARC: SA_SIGINFO ucontext regs off-by-one Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 36/90] writeback: fix possible underflow in write bandwidth calculation Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 37/90] iio: fix drivers that check buffer->scan_mask Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 38/90] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 39/90] iio: core: Fix double free Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 40/90] USB: ftdi_sio: Added custom PID for Synapse Wireless product Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 41/90] iwlwifi: dvm: run INIT firmware again upon .start() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 42/90] USB: keyspan_pda: add new device id Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 43/90] cifs: smb2_clone_range() - exit on unhandled error Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 44/90] cifs: fix use-after-free bug in find_writable_file Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 45/90] can: flexcan: Deferred on Regulator return EPROBE_DEFER Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 46/90] usb: xhci: handle Config Error Change (CEC) in xhci driver Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 47/90] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 48/90] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 49/90] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 50/90] radeon: Do not directly dereference pointers to BIOS area Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 51/90] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 52/90] dmaengine: edma: fix memory leak when terminating running transfers Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 53/90] dmaengine: omap-dma: Fix memory leak when terminating running transfer Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 54/90] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 55/90] mac80211: fix RX A-MPDU session reorder timer deletion Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 56/90] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 57/90] tcp: prevent fetching dst twice in early demux code Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 58/90] net: use for_each_netdev_safe() in rtnl_group_changelink() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 59/90] xen-netfront: transmit fully GSO-sized packets Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 60/90] tcp: fix FRTO undo on cumulative ACK of SACKed range Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 61/90] PCI: cpcihp: Add missing curly braces in cpci_configure_slot() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 62/90] [media] sh_veu: v4l2_dev wasn't set Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 63/90] [media] media: s5p-mfc: fix mmap support for 64bit arch Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 64/90] cpuidle: ACPI: do not overwrite name and description of C0 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 65/90] ioctx_alloc(): fix vma (and file) leak on failure Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 66/90] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 67/90] be2iscsi: Fix kernel panic when device initialization fails Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 68/90] Defer processing of REQ_PREEMPT requests for blocked devices Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 69/90] ALSA: hda - Fix headphone pin config for Lifebook T731 Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 70/90] ocfs2: _really_ sync the right range Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 71/90] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 72/90] iscsi target: fix oops when adding reject pdu Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 73/90] net/mlx4_en: Call register_netdevice in the proper location Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 74/90] ipv6: protect skb->sk accesses from recursive dereference inside the stack Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 75/90] tcp: tcp_make_synack() should clear skb->tstamp Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 76/90] 8139cp: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 77/90] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 78/90] r8169: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 79/90] bonding: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 80/90] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 81/90] tg3: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 82/90] ixgb: " Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 83/90] benet: Call dev_kfree_skby_any instead of kfree_skb Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 84/90] gianfar: Carefully free skbs in functions called by netpoll Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 85/90] ip_forward: Drop frames with attached skb->sk Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 86/90] tcp: fix possible deadlock in tcp_send_fin() Kamal Mostafa
2015-05-05 20:54 ` [PATCH 3.13.y-ckt 87/90] tcp: avoid looping " Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 88/90] net: do not deplete pfmemalloc reserve Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 89/90] net: fix crash in build_skb() Kamal Mostafa
2015-05-05 20:55 ` [PATCH 3.13.y-ckt 90/90] ipv4: Missing sk_nulls_node_init() in ping_unhash() Kamal Mostafa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).