[PATCH] usb: dwc2: gadget: cleanup useless code

2015-04-26 Thread Yunzhi Li
dwc2 gadget driver s3c_hsotg_of_probe() run twice in
dwc2_gadget_init() and the first one is useless, so remove it.

Signed-off-by: Yunzhi Li l...@rock-chips.com
---
 drivers/usb/dwc2/gadget.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6a30887..2ae74f2 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3851,8 +3851,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* Set default UTMI width */
hsotg-phyif = GUSBCFG_PHYIF16;
 
-   s3c_hsotg_of_probe(hsotg);
-
/* Initialize to legacy fifo configuration values */
hsotg-g_rx_fifo_sz = 2048;
hsotg-g_np_g_tx_fifo_sz = 1024;
-- 
2.0.0


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] arm: improve non-section-aligned low memory mapping

2015-04-26 Thread Baruch Siach
Hi Min-Hua Chen

On Sun, Apr 26, 2015 at 03:41:17PM +0800, Min-Hua Chen wrote:
 diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
 index 2495c8c..6a618f9 100644
 --- a/arch/arm/mm/init.c
 +++ b/arch/arm/mm/init.c
 @@ -138,7 +138,7 @@ void show_mem(unsigned int filter)
  static void __init find_limits(unsigned long *min, unsigned long *max_low,
 unsigned long *max_high)
  {
 - *max_low = PFN_DOWN(memblock_get_current_limit());
 + *max_low = PFN_DOWN(arm_lowmem_limit);
   *min = PFN_UP(memblock_start_of_DRAM());
   *max_high = PFN_DOWN(memblock_end_of_DRAM());
  }

Your patch is whitespace damaged, and can't be applied as is. Please consider 
using git send-email to send properly formatted patches. See the EXAMPLE 
section in http://git-scm.com/docs/git-send-email for example of git 
send-email using a gmail account.

baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] xillybus: XILLYBUS_OF should depend on HAS_DMA

2015-04-26 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `xilly_of_unmap':
xillybus_of.c:(.text+0xa860e): undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `xilly_map_single_of':
xillybus_of.c:(.text+0xa8668): undefined reference to `dma_map_single'
xillybus_of.c:(.text+0xa8676): undefined reference to `dma_mapping_error'
xillybus_of.c:(.text+0xa86ca): undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `xilly_dma_sync_single_for_device_of':
xillybus_of.c:(.text+0xa8700): undefined reference to 
`dma_sync_single_for_cpu'
drivers/built-in.o: In function `xilly_dma_sync_single_for_cpu_of':
xillybus_of.c:(.text+0xa8726): undefined reference to 
`dma_sync_single_for_cpu'

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Acked-by: Eli Billauer eli.billa...@gmail.com
--
v2:
  - Add Acked-by, send to char and misc drivers maintainers.
---
 drivers/char/xillybus/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/xillybus/Kconfig b/drivers/char/xillybus/Kconfig
index b53bdf12da0d0fe3..b302684d86c14c06 100644
--- a/drivers/char/xillybus/Kconfig
+++ b/drivers/char/xillybus/Kconfig
@@ -24,7 +24,7 @@ config XILLYBUS_PCIE
 
 config XILLYBUS_OF
tristate Xillybus over Device Tree
-   depends on OF_ADDRESS  OF_IRQ
+   depends on OF_ADDRESS  OF_IRQ  HAS_DMA
help
  Set to M if you want Xillybus to find its resources from the
  Open Firmware Flattened Device Tree. If the target is an embedded
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] iommu/amd: Fix bug in put_pasid_state_wait

2015-04-26 Thread Oded Gabbay

Hi Joerg,
Could you please take a look at this patch ?
I want it to be included in stable asap so Fedora 22 will pick it up.

Thanks,
Oded

On 04/16/2015 05:08 PM, Oded Gabbay wrote:

This patch fixes a bug in put_pasid_state_wait that appeared in kernel 4.0
The bug is that pasid_state-count wasn't decremented before entering the
wait_event. Thus, the condition in wait_event will never be true.

The fix is to decrement (atomically) the pasid_state-count before the
wait_event.

Signed-off-by: Oded Gabbay oded.gab...@amd.com
Cc: sta...@vger.kernel.org
---
  drivers/iommu/amd_iommu_v2.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 6d5a5c4..173e70d 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -266,6 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state)

  static void put_pasid_state_wait(struct pasid_state *pasid_state)
  {
+   atomic_dec(pasid_state-count);
wait_event(pasid_state-wq, !atomic_read(pasid_state-count));
free_pasid_state(pasid_state);
  }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ARM: dts: sunxi: A10s Olinuxino add missing SPI and simplefb.

2015-04-26 Thread Maxime Ripard
Hi,

On Mon, Mar 23, 2015 at 03:00:31PM +0100, Michal Suchanek wrote:
 Signed-off-by: Michal Suchanek hramr...@gmail.com

Commit log, please.

 ---
  arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 12 ++
  arch/arm/boot/dts/sun5i-a10s.dtsi| 28 
 
  2 files changed, 40 insertions(+)
 
 diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts 
 b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
 index aa88ee8..e546b3f 100644
 --- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
 +++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
 @@ -59,6 +59,12 @@
   model = Olimex A10s-Olinuxino Micro;
   compatible = olimex,a10s-olinuxino-micro, allwinner,sun5i-a10s;
  
 + chosen {
 + framebuffer@0 {
 + status = okay;
 + };
 + };
 +

This is wrong.

If the bootloader has set a simplefb node, it will enable the right
one, if not it means that it's not meant to be used.

   aliases {
   serial0 = uart0;
   serial1 = uart2;
 @@ -182,6 +188,12 @@
   status = okay;
  };
  
 +spi2 {
 + pinctrl-names = default;
 + pinctrl-0 = spi2_pins_a;
 + status = okay;
 +};
 +

This should be in a separate patch, and the node are to be ordered
alphabetically.

  ohci0 {
   status = okay;
  };
 diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi 
 b/arch/arm/boot/dts/sun5i-a10s.dtsi
 index a78c95d..438eba1 100644
 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
 +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
 @@ -154,6 +154,20 @@
   clocks = apb1_gates 18;
   status = disabled;
   };
 +
 + spi2: spi@01c17000 {
 + compatible = allwinner,sun4i-a10-spi;
 + reg = 0x01c17000 0x1000;
 + interrupts = 12;
 + clocks = ahb_gates 22, spi2_clk;
 + clock-names = ahb, mod;
 + dmas = dma SUN4I_DMA_DEDICATED 29,
 +dma SUN4I_DMA_DEDICATED 28;
 + dma-names = rx, tx;
 + status = disabled;
 + #address-cells = 1;
 + #size-cells = 0;
 + };
   };
  };

This should be in sun5i.dtsi (and in a separate patch).

 @@ -198,4 +212,18 @@
   allwinner,drive = SUN4I_PINCTRL_30_MA;
   allwinner,pull = SUN4I_PINCTRL_NO_PULL;
   };
 +
 + spi2_pins_a: spi2@0 {
 + allwinner,pins = PB11, PB12, PB13, PB14;
 + allwinner,function = spi2;
 + allwinner,drive = SUN4I_PINCTRL_10_MA;
 + allwinner,pull = SUN4I_PINCTRL_NO_PULL;
 + };
 +
 + spi2_pins_b: spi2@1 {
 + allwinner,pins = PE00, PE01, PE02, PE03;
 + allwinner,function = spi2;
 + allwinner,drive = SUN4I_PINCTRL_10_MA;
 + allwinner,pull = SUN4I_PINCTRL_NO_PULL;
 + };
  };

Ditto.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v5 0/3] Fix lubbock and mainstone interrupts

2015-04-26 Thread Robert Jarzmik
Arnd Bergmann a...@arndb.de writes:

 On Saturday 25 April 2015 23:13:20 Robert Jarzmik wrote:
 This serie was submitted to the lak list, then migrated to mfd drivers, to 
 end
 up again here. There was no change since last submission. Let's hope this is 
 the
 last spin and that these platform will be fixed at last.
 

 Should these be marked 'Cc: sta...@vger.kernel.org'?
I can do this. I thought that 3 patches of 100+ lines, and the fact that these
boards were broken since october 2011 would prevent this serie from reaching the
stable branch.

Well, I'll resubmit with this information, and after comments stage it to my
fixes branch. Let's see what stable tree people will do.

 Can you also add a 'Fixes' tag with the commit that introduced the problem?
Sure.

Cheers.

-- 
Robert
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] ARM: sunxi: spi: use proper errno when message is too long.

2015-04-26 Thread Maxime Ripard
On Sat, Apr 25, 2015 at 09:21:07PM +0200, Michal Suchanek wrote:
 Signed-off-by: Michal Suchanek hramr...@gmail.com

No commit log?

 ---
  drivers/spi/spi-sun4i.c | 2 +-
  drivers/spi/spi-sun6i.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
 index fbb0a4d..8238b4e 100644
 --- a/drivers/spi/spi-sun4i.c
 +++ b/drivers/spi/spi-sun4i.c
 @@ -176,7 +176,7 @@ static int sun4i_spi_transfer_one(struct spi_master 
 *master,
  
   /* We don't support transfer larger than the FIFO */
   if (tfr-len  SUN4I_FIFO_DEPTH)
 - return -EINVAL;
 + return -EMSGSIZE;

Is it still a thing? The patch to remove such limit hasn't been merged
yet?

   reinit_completion(sspi-done);
   sspi-tx_buf = tfr-tx_buf;
 diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
 index ac48f59..0f5dd91 100644
 --- a/drivers/spi/spi-sun6i.c
 +++ b/drivers/spi/spi-sun6i.c
 @@ -166,7 +166,7 @@ static int sun6i_spi_transfer_one(struct spi_master 
 *master,
  
   /* We don't support transfer larger than the FIFO */
   if (tfr-len  SUN6I_FIFO_DEPTH)
 - return -EINVAL;
 + return -EMSGSIZE;

Eventually, we should move to using DMA for these messages longer than
the FIFO.

I should post these patches.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: 4.0 parisc regression: memory leak?

2015-04-26 Thread Meelis Roos
  I noticed that with 4.0 I'm running out of memory on HP A500 (1G RAM) 
  and HP RP3410 (2G RAM) parisc machines during gentoo revdep-rebuild 
  -ip. Each time free shows less free memory until OOM killer visits us 
  (and first revdep-rebuild after nontrivial emerge compilation loop kills 
  the smaller box).
 
 I've also had problems with 4.0.  I had HPMC after a few hours on rp3440.

My rp3440 worked fine for emerge world - maybe an hour or some hours. 
Because of 12G RAM, it did not run out of memory.

-- 
Meelis Roos (mr...@linux.ee)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] arm: improve non-section-aligned low memory mapping

2015-04-26 Thread Min-Hua Chen
From d8dbec3573b02afd8a23fe10f92bc0d324b0c951 Mon Sep 17 00:00:00 2001
From: Min-Hua Chen orca.c...@gmail.com
Date: Sun, 26 Apr 2015 15:07:44 +0800
Subject: [PATCH] arm: improve non-section-aligned low memory mapping

In current design, the memblock.current_limit is set to
a section-aligned value in sanity_check_meminfo().

However, the section-aligned memblock may become non-section-aligned
after arm_memblock_init(). For example, the first section-aligned
memblock is 0x-0x0100 and sanity_check_meminfo sets
current_limit to 0x0100. After arm_memblock_init, two memory blocks
[0x00c0 - 0x00d0] and [0x00ff - 0x0100] are reserved
by memblock_reserve() and make the original memory block
[0x-0x0100] becomes:

[0x-0x00c0]
[0x00d0-0x00ff]

When creating the low memory mapping for [0x00d0-0x00ff],
since the memory block is non-section-aligned, it will need to create
a second level page table. But the current_limit is set to 0x0100,
and it's possible to allocate a unmapped memory block.

call flow:

setup_arch
 + sanity_check_meminfo
 + arm_memblock_init
 + paging_init
+ map_lowmem
+ bootmem_init

Move the memblock_set_current_limit logic to map_lowmem(), we point
the memblock current_limit to the first section-aligned memblock block.
Since map_lowmem() is called after arm_memblock_init(), there is no way to
change memblock layout. So we can say that the first section-aligned limit
is valid during map_lowmem(). Hence fix the problem described above.

Another change is the implementation of find_limits().
In commit: 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76, the max_low is
set by memblock_get_current_limit(). However memblock.current_limit
can be changed by memblock_set_current_limit() anypoint before
find_limits().

It's better to use arm_lowmem_limit to be max_lowmem in two ways:
First, arm_lowmem_limit cannot be changed by a public API. Second, the
high_memory is set by arm_lowmem_limit and is a natural limit of
low memory area in bootmem_init().

Signed-off-by: Min-Hua Chen orca.c...@gmail.com
---
 arch/arm/mm/init.c |2 +-
 arch/arm/mm/mmu.c  |   44 ++--
 2 files changed, 11 insertions(+), 35 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2495c8c..6a618f9 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -138,7 +138,7 @@ void show_mem(unsigned int filter)
 static void __init find_limits(unsigned long *min, unsigned long *max_low,
unsigned long *max_high)
 {
- *max_low = PFN_DOWN(memblock_get_current_limit());
+ *max_low = PFN_DOWN(arm_lowmem_limit);
  *min = PFN_UP(memblock_start_of_DRAM());
  *max_high = PFN_DOWN(memblock_end_of_DRAM());
 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 4e6ef89..dbc484d 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1068,7 +1068,6 @@ phys_addr_t arm_lowmem_limit __initdata = 0;

 void __init sanity_check_meminfo(void)
 {
- phys_addr_t memblock_limit = 0;
  int highmem = 0;
  phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1;
  struct memblock_region *reg;
@@ -1110,43 +1109,10 @@ void __init sanity_check_meminfo(void)
  else
  arm_lowmem_limit = block_end;
  }
-
- /*
- * Find the first non-section-aligned page, and point
- * memblock_limit at it. This relies on rounding the
- * limit down to be section-aligned, which happens at
- * the end of this function.
- *
- * With this algorithm, the start or end of almost any
- * bank can be non-section-aligned. The only exception
- * is that the start of the bank 0 must be section-
- * aligned, since otherwise memory would need to be
- * allocated when mapping the start of bank 0, which
- * occurs before any free memory is mapped.
- */
- if (!memblock_limit) {
- if (!IS_ALIGNED(block_start, SECTION_SIZE))
- memblock_limit = block_start;
- else if (!IS_ALIGNED(block_end, SECTION_SIZE))
- memblock_limit = arm_lowmem_limit;
- }
-
  }
  }

  high_memory = __va(arm_lowmem_limit - 1) + 1;
-
- /*
- * Round the memblock limit down to a section size.  This
- * helps to ensure that we will allocate memory from the
- * last full section, which should be mapped.
- */
- if (memblock_limit)
- memblock_limit = round_down(memblock_limit, SECTION_SIZE);
- if (!memblock_limit)
- memblock_limit = arm_lowmem_limit;
-
- memblock_set_current_limit(memblock_limit);
 }

 static inline void prepare_page_table(void)
@@ -1331,6 +1297,7 @@ static void __init map_lowmem(void)
  struct memblock_region *reg;
  phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
  phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
+ phys_addr_t section_block_limit = 0;

  /* Map all the lowmem memory banks. */
  for_each_memblock(memory, reg) {
@@ -1384,6 +1351,15 @@ static void __init map_lowmem(void)
  create_mapping(map);
  }
  }
+
+ /*
+ * Find the first section-aligned memblock and set
+ * memblock_limit at it.
+ */
+ if (!section_memblock_limit  !(end  

[PATCH v2]block:bounce: fix call inc_|dec_zone_page_state on different pages confuse value of NR_BOUNCE

2015-04-26 Thread Wang YanQing
Commit d2c5e30c9a1420902262aa923794d2ae4e0bc391
([PATCH] zoned vm counters: conversion of nr_bounce to per zone counter)
convert statistic of nr_bounce to per zone and one global value in vm_stat,
but it call inc_|dec_zone_page_state on different pages, then different
zones, and cause us to get unexpected value of NR_BOUNCE.

Below is the result on my machine:
Mar  2 09:26:08 udknight kernel: [144766.778265] Mem-Info:
Mar  2 09:26:08 udknight kernel: [144766.778266] DMA per-cpu:
Mar  2 09:26:08 udknight kernel: [144766.778268] CPU0: hi:0, btch:   1 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778269] CPU1: hi:0, btch:   1 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778270] Normal per-cpu:
Mar  2 09:26:08 udknight kernel: [144766.778271] CPU0: hi:  186, btch:  31 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778273] CPU1: hi:  186, btch:  31 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778274] HighMem per-cpu:
Mar  2 09:26:08 udknight kernel: [144766.778275] CPU0: hi:  186, btch:  31 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778276] CPU1: hi:  186, btch:  31 
usd:   0
Mar  2 09:26:08 udknight kernel: [144766.778279] active_anon:46926 
inactive_anon:287406 isolated_anon:0
Mar  2 09:26:08 udknight kernel: [144766.778279]  active_file:105085 
inactive_file:139432 isolated_file:0
Mar  2 09:26:08 udknight kernel: [144766.778279]  unevictable:653 dirty:0 
writeback:0 unstable:0
Mar  2 09:26:08 udknight kernel: [144766.778279]  free:178957 
slab_reclaimable:6419 slab_unreclaimable:9966
Mar  2 09:26:08 udknight kernel: [144766.778279]  mapped:4426 shmem:305277 
pagetables:784 bounce:0
Mar  2 09:26:08 udknight kernel: [144766.778279]  free_cma:0
Mar  2 09:26:08 udknight kernel: [144766.778286] DMA free:3324kB min:68kB 
low:84kB high:100kB active_anon:0kB inactive_anon:0kB active_file:0kB 
inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB 
present:15976kB managed:15900kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB 
shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB 
pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB 
pages_scanned:0 all_unreclaimable? yes
Mar  2 09:26:08 udknight kernel: [144766.778287] lowmem_reserve[]: 0 822 3754 
3754
Mar  2 09:26:08 udknight kernel: [144766.778293] Normal free:26828kB min:3632kB 
low:4540kB high:5448kB active_anon:4872kB inactive_anon:68kB active_file:1796kB 
inactive_file:1796kB unevictable:0kB isolated(anon):0kB isolated(file):0kB 
present:892920kB managed:842560kB mlocked:0kB dirty:0kB writeback:0kB 
mapped:0kB shmem:4144kB slab_reclaimable:25676kB slab_unreclaimable:39864kB 
kernel_stack:1944kB pagetables:3136kB unstable:0kB bounce:0kB free_cma:0kB 
writeback_tmp:0kB pages_scanned:2412612 all_unreclaimable? yes
Mar  2 09:26:08 udknight kernel: [144766.778294] lowmem_reserve[]: 0 0 23451 
23451
Mar  2 09:26:08 udknight kernel: [144766.778299] HighMem free:685676kB 
min:512kB low:3748kB high:6984kB active_anon:182832kB inactive_anon:1149556kB 
active_file:418544kB inactive_file:555932kB unevictable:2612kB 
isolated(anon):0kB isolated(file):0kB present:3001732kB managed:3001732kB 
mlocked:0kB dirty:0kB writeback:0kB mapped:17704kB shmem:1216964kB 
slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB 
unstable:0kB bounce:75771152kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 
all_unreclaimable? no
Mar  2 09:26:08 udknight kernel: [144766.778300] lowmem_reserve[]: 0 0 0 0

You can see bounce:75771152kB for HighMem, but bounce:0 for lowmem and global.

This patch fix it.

Signed-off-by: Wang YanQing udkni...@gmail.com
---
 Changes
 v1-v2: fix comment issue reported by Leon Romanovsky

 block/bounce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/bounce.c b/block/bounce.c
index ab21ba2..ed9dd80 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -221,8 +221,8 @@ bounce:
if (page_to_pfn(page) = queue_bounce_pfn(q)  !force)
continue;
 
-   inc_zone_page_state(to-bv_page, NR_BOUNCE);
to-bv_page = mempool_alloc(pool, q-bounce_gfp);
+   inc_zone_page_state(to-bv_page, NR_BOUNCE);
 
if (rw == WRITE) {
char *vto, *vfrom;
-- 
1.8.5.6.2.g3d8a54e.dirty
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] arm: improve non-section-aligned low memory mapping

2015-04-26 Thread Min-Hua Chen
Fix space errors.

In current design, the memblock.current_limit is set to
a section-aligned value in sanity_check_meminfo().

However, the section-aligned memblock may become non-section-aligned
after arm_memblock_init(). For example, the first section-aligned
memblock is 0x-0x0100 and sanity_check_meminfo sets
current_limit to 0x0100. After arm_memblock_init, two memory blocks
[0x00c0 - 0x00d0] and [0x00ff - 0x0100] are reserved
by memblock_reserve() and make the original memory block
[0x-0x0100] becomes:

[0x-0x00c0]
[0x00d0-0x00ff]

When creating the low memory mapping for [0x00d0-0x00ff],
since the memory block is non-section-aligned, it will need to create
a second level page table. But the current_limit is set to 0x0100,
and it's possible to allocate a unmapped memory block.

call flow:

setup_arch
 + sanity_check_meminfo
 + arm_memblock_init
 + paging_init
+ map_lowmem
+ bootmem_init

Move the memblock_set_current_limit logic to map_lowmem(), we point
the memblock current_limit to the first section-aligned memblock block.
Since map_lowmem() is called after arm_memblock_init(), there is no way to
change memblock layout. So we can say that the first section-aligned limit
is valid during map_lowmem(). Hence fix the problem described above.

Another change is change the implementation of find_limits().
In commit: 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76, the max_low is
set by memblock_get_current_limit(). However memblock.current_limit
can be changed by memblock_set_current_limit() anypoint before
find_limits().

It's better to use arm_lowmem_limit to be max_lowmem in two ways:
First, arm_lowmem_limit cannot be changed by a public API. Second, the
high_memory is set by arm_lowmem_limit and is a natural limit of
low memory area in bootmem_init().

thanks,
Min-Hua

Signed-off-by: Min-Hua Chen orca.c...@gmail.com
---
 arch/arm/mm/init.c |2 +-
 arch/arm/mm/mmu.c  |   44 ++--
 2 files changed, 11 insertions(+), 35 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2495c8c..6a618f9 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -138,7 +138,7 @@ void show_mem(unsigned int filter)
 static void __init find_limits(unsigned long *min, unsigned long *max_low,
   unsigned long *max_high)
 {
-   *max_low = PFN_DOWN(memblock_get_current_limit());
+   *max_low = PFN_DOWN(arm_lowmem_limit);
*min = PFN_UP(memblock_start_of_DRAM());
*max_high = PFN_DOWN(memblock_end_of_DRAM());
 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 4e6ef89..dbc484d 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1068,7 +1068,6 @@ phys_addr_t arm_lowmem_limit __initdata = 0;
 
 void __init sanity_check_meminfo(void)
 {
-   phys_addr_t memblock_limit = 0;
int highmem = 0;
phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1;
struct memblock_region *reg;
@@ -1110,43 +1109,10 @@ void __init sanity_check_meminfo(void)
else
arm_lowmem_limit = block_end;
}
-
-   /*
-* Find the first non-section-aligned page, and point
-* memblock_limit at it. This relies on rounding the
-* limit down to be section-aligned, which happens at
-* the end of this function.
-*
-* With this algorithm, the start or end of almost any
-* bank can be non-section-aligned. The only exception
-* is that the start of the bank 0 must be section-
-* aligned, since otherwise memory would need to be
-* allocated when mapping the start of bank 0, which
-* occurs before any free memory is mapped.
-*/
-   if (!memblock_limit) {
-   if (!IS_ALIGNED(block_start, SECTION_SIZE))
-   memblock_limit = block_start;
-   else if (!IS_ALIGNED(block_end, SECTION_SIZE))
-   memblock_limit = arm_lowmem_limit;
-   }
-
}
}
 
high_memory = __va(arm_lowmem_limit - 1) + 1;
-
-   /*
-* Round the memblock limit down to a section size.  This
-* helps to ensure that we will allocate memory from the
-* last full section, which should be mapped.
-*/
-   if (memblock_limit)
-   memblock_limit = round_down(memblock_limit, SECTION_SIZE);
-   if (!memblock_limit)
-   memblock_limit = arm_lowmem_limit;
-
-   memblock_set_current_limit(memblock_limit);
 }
 
 static inline void 

Re: [PATCH 1/2] Fixing NX data alignment with nx_sg list

2015-04-26 Thread Herbert Xu
On Thu, Apr 23, 2015 at 05:40:30PM -0300, Leonidas S. Barbosa wrote:
 In NX we need to pass always a 16 multiple size nx_sg_list to
 co processor. Trim function handle with this assuring all nx_sg_lists
 are 16 multiple size, although data was not being considerated when
 crop was done. It was causing an unalignment between size of the list
 and data, corrupting csbcpb fields returning a -23 H_ST_PARM error, or
 invalid operation.
 
 This patch fix this recalculating how much data should be put back
 in to_process variable what assures the size of sg_list will be
 correct with size of the data.
 
 Signed-off-by: Leonidas S. Barbosa leosi...@linux.vnet.ibm.com

Both patches applied.
-- 
Email: Herbert Xu herb...@gondor.apana.org.au
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ARM: dts: sunxi: A10s Olinuxino add missing SPI and simplefb.

2015-04-26 Thread Michal Suchanek
Hello,

On 26 April 2015 at 10:39, Maxime Ripard
maxime.rip...@free-electrons.com wrote:
 Hi,

 On Mon, Mar 23, 2015 at 03:00:31PM +0100, Michal Suchanek wrote:
 Signed-off-by: Michal Suchanek hramr...@gmail.com

  ohci0 {
   status = okay;
  };
 diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi 
 b/arch/arm/boot/dts/sun5i-a10s.dtsi
 index a78c95d..438eba1 100644
 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
 +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
 @@ -154,6 +154,20 @@
   clocks = apb1_gates 18;
   status = disabled;
   };
 +
 + spi2: spi@01c17000 {
 + compatible = allwinner,sun4i-a10-spi;
 + reg = 0x01c17000 0x1000;
 + interrupts = 12;
 + clocks = ahb_gates 22, spi2_clk;
 + clock-names = ahb, mod;
 + dmas = dma SUN4I_DMA_DEDICATED 29,
 +dma SUN4I_DMA_DEDICATED 28;
 + dma-names = rx, tx;
 + status = disabled;
 + #address-cells = 1;
 + #size-cells = 0;
 + };
   };
  };

 This should be in sun5i.dtsi (and in a separate patch).

 @@ -198,4 +212,18 @@
   allwinner,drive = SUN4I_PINCTRL_30_MA;
   allwinner,pull = SUN4I_PINCTRL_NO_PULL;
   };
 +
 + spi2_pins_a: spi2@0 {
 + allwinner,pins = PB11, PB12, PB13, PB14;
 + allwinner,function = spi2;
 + allwinner,drive = SUN4I_PINCTRL_10_MA;
 + allwinner,pull = SUN4I_PINCTRL_NO_PULL;
 + };
 +
 + spi2_pins_b: spi2@1 {
 + allwinner,pins = PE00, PE01, PE02, PE03;
 + allwinner,function = spi2;
 + allwinner,drive = SUN4I_PINCTRL_10_MA;
 + allwinner,pull = SUN4I_PINCTRL_NO_PULL;
 + };
  };

 Ditto.


A13 does not have these pins so maybe not?

Thanks

Michal
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.0 7/7] fs: take i_mutex during prepare_binprm for set[ug]id executables

2015-04-26 Thread Greg Kroah-Hartman
4.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Jann Horn j...@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 j...@thejh.net
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/exec.c |   76 +++---
 1 file changed, 48 insertions(+), 28 deletions(-)

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1265,6 +1265,53 @@ static void check_unsafe_exec(struct lin
spin_unlock(p-fs-lock);
 }
 
+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 (task_no_new_privs(current))
+   return;
+
+   inode = file_inode(bprm-file);
+   mode = READ_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
@@ -1273,36 +1320,9 @@ static void check_unsafe_exec(struct lin
  */
 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) 
-   !task_no_new_privs(current) 
-   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);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.0 0/7] 4.0.1-stable review

2015-04-26 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.0.1 release.
There are 7 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Tue Apr 28 11:59:35 UTC 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-4.0.1-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman gre...@linuxfoundation.org
Linux 4.0.1-rc1

Jann Horn j...@thejh.net
fs: take i_mutex during prepare_binprm for set[ug]id executables

Herbert Xu herb...@gondor.apana.org.au
skbuff: Do not scrub skb mark within the same name space

Herbert Xu herb...@gondor.apana.org.au
Revert net: Reset secmark when scrubbing packet

Alexei Starovoitov a...@plumgrid.com
bpf: fix verifier memory corruption

Eric Dumazet eduma...@google.com
bnx2x: Fix busy_poll vs netpoll

Eric Dumazet eduma...@google.com
tcp: tcp_make_synack() should clear skb-tstamp

Jesse Gross je...@nicira.com
udptunnels: Call handle_offloads after inserting vlan tag.


-

Diffstat:

 Makefile|   4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 137 +---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |   9 +-
 drivers/net/vxlan.c |  20 ++--
 fs/exec.c   |  76 -
 kernel/bpf/verifier.c   |   3 +-
 net/core/skbuff.c   |  10 +-
 net/ipv4/geneve.c   |   8 +-
 net/ipv4/tcp_output.c   |   2 +
 9 files changed, 130 insertions(+), 139 deletions(-)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 05/31] tcp: fix FRTO undo on cumulative ACK of SACKed range

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Neal Cardwell ncardw...@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 ncardw...@google.com
Signed-off-by: Yuchung Cheng ych...@google.com
Fixes: e33099f96d99c (tcp: implement RFC5682 F-RTO)
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_input.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3076,10 +3076,11 @@ static int tcp_clean_rtx_queue(struct so
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)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 09/31] r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/realtek/r8169.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5768,7 +5768,7 @@ static void rtl8169_tx_clear_range(struc
 tp-TxDescArray + entry);
if (skb) {
tp-dev-stats.tx_dropped++;
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
tx_skb-skb = NULL;
}
}
@@ -5993,7 +5993,7 @@ static netdev_tx_t rtl8169_start_xmit(st
 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;
@@ -6076,7 +6076,7 @@ static void rtl_tx(struct net_device *de
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++;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 07/31] 8139cp: Call dev_kfree_skby_any instead of kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/realtek/8139cp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 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;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 01/42] tcp: prevent fetching dst twice in early demux code

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= mkube...@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 mkube...@suse.cz
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_ipv4.c |2 +-
 net/ipv6/tcp_ipv6.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- 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-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);
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1633,7 +1633,7 @@ static void tcp_v6_early_demux(struct sk
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);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Documentation: bindings: berlin: consider our dt bindings as unstable

2015-04-26 Thread Antoine Tenart
Because the support of Marvell Berlin SoCs is still a work in progress,
add a statement to explicitly consider our device tree files and
bindings as unstable.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 Documentation/devicetree/bindings/arm/marvell,berlin.txt | 12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt 
b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
index a99eb9eb14c0..060daafc14ff 100644
--- a/Documentation/devicetree/bindings/arm/marvell,berlin.txt
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -1,6 +1,18 @@
 Marvell Berlin SoC Family Device Tree Bindings
 ---
 
+Work in progress statement:
+
+Device tree files and bindings applying to Marvell Berlin SoCs and boards are
+considered unstable. Any Marvell Berlin device tree binding may change at any
+time. Be sure to use a device tree binary and a kernel image generated from the
+same source tree.
+
+Please refer to Documentation/devicetree/bindings/ABI.txt for a definition of a
+stable binding/ABI.
+
+---
+
 Boards with a SoC of the Marvell Berlin family, e.g. Armada 1500
 shall have the following properties:
 
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 41/42] mm: softdirty: unmapped addresses between VMAs are clean

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Feiner pfei...@google.com

commit 81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4 upstream.

If a /proc/pid/pagemap read spans a [VMA, an unmapped region, then a
VM_SOFTDIRTY VMA], the virtual pages in the unmapped region are reported
as softdirty.  Here's a program to demonstrate the bug:

int main() {
const uint64_t PAGEMAP_SOFTDIRTY = 1ul  55;
uint64_t pme[3];
int fd = open(/proc/self/pagemap, O_RDONLY);;
char *m = mmap(NULL, 3 * getpagesize(), PROT_READ,
   MAP_ANONYMOUS | MAP_SHARED, -1, 0);
munmap(m + getpagesize(), getpagesize());
pread(fd, pme, 24, (unsigned long) m / getpagesize() * 8);
assert(pme[0]  PAGEMAP_SOFTDIRTY);/* passes */
assert(!(pme[1]  PAGEMAP_SOFTDIRTY)); /* fails */
assert(pme[2]  PAGEMAP_SOFTDIRTY);/* passes */
return 0;
}

(Note that all pages in new VMAs are softdirty until cleared).

Tested:
Used the program given above. I'm going to include this code in
a selftest in the future.

[n-horigu...@ah.jp.nec.com: prevent pagemap_pte_range() from overrunning]
Signed-off-by: Peter Feiner pfei...@google.com
Cc: Kirill A. Shutemov kir...@shutemov.name
Cc: Cyrill Gorcunov gorcu...@openvz.org
Cc: Pavel Emelyanov xe...@parallels.com
Cc: Jamie Liu jamie...@google.com
Cc: Hugh Dickins hu...@google.com
Cc: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/proc/task_mmu.c |   59 +++--
 1 file changed, 39 insertions(+), 20 deletions(-)

--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -995,7 +995,6 @@ static int pagemap_pte_range(pmd_t *pmd,
spinlock_t *ptl;
pte_t *pte;
int err = 0;
-   pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm-v2));
 
/* find the first VMA at or above 'addr' */
vma = find_vma(walk-mm, addr);
@@ -1009,6 +1008,7 @@ static int pagemap_pte_range(pmd_t *pmd,
 
for (; addr != end; addr += PAGE_SIZE) {
unsigned long offset;
+   pagemap_entry_t pme;
 
offset = (addr  ~PAGEMAP_WALK_MASK) 
PAGE_SHIFT;
@@ -1023,32 +1023,51 @@ static int pagemap_pte_range(pmd_t *pmd,
 
if (pmd_trans_unstable(pmd))
return 0;
-   for (; addr != end; addr += PAGE_SIZE) {
-   int flags2;
 
-   /* check to see if we've left 'vma' behind
-* and need a new, higher one */
-   if (vma  (addr = vma-vm_end)) {
-   vma = find_vma(walk-mm, addr);
-   if (vma  (vma-vm_flags  VM_SOFTDIRTY))
-   flags2 = __PM_SOFT_DIRTY;
-   else
-   flags2 = 0;
-   pme = make_pme(PM_NOT_PRESENT(pm-v2) | 
PM_STATUS2(pm-v2, flags2));
+   while (1) {
+   /* End of address space hole, which we mark as non-present. */
+   unsigned long hole_end;
+
+   if (vma)
+   hole_end = min(end, vma-vm_start);
+   else
+   hole_end = end;
+
+   for (; addr  hole_end; addr += PAGE_SIZE) {
+   pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm-v2));
+
+   err = add_to_pagemap(addr, pme, pm);
+   if (err)
+   return err;
}
 
-   /* check that 'vma' actually covers this address,
-* and that it isn't a huge page vma */
-   if (vma  (vma-vm_start = addr) 
-   !is_vm_hugetlb_page(vma)) {
+   if (!vma || vma-vm_start = end)
+   break;
+   /*
+* We can't possibly be in a hugetlb VMA. In general,
+* for a mm_walk with a pmd_entry and a hugetlb_entry,
+* the pmd_entry can only be called on addresses in a
+* hugetlb if the walk starts in a non-hugetlb VMA and
+* spans a hugepage VMA. Since pagemap_read walks are
+* PMD-sized and PMD-aligned, this will never be true.
+*/
+   BUG_ON(is_vm_hugetlb_page(vma));
+
+   /* Addresses in the VMA. */
+   for (; addr  min(end, vma-vm_end); addr += PAGE_SIZE) {
+   pagemap_entry_t pme;
pte = pte_offset_map(pmd, addr);
pte_to_pagemap_entry(pme, pm, vma, addr, *pte);
-   /* unmap before userspace copy */
   

[PATCH 3.14 40/42] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Seth Jennings sjenn...@redhat.com

commit 351fc4a99d49fde63fe5ab7412beb35c40d27269 upstream.

Intel IA32 SDM Table 15-14 defines channel 0xf as 'not specified', but
EDAC doesn't know about this and returns and INTERNAL ERROR when the
channel is greater than NUM_CHANNELS:

kernel: [ 1538.886456] CPU 0: Machine Check Exception: 0 Bank 1: 
949f
kernel: [ 1538.886669] TSC 2bc68b22e7e812 ADDR 46dae7000 MISC 0 PROCESSOR 
0:306e4 TIME 1390414572 SOCKET 0 APIC 0
kernel: [ 1538.971948] EDAC MC1: INTERNAL ERROR: channel value is out of range 
(15 = 4)
kernel: [ 1538.972203] EDAC MC1: 0 CE memory read error on unknown memory 
(slot:0 page:0x46dae7 offset:0x0 grain:0 syndrome:0x0 -  area:DRAM 
err_code::009f socket:1 channel_mask:1 rank:0)

This commit changes sb_edac to forward a channel of -1 to EDAC if the
channel is not specified.  edac_mc_handle_error() sets the channel to -1
internally after the error message anyway, so this commit should have no
effect other than avoiding the INTERNAL ERROR message when the channel
is not specified.

Signed-off-by: Seth Jennings sjenn...@redhat.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
Cc: Vinson Lee v...@twopensource.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/edac/sb_edac.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -285,8 +285,9 @@ static const u32 correrrthrsld[] = {
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4
-#define MAX_DIMMS  3   /* Max DIMMS per channel */
+#define NUM_CHANNELS   4
+#define MAX_DIMMS  3   /* Max DIMMS per channel */
+#define CHANNEL_UNSPECIFIED0xf /* Intel IA32 SDM 15-14 */
 
 enum type {
SANDY_BRIDGE,
@@ -1750,6 +1751,9 @@ static void sbridge_mce_output_error(str
 
/* FIXME: need support for channel mask */
 
+   if (channel == CHANNEL_UNSPECIFIED)
+   channel = -1;
+
/* Call the helper to output message */
edac_mc_handle_error(tp_event, mci, core_err_cnt,
 m-addr  PAGE_SHIFT, m-addr  ~PAGE_MASK, 0,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] ARM: dts: berlin: relicense the BG2Q Marvell DMP dts under GPLv2/X11

2015-04-26 Thread Antoine Tenart
The current GPLv2 only licensing on this dts makes it very impractical
for other software components licensed under another license.

In order to make it easier for them to reuse our device trees, relicense
this dts under a GPLv2/X11 dual-license.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts 
b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index a98ac1bd8f65..4a749e5b3b44 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -1,9 +1,37 @@
 /*
  * Copyright (C) 2014 Antoine Ténart antoine.ten...@free-electrons.com
  *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed as is without any
- * warranty of any kind, whether express or implied.
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 14/42] mlx4: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -325,7 +325,7 @@ static u32 mlx4_en_free_tx_desc(struct m
}
}
}
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
return tx_info-nr_txbb;
 }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 30/42] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Naoya Horiguchi n-horigu...@ah.jp.nec.com

commit 9ab3b598d2dfbdb0153ffa7e4b1456bbff59a25d upstream.

A race condition starts to be visible in recent mmotm, where a PG_hwpoison
flag is set on a migration source page *before* it's back in buddy page
poo= l.

This is problematic because no page flag is supposed to be set when
freeing (see __free_one_page().) So the user-visible effect of this race
is that it could trigger the BUG_ON() when soft-offlining is called.

The root cause is that we call lru_add_drain_all() to make sure that the
page is in buddy, but that doesn't work because this function just
schedule= s a work item and doesn't wait its completion.
drain_all_pages() does drainin= g directly, so simply dropping
lru_add_drain_all() solves this problem.

[n-horigu...@ah.jp.nec.com: resolve conflict to apply on v3.11.10]
Fixes: f15bdfa802bf (mm/memory-failure.c: fix memory leak in successful soft 
offlining)
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Cc: Andi Kleen a...@firstfloor.org
Cc: Tony Luck tony.l...@intel.com
Cc: Chen Gong gong.c...@linux.intel.com
Cc: sta...@vger.kernel.org[3.11+]
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 mm/memory-failure.c |2 --
 1 file changed, 2 deletions(-)

--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1645,8 +1645,6 @@ static int __soft_offline_page(struct pa
 * setting PG_hwpoison.
 */
if (!is_free_buddy_page(page))
-   lru_add_drain_all();
-   if (!is_free_buddy_page(page))
drain_all_pages();
SetPageHWPoison(page);
if (!is_free_buddy_page(page))


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 23/42] Bluetooth: Ignore isochronous endpoints for Intel USB bootloader

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Marcel Holtmann mar...@holtmann.org

commit d92f2df0565ea04101d6ac04bdc10feeb1d93c94 upstream.

The isochronous endpoints are not valid when the Intel Bluetooth
controller boots up in bootloader mode. So just mark these endpoints
as broken and then they will not be configured.

Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Johan Hedberg johan.hedb...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/btusb.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -121,7 +121,8 @@ static const struct usb_device_id btusb_
{ USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) },
 
/* Intel Bluetooth USB Bootloader (RAM module) */
-   { USB_DEVICE(0x8087, 0x0a5a), .driver_info = BTUSB_INTEL_BOOT },
+   { USB_DEVICE(0x8087, 0x0a5a),
+ .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
 
{ } /* Terminating entry */
 };


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 29/42] Bluetooth: Add USB device 04ca:3010 as Atheros AR3012

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Janne Heikkinen janne.m.heikki...@gmail.com

commit 134d3b3550f050b9bec37111824452064d1ed928 upstream.

Asus X553MA has USB device 04ca:3010 that is Atheros AR3012
or compatible.

Device from /sys/kernel/debug/usb/devices:

T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#= 27 Spd=12   MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=04ca ProdID=3010 Rev= 0.02
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms

Signed-off-by: Janne Heikkinen janne.m.heikki...@gmail.com
Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -86,6 +86,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x04CA, 0x3007) },
{ USB_DEVICE(0x04CA, 0x3008) },
{ USB_DEVICE(0x04CA, 0x300b) },
+   { USB_DEVICE(0x04CA, 0x3010) },
{ USB_DEVICE(0x0930, 0x0219) },
{ USB_DEVICE(0x0930, 0x0220) },
{ USB_DEVICE(0x0930, 0x0227) },
@@ -139,6 +140,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -164,6 +164,7 @@ static const struct usb_device_id blackl
{ USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 08/27] openvswitch: Return vport module ref before destruction

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Thomas Graf tg...@suug.ch

[ Upstream commit fa2d8ff4e3522b4e05f590575d3eb8087f3a8cdc ]

Return module reference before invoking the respective vport
-destroy() function. This is needed as ovs_vport_del() is not
invoked inside an RCU read side critical section so the kfree
can occur immediately before returning to ovs_vport_del().

Returning the module reference before -destroy() is safe because
the module unregistration is blocked on ovs_lock which we hold
while destroying the datapath.

Fixes: 62b9c8d0372d (ovs: Turn vports with dependencies into separate modules)
Reported-by: Pravin Shelar pshe...@nicira.com
Signed-off-by: Thomas Graf tg...@suug.ch
Acked-by: Pravin B Shelar pshe...@nicira.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/openvswitch/vport.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport)
ASSERT_OVSL();
 
hlist_del_rcu(vport-hash_node);
-
-   vport-ops-destroy(vport);
-
module_put(vport-ops-owner);
+   vport-ops-destroy(vport);
 }
 
 /**


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 26/27] rtlwifi: rtl8192ee: Fix handling of new style descriptors

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Troy Tan troy_...@realsil.com.cn

commit d0311314d00298f83aa5450a1d4a92889e7cc2ea upstream.

The hardware and firmware for the RTL8192EE utilize a FIFO list of
descriptors. There were some problems with the initial implementation.
The worst of these failed to detect that the FIFO was becoming full,
which led to the device needing to be power cycled. As this condition
is not relevant to most of the devices supported by rtlwifi, a callback
routine was added to detect this situation. This patch implements the
necessary changes in the pci handler, and the linkage into the appropriate
rtl8192ee routine.

Signed-off-by: Troy Tan troy_...@realsil.com.cn
Signed-off-by: Larry Finger larry.fin...@lwfinger.net
Cc: Stable sta...@vger.kernel.org [V3.18]
Signed-off-by: Kalle Valo kv...@codeaurora.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/net/wireless/rtlwifi/pci.c   |   31 ---
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c  |3 --
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c |7 +++---
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.h |2 -
 drivers/net/wireless/rtlwifi/wifi.h  |1 
 5 files changed, 30 insertions(+), 14 deletions(-)

--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -578,6 +578,13 @@ static void _rtl_pci_tx_isr(struct ieee8
else
entry = (u8 *)(ring-desc[ring-idx]);
 
+   if (rtlpriv-cfg-ops-get_available_desc 
+   rtlpriv-cfg-ops-get_available_desc(hw, prio) = 1) {
+   RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_DMESG,
+no available desc!\n);
+   return;
+   }
+
if (!rtlpriv-cfg-ops-is_tx_desc_closed(hw, prio, ring-idx))
return;
ring-idx = (ring-idx + 1) % ring-entries;
@@ -641,10 +648,9 @@ static void _rtl_pci_tx_isr(struct ieee8
 
ieee80211_tx_status_irqsafe(hw, skb);
 
-   if ((ring-entries - skb_queue_len(ring-queue))
-   == 2) {
+   if ((ring-entries - skb_queue_len(ring-queue)) = 4) {
 
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
+   RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
 more desc left, wake skb_queue@%d, ring-idx 
= %d, skb_queue_len = 0x%x\n,
 prio, ring-idx,
 skb_queue_len(ring-queue));
@@ -793,7 +799,7 @@ static void _rtl_pci_rx_interrupt(struct
rx_remained_cnt =
rtlpriv-cfg-ops-rx_desc_buff_remained_cnt(hw,
  hw_queue);
-   if (rx_remained_cnt  1)
+   if (rx_remained_cnt == 0)
return;
 
} else {/* rx descriptor */
@@ -845,18 +851,18 @@ static void _rtl_pci_rx_interrupt(struct
else
skb_reserve(skb, stats.rx_drvinfo_size +
stats.rx_bufshift);
-
} else {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
 skb-end - skb-tail = %d, len is %d\n,
 skb-end - skb-tail, len);
-   break;
+   dev_kfree_skb_any(skb);
+   goto new_trx_end;
}
/* handle command packet here */
if (rtlpriv-cfg-ops-rx_command_packet 
rtlpriv-cfg-ops-rx_command_packet(hw, stats, skb)) {
dev_kfree_skb_any(skb);
-   goto end;
+   goto new_trx_end;
}
 
/*
@@ -906,6 +912,7 @@ static void _rtl_pci_rx_interrupt(struct
} else {
dev_kfree_skb_any(skb);
}
+new_trx_end:
if (rtlpriv-use_new_trx_flow) {
rtlpci-rx_ring[hw_queue].next_rx_rp += 1;
rtlpci-rx_ring[hw_queue].next_rx_rp %=
@@ -921,7 +928,6 @@ static void _rtl_pci_rx_interrupt(struct
rtlpriv-enter_ps = false;
schedule_work(rtlpriv-works.lps_change_work);
}
-end:
skb = new_skb;
 no_new:
if (rtlpriv-use_new_trx_flow) {
@@ -1695,6 +1701,15 @@ static int rtl_pci_tx(struct ieee80211_h
}
}
 
+   if (rtlpriv-cfg-ops-get_available_desc 
+   rtlpriv-cfg-ops-get_available_desc(hw, hw_queue) == 0) {
+   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
+ 

[PATCH 3.19 21/27] tg3: Hold tp-lock before calling tg3_halt() from tg3_init_one()

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Jun'ichi Nomura (NEC) j-nom...@ce.jp.nec.com

[ Upstream commit d0af71a3573f1217b140c60b66f1a9b335fb058b ]

tg3_init_one() calls tg3_halt() without tp-lock despite its assumption
and causes deadlock.
If lockdep is enabled, a warning like this shows up before the stall:

  [ BUG: bad unlock balance detected! ]
  3.19.0test #3 Tainted: GE
  -
  insmod/369 is trying to release lock ((tp-lock)-rlock) at:
  [a02d5a1d] tg3_chip_reset+0x14d/0x780 [tg3]
  but there are no more locks to release!

tg3_init_one() doesn't call tg3_halt() under normal situation but
during kexec kdump I hit this problem.

Fixes: 932f19de (tg3: Release tp-lock before invoking synchronize_irq())
Signed-off-by: Jun'ichi Nomura j-nom...@ce.jp.nec.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/broadcom/tg3.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17868,8 +17868,10 @@ static int tg3_init_one(struct pci_dev *
 */
if ((tr32(HOSTCC_MODE)  HOSTCC_MODE_ENABLE) ||
(tr32(WDMAC_MODE)  WDMAC_MODE_ENABLE)) {
+   tg3_full_lock(tp, 0);
tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
+   tg3_full_unlock(tp);
}
 
err = tg3_test_dma(tp);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 18/27] udptunnels: Call handle_offloads after inserting vlan tag.

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Jesse Gross je...@nicira.com

[ Upstream commit b736a623bd099cdf5521ca9bd03559f3bc7fa31c ]

handle_offloads() calls skb_reset_inner_headers() to store
the layer pointers to the encapsulated packet. However, we
currently push the vlag tag (if there is one) onto the packet
afterwards. This changes the MAC header for the encapsulated
packet but it is not reflected in skb-inner_mac_header, which
breaks GSO and drivers which attempt to use this for encapsulation
offloads.

Fixes: 1eaa8178 (vxlan: Add tx-vlan offload support.)
Signed-off-by: Jesse Gross je...@nicira.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/vxlan.c |   20 ++--
 net/ipv4/geneve.c   |8 
 2 files changed, 14 insertions(+), 14 deletions(-)

--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1578,12 +1578,6 @@ static int vxlan6_xmit_skb(struct vxlan_
int err;
bool udp_sum = !udp_get_no_check6_tx(vs-sock-sk);
 
-   skb = udp_tunnel_handle_offloads(skb, udp_sum);
-   if (IS_ERR(skb)) {
-   err = -EINVAL;
-   goto err;
-   }
-
skb_scrub_packet(skb, xnet);
 
min_headroom = LL_RESERVED_SPACE(dst-dev) + dst-header_len
@@ -1603,6 +1597,12 @@ static int vxlan6_xmit_skb(struct vxlan_
goto err;
}
 
+   skb = udp_tunnel_handle_offloads(skb, udp_sum);
+   if (IS_ERR(skb)) {
+   err = -EINVAL;
+   goto err;
+   }
+
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh-vx_flags = htonl(VXLAN_FLAGS);
vxh-vx_vni = vni;
@@ -1628,10 +1628,6 @@ int vxlan_xmit_skb(struct vxlan_sock *vs
int err;
bool udp_sum = !vs-sock-sk-sk_no_check_tx;
 
-   skb = udp_tunnel_handle_offloads(skb, udp_sum);
-   if (IS_ERR(skb))
-   return PTR_ERR(skb);
-
min_headroom = LL_RESERVED_SPACE(rt-dst.dev) + rt-dst.header_len
+ VXLAN_HLEN + sizeof(struct iphdr)
+ (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
@@ -1647,6 +1643,10 @@ int vxlan_xmit_skb(struct vxlan_sock *vs
if (WARN_ON(!skb))
return -ENOMEM;
 
+   skb = udp_tunnel_handle_offloads(skb, udp_sum);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh-vx_flags = htonl(VXLAN_FLAGS);
vxh-vx_vni = vni;
--- a/net/ipv4/geneve.c
+++ b/net/ipv4/geneve.c
@@ -121,10 +121,6 @@ int geneve_xmit_skb(struct geneve_sock *
int min_headroom;
int err;
 
-   skb = udp_tunnel_handle_offloads(skb, !gs-sock-sk-sk_no_check_tx);
-   if (IS_ERR(skb))
-   return PTR_ERR(skb);
-
min_headroom = LL_RESERVED_SPACE(rt-dst.dev) + rt-dst.header_len
+ GENEVE_BASE_HLEN + opt_len + sizeof(struct iphdr)
+ (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
@@ -139,6 +135,10 @@ int geneve_xmit_skb(struct geneve_sock *
if (unlikely(!skb))
return -ENOMEM;
 
+   skb = udp_tunnel_handle_offloads(skb, !gs-sock-sk-sk_no_check_tx);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len);
geneve_build_header(gnvh, tun_flags, vni, opt_len, opt);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 02/27] rocker: handle non-bridge master change

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Simon Horman simon.hor...@netronome.com

[ Upstream commit a6e95cc718c8916a13f1e1e9d33cacbc5db56c0f ]

Master change notifications may occur other than when joining or
leaving a bridge, for example when being added to or removed from
a bond or Open vSwitch.

Previously in those cases rocker_port_bridge_leave() was called
which results in a null-pointer dereference as rocker_port-bridge_dev
is NULL because there is no bridge device.

This patch makes provision for doing nothing in such cases.

Fixes: 6c7079450071f (rocker: implement L2 bridge offloading)
Acked-by: Jiri Pirko j...@resnulli.us
Acked-by: Scott Feldman sfel...@gmail.com
Signed-off-by: Simon Horman simon.hor...@netronome.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/rocker/rocker.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -4305,10 +4305,16 @@ static int rocker_port_master_changed(st
struct net_device *master = netdev_master_upper_dev_get(dev);
int err = 0;
 
+   /* There are currently three cases handled here:
+* 1. Joining a bridge
+* 2. Leaving a previously joined bridge
+* 3. Other, e.g. being added to or removed from a bond or openvswitch,
+*in which case nothing is done
+*/
if (master  master-rtnl_link_ops 
!strcmp(master-rtnl_link_ops-kind, bridge))
err = rocker_port_bridge_join(rocker_port, master);
-   else
+   else if (rocker_port_is_bridged(rocker_port))
err = rocker_port_bridge_leave(rocker_port);
 
return err;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 27/27] fs: take i_mutex during prepare_binprm for set[ug]id executables

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Jann Horn j...@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 j...@thejh.net
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/exec.c |   76 +++---
 1 file changed, 48 insertions(+), 28 deletions(-)

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1259,6 +1259,53 @@ static void check_unsafe_exec(struct lin
spin_unlock(p-fs-lock);
 }
 
+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 (task_no_new_privs(current))
+   return;
+
+   inode = file_inode(bprm-file);
+   mode = READ_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
@@ -1267,36 +1314,9 @@ static void check_unsafe_exec(struct lin
  */
 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) 
-   !task_no_new_privs(current) 
-   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);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 23/27] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Ian Abbott abbo...@mev.co.uk

commit abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 upstream.

Reading of analog input channels by the `INSN_READ` comedi instruction
is broken for all except channel 0.  `pci171x_ai_insn_read()` calls
`pci171x_ai_read_sample()` with the wrong value for the third parameter.
It is supposed to be the current index in a channel list (which is
always of length 1 in this case, so the index should be 0), but instead
it is passing the actual channel number.  `pci171x_ai_read_sample()`
checks the channel number encoded in the raw sample value read from the
hardware matches the channel number stored in the specified index of the
previously set up channel list and returns `-ENODATA` if it doesn't
match.  Since the index should always be 0 in this case, the match will
fail unless the channel number is also 0.  Fix it by passing 0 as the
channel index.

Note that when the bug first appeared, it was `pci171x_ai_dropout()`
that was called with the wrong parameter value.  `pci171x_ai_dropout()`
got replaced with `pci171x_ai_read_sample()` in commit 7fd2dae2500d
(staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()).

Fixes: 16c7eb6047bb (staging: comedi: adv_pci1710: always enable 
PCI171x_PARANOIDCHECK code)
Signed-off-by: Ian Abbott abbo...@mev.co.uk
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org


---
 drivers/staging/comedi/drivers/adv_pci1710.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -455,7 +455,6 @@ static int pci171x_insn_read_ai(struct c
struct comedi_insn *insn, unsigned int *data)
 {
struct pci1710_private *devpriv = dev-private;
-   unsigned int chan = CR_CHAN(insn-chanspec);
int ret = 0;
int i;
 
@@ -477,7 +476,7 @@ static int pci171x_insn_read_ai(struct c
break;
 
val = inw(dev-iobase + PCI171x_AD_DATA);
-   ret = pci171x_ai_dropout(dev, s, chan, val);
+   ret = pci171x_ai_dropout(dev, s, 0, val);
if (ret)
break;
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 25/27] mm/hugetlb: take page table lock in follow_huge_pmd()

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Naoya Horiguchi n-horigu...@ah.jp.nec.com

commit e66f17ff71772b209eed39de35aaa99ba819c93d upstream.

We have a race condition between move_pages() and freeing hugepages, where
move_pages() calls follow_page(FOLL_GET) for hugepages internally and
tries to get its refcount without preventing concurrent freeing.  This
race crashes the kernel, so this patch fixes it by moving FOLL_GET code
for hugepages into follow_huge_pmd() with taking the page table lock.

This patch intentionally removes page==NULL check after pte_page.
This is justified because pte_page() never returns NULL for any
architectures or configurations.

This patch changes the behavior of follow_huge_pmd() for tail pages and
then tail pages can be pinned/returned.  So the caller must be changed to
properly handle the returned tail pages.

We could have a choice to add the similar locking to
follow_huge_(addr|pud) for consistency, but it's not necessary because
currently these functions don't support FOLL_GET flag, so let's leave it
for future development.

Here is the reproducer:

  $ cat movepages.c
  #include stdio.h
  #include stdlib.h
  #include numaif.h

  #define ADDR_INPUT  0x7000UL
  #define HPS 0x20
  #define PS  0x1000

  int main(int argc, char *argv[]) {
  int i;
  int nr_hp = strtol(argv[1], NULL, 0);
  int nr_p  = nr_hp * HPS / PS;
  int ret;
  void **addrs;
  int *status;
  int *nodes;
  pid_t pid;

  pid = strtol(argv[2], NULL, 0);
  addrs  = malloc(sizeof(char *) * nr_p + 1);
  status = malloc(sizeof(char *) * nr_p + 1);
  nodes  = malloc(sizeof(char *) * nr_p + 1);

  while (1) {
  for (i = 0; i  nr_p; i++) {
  addrs[i] = (void *)ADDR_INPUT + i * PS;
  nodes[i] = 1;
  status[i] = 0;
  }
  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
MPOL_MF_MOVE_ALL);
  if (ret == -1)
  err(move_pages);

  for (i = 0; i  nr_p; i++) {
  addrs[i] = (void *)ADDR_INPUT + i * PS;
  nodes[i] = 0;
  status[i] = 0;
  }
  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
MPOL_MF_MOVE_ALL);
  if (ret == -1)
  err(move_pages);
  }
  return 0;
  }

  $ cat hugepage.c
  #include stdio.h
  #include sys/mman.h
  #include string.h

  #define ADDR_INPUT  0x7000UL
  #define HPS 0x20

  int main(int argc, char *argv[]) {
  int nr_hp = strtol(argv[1], NULL, 0);
  char *p;

  while (1) {
  p = mmap((void *)ADDR_INPUT, nr_hp * HPS, PROT_READ | 
PROT_WRITE,
   MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
  if (p != (void *)ADDR_INPUT) {
  perror(mmap);
  break;
  }
  memset(p, 0, nr_hp * HPS);
  munmap(p, nr_hp * HPS);
  }
  }

  $ sysctl vm.nr_hugepages=40
  $ ./hugepage 10 
  $ ./movepages 10 $(pgrep -f hugepage)


[n-horigu...@ah.jp.nec.com: resolve conflict to apply to v3.19.1]
Fixes: e632a938d914 (mm: migrate: add hugepage migration code to move_pages())
Signed-off-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Reported-by: Hugh Dickins hu...@google.com
Cc: James Hogan james.ho...@imgtec.com
Cc: David Rientjes rient...@google.com
Cc: Mel Gorman m...@csn.ul.ie
Cc: Johannes Weiner han...@cmpxchg.org
Cc: Michal Hocko mho...@suse.cz
Cc: Rik van Riel r...@redhat.com
Cc: Andrea Arcangeli aarca...@redhat.com
Cc: Luiz Capitulino lcapitul...@redhat.com
Cc: Nishanth Aravamudan n...@linux.vnet.ibm.com
Cc: Lee Schermerhorn lee.schermerh...@hp.com
Cc: Steve Capper steve.cap...@linaro.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 include/linux/hugetlb.h |8 
 include/linux/swapops.h |4 
 mm/gup.c|   25 -
 mm/hugetlb.c|   48 ++--
 mm/migrate.c|5 +++--
 5 files changed, 53 insertions(+), 37 deletions(-)

--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -99,9 +99,9 @@ int huge_pmd_unshare(struct mm_struct *m
 struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
  int write);
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
- 

Re: [linux-sunxi] [PATCH 2/3] spidev: Add DT binding example.

2015-04-26 Thread Michal Suchanek
On 26 April 2015 at 16:33, Maxime Ripard
maxime.rip...@free-electrons.com wrote:
 On Sun, Apr 26, 2015 at 04:14:33PM +0200, Michal Suchanek wrote:
 On 26 April 2015 at 14:51, Maxime Ripard
 maxime.rip...@free-electrons.com wrote:
  On Sun, Apr 26, 2015 at 02:38:18PM +0200, Michal Suchanek wrote:
  On 26 April 2015 at 13:56, Martin Sperl ker...@martin.sperl.org wrote:
  
   On 26.04.2015, at 13:23, Hans de Goede hdego...@redhat.com wrote:
   I think there is actual a use for just binding spidev as spidev,
   think e.g. the spi pins on the raspberry pi.
  
   How do you deal we suggest with such a situation ?
  
   I actually asked the same question a few days ago on the spi list
   (in thread: spi: spidev: Warn loudly if instantiated from DT as 
   “spidev”)
   and the summary was:
  
   You can still do as before, but you have to accept that long
   irritating warning.
  
   Or you patch spidev.c to include your pattern of choice for compatiblity
 
  So the suggestion is to add a compatible string like olimex,uext-slot
  to spidev and use that compatible in the DT?
 
  No, you add a compatible for the device that is connected to the bus
  through that slot.

 There is no device connected in the slot by design. The slot is there
 for connecting random stuff you find in your mailbox or other drawers
 and boxes.

 I know. Our point is add a compatible for that random device you find
 in your mailbox.

That would be mailbox,device-tbd I suppose?


  That can certainly be done but adding a new compatible for every board
  that has some random pins looks like a needless nuisance to me.
  Especially compared to i2c where you can just open the bus so long as
  ti is enabled.
 
  
   Or you implement the following proposal (which needs a volunteer):
   On 23.04.2015, at 09:42, Geert Uytterhoeven ge...@linux-m68k.org 
   wrote:
  
   So what you need is a way to handover from generic spidev to a 
   device-specific
   driver, cfr. what graphics drivers do when the device has been bound 
   to by
   vesafb or simplefb.
  
   Could this be implemented in a generic way in the spi or DT code?
  
   ...
   On 23.04.2015, at 12:36, Mark Brown broo...@kernel.org wrote:
   On Thu, Apr 23, 2015 at 09:45:16AM +0200, Geert Uytterhoeven wrote:
  
   I guess this has been suggested before: the spi core could provide 
   spidev
   access to all spi client devices which are not bound by a driver?
  
   I don't know if it's been suggested before, certainly nobody did the
   work to make it happen.  I don't think I have a massive objection in
   principal.
 
  Actually, I did it a year ago, and it looked at the time that it
  wasn't what should be done either.

 There is nothing like unclaimed device. Either there is a device and
 driver for it may in principle be loaded later as a module or the chip
 select is reserved for use from userspace.

 I never said it was perfect.

 Userspace driver is valid option and should have the ability to have
 the chip select reserved.

 Whether an userspace driver is a valid option can spawn a whole debate
 by its own, but it's true that we should be able to have it exported
 to the userspace.

 However, having a spidev compatible is not the solution to that
 problem.

Having to patch the kernel to use an unknown device with userspace
driver is not the answer either.

Devices which are not performance critical and don't use existing
kernel frameworks don't have any use for kernel driver.

In fact, writing a kernel driver for them is counter-productive
because you will have to write from scratch when you connect the
device to a box running another OS due to interface *and* license
difference.

Also for driver prototyping you need a compatible which makes the
device accessible.

If no spidev general compatible is available people will just use
comaptible for some random device which happens to bind to spidev and
will send many letters of thanks to the DT maintainers when the device
used for this purpose suddenly grows a Linux driver.


  https://lkml.org/lkml/2014/4/28/612
 
  But how do you know there is a device?
 
  Devices on i2c can be probed. On spi you just transfer random data and
  hope it does something useful. Some devices have readable registers
  and can be probed in a device-specific way but others are write-only.
 
  Well, what's the point of communicating with a non-existent device in
  the first place?

 I have multitude of SPI devices which are not part of the board and
 hence its DT and can be connected to the board with jumper wires.

 Most of them don't have a linux driver or compatible to bind with.

 Then create such a compatible...

I will if and when the device is usable.


  So binding spidev is in my view just saying that you are going to
  transfer random data from userspace on this bus.
 
  Yes, to a device connected on that bus.

 Yes, so I have this red rectangular PCB, blue PCB, and red square PCB
 and blue very thin rectangular PCB.

 Please enlighten me how to add 

Re: [linux-sunxi] [PATCH 2/3] spidev: Add DT binding example.

2015-04-26 Thread Maxime Ripard
On Sun, Apr 26, 2015 at 05:33:36PM +0200, Michal Suchanek wrote:
 On 26 April 2015 at 16:33, Maxime Ripard
 maxime.rip...@free-electrons.com wrote:
  On Sun, Apr 26, 2015 at 04:14:33PM +0200, Michal Suchanek wrote:
  On 26 April 2015 at 14:51, Maxime Ripard
  maxime.rip...@free-electrons.com wrote:
   On Sun, Apr 26, 2015 at 02:38:18PM +0200, Michal Suchanek wrote:
   On 26 April 2015 at 13:56, Martin Sperl ker...@martin.sperl.org wrote:
   
On 26.04.2015, at 13:23, Hans de Goede hdego...@redhat.com wrote:
I think there is actual a use for just binding spidev as spidev,
think e.g. the spi pins on the raspberry pi.
   
How do you deal we suggest with such a situation ?
   
I actually asked the same question a few days ago on the spi list
(in thread: spi: spidev: Warn loudly if instantiated from DT as 
“spidev”)
and the summary was:
   
You can still do as before, but you have to accept that long
irritating warning.
   
Or you patch spidev.c to include your pattern of choice for 
compatiblity
  
   So the suggestion is to add a compatible string like olimex,uext-slot
   to spidev and use that compatible in the DT?
  
   No, you add a compatible for the device that is connected to the bus
   through that slot.
 
  There is no device connected in the slot by design. The slot is there
  for connecting random stuff you find in your mailbox or other drawers
  and boxes.
 
  I know. Our point is add a compatible for that random device you find
  in your mailbox.
 
 That would be mailbox,device-tbd I suppose?

If you can find a programming model and a matching datasheet for that
device, I suppose, yes.

   That can certainly be done but adding a new compatible for every board
   that has some random pins looks like a needless nuisance to me.
   Especially compared to i2c where you can just open the bus so long as
   ti is enabled.
  
   
Or you implement the following proposal (which needs a volunteer):
On 23.04.2015, at 09:42, Geert Uytterhoeven ge...@linux-m68k.org 
wrote:
   
So what you need is a way to handover from generic spidev to a 
device-specific
driver, cfr. what graphics drivers do when the device has been bound 
to by
vesafb or simplefb.
   
Could this be implemented in a generic way in the spi or DT code?
   
...
On 23.04.2015, at 12:36, Mark Brown broo...@kernel.org wrote:
On Thu, Apr 23, 2015 at 09:45:16AM +0200, Geert Uytterhoeven wrote:
   
I guess this has been suggested before: the spi core could provide 
spidev
access to all spi client devices which are not bound by a driver?
   
I don't know if it's been suggested before, certainly nobody did the
work to make it happen.  I don't think I have a massive objection in
principal.
  
   Actually, I did it a year ago, and it looked at the time that it
   wasn't what should be done either.
 
  There is nothing like unclaimed device. Either there is a device and
  driver for it may in principle be loaded later as a module or the chip
  select is reserved for use from userspace.
 
  I never said it was perfect.
 
  Userspace driver is valid option and should have the ability to have
  the chip select reserved.
 
  Whether an userspace driver is a valid option can spawn a whole debate
  by its own, but it's true that we should be able to have it exported
  to the userspace.
 
  However, having a spidev compatible is not the solution to that
  problem.
 
 Having to patch the kernel to use an unknown device with userspace
 driver is not the answer either.
 
 Devices which are not performance critical and don't use existing
 kernel frameworks don't have any use for kernel driver.
 
 In fact, writing a kernel driver for them is counter-productive
 because you will have to write from scratch when you connect the
 device to a box running another OS due to interface *and* license
 difference.

And here is the debate...

 Also for driver prototyping you need a compatible which makes the
 device accessible.
 
 If no spidev general compatible is available people will just use
 comaptible for some random device which happens to bind to spidev and
 will send many letters of thanks to the DT maintainers when the device
 used for this purpose suddenly grows a Linux driver.

If people do dumb things, they should expect it to backfire.

   https://lkml.org/lkml/2014/4/28/612
  
   But how do you know there is a device?
  
   Devices on i2c can be probed. On spi you just transfer random data and
   hope it does something useful. Some devices have readable registers
   and can be probed in a device-specific way but others are write-only.
  
   Well, what's the point of communicating with a non-existent device in
   the first place?
 
  I have multitude of SPI devices which are not part of the board and
  hence its DT and can be connected to the board with jumper wires.
 
  Most of them don't have a linux driver or compatible to bind with.
 
  Then 

[PATCH 3.10 29/31] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 9c145c56d0c8a0b62e48c8d71e055ad0fb2012ba upstream.

The stack guard page error case has long incorrectly caused a SIGBUS
rather than a SIGSEGV, but nobody actually noticed until commit
fee7e49d4514 (mm: propagate error from stack expansion even for guard
page) because that error case was never actually triggered in any
normal situations.

Now that we actually report the error, people noticed the wrong signal
that resulted.  So far, only the test suite of libsigsegv seems to have
actually cared, but there are real applications that use libsigsegv, so
let's not wait for any of those to break.

Reported-and-tested-by: Takashi Iwai ti...@suse.de
Tested-by: Jan Engelhardt jeng...@inai.de
Acked-by: Heiko Carstens heiko.carst...@de.ibm.com # s390 still compiles and 
boots
Cc: linux-a...@vger.kernel.org
Cc: sta...@vger.kernel.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 mm/memory.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3232,7 +3232,7 @@ static int do_anonymous_page(struct mm_s
 
/* Check if we need to add a guard page to the stack */
if (check_stack_guard_page(vma, address)  0)
-   return VM_FAULT_SIGBUS;
+   return VM_FAULT_SIGSEGV;
 
/* Use the zero-page for reads */
if (!(flags  FAULT_FLAG_WRITE)) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 06/31] tcp: tcp_make_synack() should clear skb-tstamp

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@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 eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_output.c |2 ++
 1 file changed, 2 insertions(+)

--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2772,6 +2772,8 @@ struct sk_buff *tcp_make_synack(struct s
}
 #endif
 
+   /* Do not fool tcpdump (if any), clean our debris */
+   skb-tstamp.tv64 = 0;
return skb;
 }
 EXPORT_SYMBOL(tcp_make_synack);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 02/31] remove extra definitions of U32_MAX

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Elder alex.el...@linaro.org

commit 04f9b74e4d96d349de12fdd4e6626af4a9f75e09 upstream.

Now that the definition is centralized in linux/kernel.h, the
definitions of U32_MAX (and related) elsewhere in the kernel can be
removed.

Signed-off-by: Alex Elder el...@linaro.org
Acked-by: Sage Weil s...@inktank.com
Acked-by: David S. Miller da...@davemloft.net
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/reiserfs/reiserfs.h  |4 
 include/linux/ceph/decode.h |   19 ---
 net/ipv4/tcp_illinois.c |3 ---
 3 files changed, 26 deletions(-)

--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -1954,10 +1954,6 @@ struct treepath var = {.path_length = IL
 #define MAX_US_INT 0x
 
 // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
-#ifndef U32_MAX
-#define U32_MAX (~(__u32)0)
-#endif /* !U32_MAX */
-
 static inline loff_t max_reiserfs_offset(struct inode *inode)
 {
if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -8,25 +8,6 @@
 
 #include linux/ceph/types.h
 
-/* This seemed to be the easiest place to define these */
-
-#ifndef U32_MAX
-#defineU8_MAX  ((u8)(~0U))
-#defineU16_MAX ((u16)(~0U))
-#defineU32_MAX ((u32)(~0U))
-#defineU64_MAX ((u64)(~0ULL))
-
-#defineS8_MAX  ((s8)(U8_MAX  1))
-#defineS16_MAX ((s16)(U16_MAX  1))
-#defineS32_MAX ((s32)(U32_MAX  1))
-#defineS64_MAX ((s64)(U64_MAX  1LL))
-
-#defineS8_MIN  ((s8)(-S8_MAX - 1))
-#defineS16_MIN ((s16)(-S16_MAX - 1))
-#defineS32_MIN ((s32)(-S32_MAX - 1))
-#defineS64_MIN ((s64)(-S64_MAX - 1LL))
-#endif /* !U32_MAX */
-
 /*
  * in all cases,
  *   void **p pointer to position pointer
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -23,9 +23,6 @@
 #define ALPHA_MIN  ((3*ALPHA_SCALE)/10)/* ~0.3 */
 #define ALPHA_MAX  (10*ALPHA_SCALE)/* 10.0 */
 #define ALPHA_BASE ALPHA_SCALE /* 1.0 */
-#ifndef U32_MAX
-#define U32_MAX((u32)~0U)
-#endif /* !U32_MAX */
 #define RTT_MAX(U32_MAX / ALPHA_MAX)   /* 3.3 secs */
 
 #define BETA_SHIFT 6


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 20/31] Bluetooth: btusb: Add IMC Networks (Broadcom based)

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Jurgen Kramer gtmkra...@xs4all.nl

commit 9113bfd82dc8ece9cbb898df8794f58a78a36e97 upstream.

Add support for IMC Networks (Broadcom based) to btusb driver.

Below the output of /sys/kernel/debug/usb/devices for this device:

T:  Bus=01 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=13d3 ProdID=3404 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=240A649F8246
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Jurgen Kramer gtmkra...@xs4all.nl
Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/btusb.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -113,6 +113,9 @@ static struct usb_device_id btusb_table[
/*Broadcom devices with vendor specific id */
{ USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) },
 
+   /* IMC Networks - Broadcom based */
+   { USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) },
+
{ } /* Terminating entry */
 };
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 26/31] move d_rcu from overlapping d_child to overlapping d_alias

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Al Viro v...@zeniv.linux.org.uk

commit 946e51f2bf37f1656916eb75bd0742ba33983c28 upstream.

Signed-off-by: Al Viro v...@zeniv.linux.org.uk
Cc: Ben Hutchings b...@decadent.org.uk
[hujianyang: Backported to 3.10 refer to the work of Ben Hutchings in 3.2:
 - Apply name changes in all the different places we use d_alias and d_child
 - Move the WARN_ON() in __d_free() to d_free() as we don't have dentry_free()]
Signed-off-by: hujianyang hujiany...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/powerpc/platforms/cell/spufs/inode.c |2 
 fs/affs/amigaffs.c|2 
 fs/autofs4/expire.c   |   12 ++---
 fs/autofs4/root.c |2 
 fs/ceph/dir.c |8 +--
 fs/ceph/inode.c   |6 +-
 fs/cifs/inode.c   |2 
 fs/coda/cache.c   |2 
 fs/dcache.c   |   72 +++---
 fs/debugfs/inode.c|6 +-
 fs/exportfs/expfs.c   |2 
 fs/libfs.c|   12 ++---
 fs/ncpfs/dir.c|2 
 fs/ncpfs/ncplib_kernel.h  |4 -
 fs/nfs/getroot.c  |2 
 fs/notify/fsnotify.c  |4 -
 fs/ocfs2/dcache.c |2 
 include/linux/dcache.h|8 +--
 kernel/cgroup.c   |2 
 kernel/trace/trace.c  |4 -
 kernel/trace/trace_events.c   |2 
 security/selinux/selinuxfs.c  |6 +-
 22 files changed, 82 insertions(+), 82 deletions(-)

--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentr
struct dentry *dentry, *tmp;
 
mutex_lock(dir-d_inode-i_mutex);
-   list_for_each_entry_safe(dentry, tmp, dir-d_subdirs, d_u.d_child) {
+   list_for_each_entry_safe(dentry, tmp, dir-d_subdirs, d_child) {
spin_lock(dentry-d_lock);
if (!(d_unhashed(dentry))  dentry-d_inode) {
dget_dlock(dentry);
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -126,7 +126,7 @@ affs_fix_dcache(struct inode *inode, u32
 {
struct dentry *dentry;
spin_lock(inode-i_lock);
-   hlist_for_each_entry(dentry, inode-i_dentry, d_alias) {
+   hlist_for_each_entry(dentry, inode-i_dentry, d_u.d_alias) {
if (entry_ino == (u32)(long)dentry-d_fsdata) {
dentry-d_fsdata = (void *)inode-i_ino;
break;
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -91,7 +91,7 @@ static struct dentry *get_next_positive_
spin_lock(root-d_lock);
 
if (prev)
-   next = prev-d_u.d_child.next;
+   next = prev-d_child.next;
else {
prev = dget_dlock(root);
next = prev-d_subdirs.next;
@@ -105,13 +105,13 @@ cont:
return NULL;
}
 
-   q = list_entry(next, struct dentry, d_u.d_child);
+   q = list_entry(next, struct dentry, d_child);
 
spin_lock_nested(q-d_lock, DENTRY_D_LOCK_NESTED);
/* Already gone or negative dentry (under construction) - try next */
if (q-d_count == 0 || !simple_positive(q)) {
spin_unlock(q-d_lock);
-   next = q-d_u.d_child.next;
+   next = q-d_child.next;
goto cont;
}
dget_dlock(q);
@@ -161,13 +161,13 @@ again:
goto relock;
}
spin_unlock(p-d_lock);
-   next = p-d_u.d_child.next;
+   next = p-d_child.next;
p = parent;
if (next != parent-d_subdirs)
break;
}
}
-   ret = list_entry(next, struct dentry, d_u.d_child);
+   ret = list_entry(next, struct dentry, d_child);
 
spin_lock_nested(ret-d_lock, DENTRY_D_LOCK_NESTED);
/* Negative dentry - try next */
@@ -447,7 +447,7 @@ found:
spin_lock(sbi-lookup_lock);
spin_lock(expired-d_parent-d_lock);
spin_lock_nested(expired-d_lock, DENTRY_D_LOCK_NESTED);
-   list_move(expired-d_parent-d_subdirs, expired-d_u.d_child);
+   list_move(expired-d_parent-d_subdirs, expired-d_child);
spin_unlock(expired-d_lock);
spin_unlock(expired-d_parent-d_lock);
spin_unlock(sbi-lookup_lock);
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -655,7 +655,7 @@ static void autofs_clear_leaf_automount_
/* only consider parents below dentrys in the root */
if 

[PATCH 3.10 22/31] Bluetooth: Ignore isochronous endpoints for Intel USB bootloader

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Marcel Holtmann mar...@holtmann.org

commit d92f2df0565ea04101d6ac04bdc10feeb1d93c94 upstream.

The isochronous endpoints are not valid when the Intel Bluetooth
controller boots up in bootloader mode. So just mark these endpoints
as broken and then they will not be configured.

Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Johan Hedberg johan.hedb...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/btusb.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -118,7 +118,8 @@ static struct usb_device_id btusb_table[
{ USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) },
 
/* Intel Bluetooth USB Bootloader (RAM module) */
-   { USB_DEVICE(0x8087, 0x0a5a), .driver_info = BTUSB_INTEL_BOOT },
+   { USB_DEVICE(0x8087, 0x0a5a),
+ .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
 
{ } /* Terminating entry */
 };


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 23/31] netfilter: conntrack: disable generic tracking for known protocols

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Florian Westphal f...@strlen.de

commit db29a9508a9246e77087c5531e45b2c88ec6988b upstream.

Given following iptables ruleset:

-P FORWARD DROP
-A FORWARD -m sctp --dport 9 -j ACCEPT
-A FORWARD -p tcp --dport 80 -j ACCEPT
-A FORWARD -p tcp -m conntrack -m state ESTABLISHED,RELATED -j ACCEPT

One would assume that this allows SCTP on port 9 and TCP on port 80.
Unfortunately, if the SCTP conntrack module is not loaded, this allows
*all* SCTP communication, to pass though, i.e. -p sctp -j ACCEPT,
which we think is a security issue.

This is because on the first SCTP packet on port 9, we create a dummy
generic l4 conntrack entry without any port information (since
conntrack doesn't know how to extract this information).

All subsequent packets that are unknown will then be in established
state since they will fallback to proto_generic and will match the
'generic' entry.

Our originally proposed version [1] completely disabled generic protocol
tracking, but Jozsef suggests to not track protocols for which a more
suitable helper is available, hence we now mitigate the issue for in
tree known ct protocol helpers only, so that at least NAT and direction
information will still be preserved for others.

 [1] http://www.spinics.net/lists/netfilter-devel/msg33430.html

Joint work with Daniel Borkmann.

Fixes CVE-2014-8160.

Signed-off-by: Florian Westphal f...@strlen.de
Signed-off-by: Daniel Borkmann dbork...@redhat.com
Acked-by: Jozsef Kadlecsik kad...@blackhole.kfki.hu
Signed-off-by: Pablo Neira Ayuso pa...@netfilter.org
Signed-off-by: Zhiqiang Zhang zhangzhiqiang.zh...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/netfilter/nf_conntrack_proto_generic.c |   26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -14,6 +14,30 @@
 
 static unsigned int nf_ct_generic_timeout __read_mostly = 600*HZ;
 
+static bool nf_generic_should_process(u8 proto)
+{
+   switch (proto) {
+#ifdef CONFIG_NF_CT_PROTO_SCTP_MODULE
+   case IPPROTO_SCTP:
+   return false;
+#endif
+#ifdef CONFIG_NF_CT_PROTO_DCCP_MODULE
+   case IPPROTO_DCCP:
+   return false;
+#endif
+#ifdef CONFIG_NF_CT_PROTO_GRE_MODULE
+   case IPPROTO_GRE:
+   return false;
+#endif
+#ifdef CONFIG_NF_CT_PROTO_UDPLITE_MODULE
+   case IPPROTO_UDPLITE:
+   return false;
+#endif
+   default:
+   return true;
+   }
+}
+
 static inline struct nf_generic_net *generic_pernet(struct net *net)
 {
return net-ct.nf_ct_proto.generic;
@@ -67,7 +91,7 @@ static int generic_packet(struct nf_conn
 static bool generic_new(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff, unsigned int *timeouts)
 {
-   return true;
+   return nf_generic_should_process(nf_ct_protonum(ct));
 }
 
 #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 24/31] KVM: x86: SYSENTER emulation is broken

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Nadav Amit na...@cs.technion.ac.il

commit f3747379accba8e95d70cec0eae0582c8c182050 upstream.

SYSENTER emulation is broken in several ways:
1. It misses the case of 16-bit code segments completely (CVE-2015-0239).
2. MSR_IA32_SYSENTER_CS is checked in 64-bit mode incorrectly (bits 0 and 1 can
   still be set without causing #GP).
3. MSR_IA32_SYSENTER_EIP and MSR_IA32_SYSENTER_ESP are not masked in
   legacy-mode.
4. There is some unneeded code.

Fix it.

Signed-off-by: Nadav Amit na...@cs.technion.ac.il
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
[zhangzhiqiang: backport to 3.10:
 - adjust context
 - in 3.10 context ctxt-eflags = ~(EFLG_VM | EFLG_IF | EFLG_RF) is replaced 
by
   ctxt-eflags = ~(EFLG_VM | EFLG_IF) in upstream, which was changed by 
another commit.
 - After the above adjustments, becomes same to the original patch:
   
https://github.com/torvalds/linux/commit/f3747379accba8e95d70cec0eae0582c8c182050
]
Signed-off-by: Zhiqiang Zhang zhangzhiqiang.zh...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/x86/kvm/emulate.c |   27 ---
 1 file changed, 8 insertions(+), 19 deletions(-)

--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2450,7 +2450,7 @@ static int em_sysenter(struct x86_emulat
 * Not recognized on AMD in compat mode (but is recognized in legacy
 * mode).
 */
-   if ((ctxt-mode == X86EMUL_MODE_PROT32)  (efer  EFER_LMA)
+   if ((ctxt-mode != X86EMUL_MODE_PROT64)  (efer  EFER_LMA)
 !vendor_intel(ctxt))
return emulate_ud(ctxt);
 
@@ -2463,25 +2463,13 @@ static int em_sysenter(struct x86_emulat
setup_syscalls_segments(ctxt, cs, ss);
 
ops-get_msr(ctxt, MSR_IA32_SYSENTER_CS, msr_data);
-   switch (ctxt-mode) {
-   case X86EMUL_MODE_PROT32:
-   if ((msr_data  0xfffc) == 0x0)
-   return emulate_gp(ctxt, 0);
-   break;
-   case X86EMUL_MODE_PROT64:
-   if (msr_data == 0x0)
-   return emulate_gp(ctxt, 0);
-   break;
-   default:
-   break;
-   }
+   if ((msr_data  0xfffc) == 0x0)
+   return emulate_gp(ctxt, 0);
 
ctxt-eflags = ~(EFLG_VM | EFLG_IF | EFLG_RF);
-   cs_sel = (u16)msr_data;
-   cs_sel = ~SELECTOR_RPL_MASK;
+   cs_sel = (u16)msr_data  ~SELECTOR_RPL_MASK;
ss_sel = cs_sel + 8;
-   ss_sel = ~SELECTOR_RPL_MASK;
-   if (ctxt-mode == X86EMUL_MODE_PROT64 || (efer  EFER_LMA)) {
+   if (efer  EFER_LMA) {
cs.d = 0;
cs.l = 1;
}
@@ -2490,10 +2478,11 @@ static int em_sysenter(struct x86_emulat
ops-set_segment(ctxt, ss_sel, ss, 0, VCPU_SREG_SS);
 
ops-get_msr(ctxt, MSR_IA32_SYSENTER_EIP, msr_data);
-   ctxt-_eip = msr_data;
+   ctxt-_eip = (efer  EFER_LMA) ? msr_data : (u32)msr_data;
 
ops-get_msr(ctxt, MSR_IA32_SYSENTER_ESP, msr_data);
-   *reg_write(ctxt, VCPU_REGS_RSP) = msr_data;
+   *reg_write(ctxt, VCPU_REGS_RSP) = (efer  EFER_LMA) ? msr_data :
+ (u32)msr_data;
 
return X86EMUL_CONTINUE;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 15/31] jfs: fix readdir regression

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Dave Kleikamp dave.kleik...@oracle.com

Upstream commit 44512449, jfs: fix readdir cookie incompatibility
with NFSv4, was backported incorrectly into the stable trees which
used the filldir callback (rather than dir_emit). The position is
being incorrectly passed to filldir for the . and .. entries.

The still-maintained stable trees that need to be fixed are 3.2.y,
3.4.y and 3.10.y.

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

Signed-off-by: Dave Kleikamp dave.kleik...@oracle.com
Cc: jfs-discuss...@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 fs/jfs/jfs_dtree.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3103,7 +3103,7 @@ int jfs_readdir(struct file *filp, void
 * self .
 */
filp-f_pos = 1;
-   if (filldir(dirent, ., 1, 0, ip-i_ino,
+   if (filldir(dirent, ., 1, 1, ip-i_ino,
DT_DIR))
return 0;
}
@@ -3111,7 +3111,7 @@ int jfs_readdir(struct file *filp, void
 * parent ..
 */
filp-f_pos = 2;
-   if (filldir(dirent, .., 2, 1, PARENT(ip), DT_DIR))
+   if (filldir(dirent, .., 2, 2, PARENT(ip), DT_DIR))
return 0;
 
/*


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 17/31] mm: Fix NULL pointer dereference in madvise(MADV_WILLNEED) support

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Kirill A. Shutemov kirill.shute...@linux.intel.com

commit ee53664bda169f519ce3c6a22d378f0b946c8178 upstream.

Sasha Levin found a NULL pointer dereference that is due to a missing
page table lock, which in turn is due to the pmd entry in question being
a transparent huge-table entry.

The code - introduced in commit 1998cc048901 (mm: make
madvise(MADV_WILLNEED) support swap file prefetch) - correctly checks
for this situation using pmd_none_or_trans_huge_or_clear_bad(), but it
turns out that that function doesn't work correctly.

pmd_none_or_trans_huge_or_clear_bad() expected that pmd_bad() would
trigger if the transparent hugepage bit was set, but it doesn't do that
if pmd_numa() is also set. Note that the NUMA bit only gets set on real
NUMA machines, so people trying to reproduce this on most normal
development systems would never actually trigger this.

Fix it by removing the very subtle (and subtly incorrect) expectation,
and instead just checking pmd_trans_huge() explicitly.

Reported-by: Sasha Levin sasha.le...@oracle.com
Acked-by: Andrea Arcangeli aarca...@redhat.com
[ Additionally remove the now stale test for pmd_trans_huge() inside the
  pmd_bad() case - Linus ]
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Cc: Wang Long long.wangl...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 include/asm-generic/pgtable.h |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -550,11 +550,10 @@ static inline int pmd_none_or_trans_huge
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
barrier();
 #endif
-   if (pmd_none(pmdval))
+   if (pmd_none(pmdval) || pmd_trans_huge(pmdval))
return 1;
if (unlikely(pmd_bad(pmdval))) {
-   if (!pmd_trans_huge(pmdval))
-   pmd_clear_bad(pmd);
+   pmd_clear_bad(pmd);
return 1;
}
return 0;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 13/31] benet: Call dev_kfree_skby_any instead of kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/emulex/benet/be_main.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1767,7 +1767,7 @@ static u16 be_tx_compl_process(struct be
queue_tail_inc(txq);
} while (cur_index != last_index);
 
-   kfree_skb(sent_skb);
+   dev_kfree_skb_any(sent_skb);
return num_wrbs;
 }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 16/31] splice: Apply generic position and size checks to each write

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Ben Hutchings b...@decadent.org.uk

commit 894c6350eaad7e613ae267504014a456e00a3e2a from the 3.2-stable branch.

We need to check the position and size of file writes against various
limits, using generic_write_check().  This was not being done for
the splice write path.  It was fixed upstream by commit 8d0207652cbe
(-splice_write() via -write_iter()) but we can't apply that.

CVE-2014-7822

Signed-off-by: Ben Hutchings b...@decadent.org.uk
[Ben fixed it in 3.2 stable, i ported it to 3.10 stable]
Signed-off-by: Zhang Zhen zhenzhang.zh...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/ocfs2/file.c |8 +---
 fs/splice.c |8 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)

--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2459,12 +2459,14 @@ static ssize_t ocfs2_file_splice_write(s
struct address_space *mapping = out-f_mapping;
struct inode *inode = mapping-host;
struct splice_desc sd = {
-   .total_len = len,
.flags = flags,
-   .pos = *ppos,
.u.file = out,
};
-
+   ret = generic_write_checks(out, ppos, len, 0);
+   if(ret)
+   return ret;
+   sd.total_len = len;
+   sd.pos = *ppos;
 
trace_ocfs2_file_splice_write(inode, out, out-f_path.dentry,
(unsigned long long)OCFS2_I(inode)-ip_blkno,
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1012,13 +1012,17 @@ generic_file_splice_write(struct pipe_in
struct address_space *mapping = out-f_mapping;
struct inode *inode = mapping-host;
struct splice_desc sd = {
-   .total_len = len,
.flags = flags,
-   .pos = *ppos,
.u.file = out,
};
ssize_t ret;
 
+   ret = generic_write_checks(out, ppos, len, S_ISBLK(inode-i_mode));
+   if (ret)
+   return ret;
+   sd.total_len = len;
+   sd.pos = *ppos;
+
pipe_lock(pipe);
 
splice_from_pipe_begin(sd);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 12/31] ixgb: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1527,12 +1527,12 @@ ixgb_xmit_frame(struct sk_buff *skb, str
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;
}
 
@@ -1549,7 +1549,7 @@ ixgb_xmit_frame(struct sk_buff *skb, str
 
tso = ixgb_tso(adapter, skb);
if (tso  0) {
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 11/31] tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/broadcom/tg3.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6437,7 +6437,7 @@ static void tg3_tx(struct tg3_napi *tnap
pkts_compl++;
bytes_compl += skb-len;
 
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 
if (unlikely(tx_bug)) {
tg3_tx_recover(tp);
@@ -6769,7 +6769,7 @@ static int tg3_rx(struct tg3_napi *tnapi
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;
}
 
@@ -7652,7 +7652,7 @@ static int tigon3_dma_hwbug_workaround(s
  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;
@@ -7667,13 +7667,13 @@ static int tigon3_dma_hwbug_workaround(s
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;
 }
@@ -7716,7 +7716,7 @@ static int tg3_tso_bug(struct tg3 *tp, s
} while (segs);
 
 tg3_tso_bug_end:
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 
return NETDEV_TX_OK;
 }
@@ -7954,7 +7954,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;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 09/42] r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/realtek/r8169.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5834,7 +5834,7 @@ static void rtl8169_tx_clear_range(struc
 tp-TxDescArray + entry);
if (skb) {
tp-dev-stats.tx_dropped++;
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
tx_skb-skb = NULL;
}
}
@@ -6059,7 +6059,7 @@ static netdev_tx_t rtl8169_start_xmit(st
 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;
@@ -6142,7 +6142,7 @@ static void rtl_tx(struct net_device *de
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++;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 28/42] Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Dmitry Tunin hanipouspi...@gmail.com

commit 3bb30a7cdf9242aca90d49aa41baebf9458f96f0 upstream.

Add support for Bluetooth MCI WB335 (AR9565) Wi-Fi+bt module. This
Bluetooth module requires loading patch and sysconfig by ath3k driver.

T:  Bus=01 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 20 Spd=12   MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=13d3 ProdID=3408 Rev= 0.02
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms

Signed-off-by: Dmitry Tunin hanipouspi...@gmail.com
Signed-off-by: Johan Hedberg johan.hedb...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -105,6 +105,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x13d3, 0x3375) },
{ USB_DEVICE(0x13d3, 0x3393) },
{ USB_DEVICE(0x13d3, 0x3402) },
+   { USB_DEVICE(0x13d3, 0x3408) },
{ USB_DEVICE(0x13d3, 0x3432) },
 
/* Atheros AR5BBU12 with sflash firmware */
@@ -157,6 +158,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU22 with sflash firmware */
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -183,6 +183,7 @@ static const struct usb_device_id blackl
{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
/* Atheros AR5BBU12 with sflash firmware */


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 10/42] bonding: Call dev_kfree_skby_any instead of kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 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(-)

--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2479,7 +2479,7 @@ out:
return NETDEV_TX_OK;
 err_free:
/* no suitable interface, frame not sent */
-   kfree_skb(skb);
+   dev_kfree_skb_any(skb);
goto out;
 }
 
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1479,7 +1479,7 @@ int bond_alb_xmit(struct sk_buff *skb, s
}
 
/* no suitable interface, frame not sent */
-   kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 out:
return NETDEV_TX_OK;
 }
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3568,7 +3568,7 @@ static void bond_xmit_slave_id(struct bo
}
}
/* no slave that can tx has been found */
-   kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 }
 
 /**
@@ -3650,7 +3650,7 @@ static int bond_xmit_activebackup(struct
if (slave)
bond_dev_queue_xmit(bond, skb, slave-dev);
else
-   kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 
return NETDEV_TX_OK;
 }
@@ -3698,7 +3698,7 @@ static int bond_xmit_broadcast(struct sk
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;
 }
@@ -3785,7 +3785,7 @@ static netdev_tx_t __bond_start_xmit(str
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;
}
 }
@@ -3806,7 +3806,7 @@ static netdev_tx_t bond_start_xmit(struc
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;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 05/42] ipv6: protect skb-sk accesses from recursive dereference inside the stack

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: han...@stressinduktion.org han...@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 j...@resnulli.us
Signed-off-by: Hannes Frederic Sowa han...@stressinduktion.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 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(-)

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1880,6 +1880,12 @@ void netdev_freemem(struct net_device *d
 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);
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -407,22 +407,6 @@ static __inline__ void inet_reset_saddr(
 
 #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);
 
 /*
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -168,7 +168,8 @@ int ip6_fragment(struct sk_buff *skb, in
 
 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));
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1815,6 +1815,8 @@ struct dst_entry *__sk_dst_check(struct
 
 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);
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2775,7 +2775,9 @@ static void skb_update_prio(struct sk_bu
 #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
 
 /**
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -659,6 +659,25 @@ static inline void sock_valbool_flag(str
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.
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -555,7 +555,8 @@ int ip6_fragment(struct sk_buff *skb, in
 {
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;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the 

[PATCH 3.14 08/42] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/realtek/8139too.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- 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 (s
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;
}


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 22/42] Bluetooth: Add support for Intel bootloader devices

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Marcel Holtmann mar...@holtmann.org

commit 40df783d1ef1989ac454e3dfcda017270b8950e6 upstream.

Intel Bluetooth devices that boot up in bootloader mode can not
be used as generic HCI devices, but their HCI transport is still
valuable and so bring that up as raw-only devices.

T:  Bus=02 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 14 Spd=12   MxCh= 0
D:  Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=8087 ProdID=0a5a Rev= 0.00
S:  Manufacturer=Intel(R) Corporation
S:  Product=Intel(R) Wilkins Peak 2x2
S:  SerialNumber=001122334455 WP_A0
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms

Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Johan Hedberg johan.hedb...@intel.com
[bwh: Backported to 3.14: adjust context]
Signed-off-by: Johan Hedberg johan.hedb...@intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/bluetooth/btusb.c |7 +++
 1 file changed, 7 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -49,6 +49,7 @@ static struct usb_driver btusb_driver;
 #define BTUSB_WRONG_SCO_MTU0x40
 #define BTUSB_ATH3012  0x80
 #define BTUSB_INTEL0x100
+#define BTUSB_INTEL_BOOT   0x200
 
 static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
@@ -119,6 +120,9 @@ static const struct usb_device_id btusb_
/* IMC Networks - Broadcom based */
{ USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) },
 
+   /* Intel Bluetooth USB Bootloader (RAM module) */
+   { USB_DEVICE(0x8087, 0x0a5a), .driver_info = BTUSB_INTEL_BOOT },
+
{ } /* Terminating entry */
 };
 
@@ -1497,6 +1501,9 @@ static int btusb_probe(struct usb_interf
if (id-driver_info  BTUSB_INTEL)
hdev-setup = btusb_setup_intel;
 
+   if (id-driver_info  BTUSB_INTEL_BOOT)
+   set_bit(HCI_QUIRK_RAW_DEVICE, hdev-quirks);
+
/* Interface numbers are hardcoded in the specification */
data-isoc = usb_ifnum_to_if(data-udev, 1);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 33/42] move d_rcu from overlapping d_child to overlapping d_alias

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Al Viro v...@zeniv.linux.org.uk

commit 946e51f2bf37f1656916eb75bd0742ba33983c28 upstream.

move d_rcu from overlapping d_child to overlapping d_alias

Signed-off-by: Al Viro v...@zeniv.linux.org.uk
Cc: Ben Hutchings b...@decadent.org.uk
[hujianyang: Backported to 3.14 refer to the work of Ben Hutchings in 3.2:
 - Apply name changes in all the different places we use d_alias and d_child
 - Move the WARN_ON() in __d_free() to d_free() as we don't have dentry_free()]
Signed-off-by: hujianyang hujiany...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/powerpc/platforms/cell/spufs/inode.c   |2 
 drivers/staging/lustre/lustre/llite/dcache.c|2 
 drivers/staging/lustre/lustre/llite/llite_lib.c |2 
 drivers/staging/lustre/lustre/llite/namei.c |8 +--
 fs/affs/amigaffs.c  |2 
 fs/autofs4/expire.c |   12 ++--
 fs/autofs4/root.c   |2 
 fs/ceph/dir.c   |8 +--
 fs/ceph/inode.c |2 
 fs/cifs/inode.c |2 
 fs/coda/cache.c |2 
 fs/dcache.c |   58 
 fs/debugfs/inode.c  |2 
 fs/exportfs/expfs.c |2 
 fs/libfs.c  |   12 ++--
 fs/ncpfs/dir.c  |2 
 fs/ncpfs/ncplib_kernel.h|4 -
 fs/nfs/getroot.c|2 
 fs/notify/fsnotify.c|4 -
 fs/ocfs2/dcache.c   |2 
 include/linux/dcache.h  |8 +--
 kernel/cgroup.c |2 
 kernel/trace/trace.c|4 -
 kernel/trace/trace_events.c |2 
 security/selinux/selinuxfs.c|6 +-
 25 files changed, 77 insertions(+), 77 deletions(-)

--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentr
struct dentry *dentry, *tmp;
 
mutex_lock(dir-d_inode-i_mutex);
-   list_for_each_entry_safe(dentry, tmp, dir-d_subdirs, d_u.d_child) {
+   list_for_each_entry_safe(dentry, tmp, dir-d_subdirs, d_child) {
spin_lock(dentry-d_lock);
if (!(d_unhashed(dentry))  dentry-d_inode) {
dget_dlock(dentry);
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -278,7 +278,7 @@ void ll_invalidate_aliases(struct inode
   inode-i_ino, inode-i_generation, inode);
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(dentry, p, inode-i_dentry, d_alias) {
+   ll_d_hlist_for_each_entry(dentry, p, inode-i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, dentry in drop %.*s (%p) parent %p 
   inode %p flags %d\n, dentry-d_name.len,
   dentry-d_name.name, dentry, dentry-d_parent,
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -678,7 +678,7 @@ void lustre_dump_dentry(struct dentry *d
return;
 
list_for_each(tmp, dentry-d_subdirs) {
-   struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child);
+   struct dentry *d = list_entry(tmp, struct dentry, d_child);
lustre_dump_dentry(d, recur - 1);
}
 }
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -175,14 +175,14 @@ static void ll_invalidate_negative_child
struct ll_d_hlist_node *p;
 
ll_lock_dcache(dir);
-   ll_d_hlist_for_each_entry(dentry, p, dir-i_dentry, d_alias) {
+   ll_d_hlist_for_each_entry(dentry, p, dir-i_dentry, d_u.d_alias) {
spin_lock(dentry-d_lock);
if (!list_empty(dentry-d_subdirs)) {
struct dentry *child;
 
list_for_each_entry_safe(child, tmp_subdir,
 dentry-d_subdirs,
-d_u.d_child) {
+d_child) {
if (child-d_inode == NULL)
d_lustre_invalidate(child, 1);
}
@@ -364,7 +364,7 @@ static struct dentry *ll_find_alias(stru
discon_alias = invalid_alias = NULL;
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(alias, p, inode-i_dentry, d_alias) {
+   ll_d_hlist_for_each_entry(alias, p, 

[PATCH 0/6] ARM: berlin: relicense the device trees under GPLv2/X11

2015-04-26 Thread Antoine Tenart
Hi,

The GPLv2 license makes it impractical for other software components
licensed under another license to use our device trees. To fix this,
and make our device tree usable by other software components, relicense
them under a GPLv2/X11 dual-license.

In order to get this accepted, we *need* all contributors to the Berlin
device tree files to ack-by the patches applying on a file they
contributed on. A list of needed ack-by by device tree is shown below:

 * berlin2q.dtsi:
Antoine Tenart antoine.ten...@free-electrons.com
Jisheng Zhang jszh...@marvell.com
Alexandre Belloni alexandre.bell...@free-electrons.com
Sebastian Hesselbarth sebastian.hesselba...@gmail.com

 * berlin2q-marvell-dmp.dtsi:
Antoine Tenart antoine.ten...@free-electrons.com
Jisheng Zhang jszh...@marvell.com

 * berlin2.dtsi:
Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Antoine Tenart antoine.ten...@free-electrons.com
Jisheng Zhang jszh...@marvell.com

 * berlin2-sony-nsz-gs7.dts:
Sebastian Hesselbarth sebastian.hesselba...@gmail.com

 * berlin2cd.dtsi:
Sebastian Hesselbarth sebastian.hesselba...@gmail.com
Antoine Tenart antoine.ten...@free-electrons.com
Jisheng Zhang jszh...@marvell.com

 * berlin2cd-google-chromecast.dts:
Sebastian Hesselbarth sebastian.hesselba...@gmail.com

Thanks!

Antoine

Antoine Tenart (6):
  ARM: dts: berlin: relicense the berlin2q dtsi under GPLv2/X11
  ARM: dts: berlin: relicense the BG2Q Marvell DMP dts under GPLv2/X11
  ARM: dts: berlin: relicense the berlin2 dtsi under GPLv2/X11
  ARM: dts: berlin: relicense the BG2 Sony NSZ-GS7 dts under GPLv2/X11
  ARM: dts: berlin: relicense the berlin2cd dtsi under GPLv2/X11
  ARM: dts: berlin: relicense the BG2CD Google Chromecast dts under
GPLv2/X11

 arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts| 34 +--
 arch/arm/boot/dts/berlin2.dtsi| 34 +--
 arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 34 +--
 arch/arm/boot/dts/berlin2cd.dtsi  | 34 +--
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts| 34 +--
 arch/arm/boot/dts/berlin2q.dtsi   | 34 +--
 6 files changed, 186 insertions(+), 18 deletions(-)

-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 36/42] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 9c145c56d0c8a0b62e48c8d71e055ad0fb2012ba upstream.

The stack guard page error case has long incorrectly caused a SIGBUS
rather than a SIGSEGV, but nobody actually noticed until commit
fee7e49d4514 (mm: propagate error from stack expansion even for guard
page) because that error case was never actually triggered in any
normal situations.

Now that we actually report the error, people noticed the wrong signal
that resulted.  So far, only the test suite of libsigsegv seems to have
actually cared, but there are real applications that use libsigsegv, so
let's not wait for any of those to break.

Reported-and-tested-by: Takashi Iwai ti...@suse.de
Tested-by: Jan Engelhardt jeng...@inai.de
Acked-by: Heiko Carstens heiko.carst...@de.ibm.com # s390 still compiles and 
boots
Cc: linux-a...@vger.kernel.org
Cc: sta...@vger.kernel.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 mm/memory.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3236,7 +3236,7 @@ static int do_anonymous_page(struct mm_s
 
/* Check if we need to add a guard page to the stack */
if (check_stack_guard_page(vma, address)  0)
-   return VM_FAULT_SIGBUS;
+   return VM_FAULT_SIGSEGV;
 
/* Use the zero-page for reads */
if (!(flags  FAULT_FLAG_WRITE)) {


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 37/42] ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Steven Capper steve.cap...@linaro.org

commit f2950706871c4b6e8c0f0d7c3f62d35930b8de63 upstream.

Long descriptors on ARM are 64 bits, and some pte functions such as
pte_dirty return a bitwise-and of a flag with the pte value. If the
flag to be tested resides in the upper 32 bits of the pte, then we run
into the danger of the result being dropped if downcast.

For example:
gather_stats(page, md, pte_dirty(*pte), 1);
where pte_dirty(*pte) is downcast to an int.

This patch introduces a new macro pte_isset which performs the bitwise
and, then performs a double logical invert (where needed) to ensure
predictable downcasting. The logical inverse pte_isclear is also
introduced.

Equivalent pmd functions for Transparent HugePages have also been
added.

Signed-off-by: Steve Capper steve.cap...@linaro.org
Reviewed-by: Will Deacon will.dea...@arm.com
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
[hpy: Backported to 3.14
 - adjust the context ]
Signed-off-by: Hou Pengyang houpengy...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/arm/include/asm/pgtable-3level.h |   12 
 arch/arm/include/asm/pgtable.h|   14 +-
 2 files changed, 17 insertions(+), 9 deletions(-)

--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -207,17 +207,21 @@ static inline pmd_t *pmd_offset(pud_t *p
 #define pte_huge(pte)  (pte_val(pte)  !(pte_val(pte)  
PTE_TABLE_BIT))
 #define pte_mkhuge(pte)(__pte(pte_val(pte)  ~PTE_TABLE_BIT))
 
-#define pmd_young(pmd) (pmd_val(pmd)  PMD_SECT_AF)
+#define pmd_isset(pmd, val)((u32)(val) == (val) ? pmd_val(pmd)  (val) \
+   : !!(pmd_val(pmd)  (val)))
+#define pmd_isclear(pmd, val)  (!(pmd_val(pmd)  (val)))
+
+#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
 
 #define __HAVE_ARCH_PMD_WRITE
-#define pmd_write(pmd) (!(pmd_val(pmd)  PMD_SECT_RDONLY))
+#define pmd_write(pmd) (pmd_isclear((pmd), PMD_SECT_RDONLY))
 
 #define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd))
 #define pmd_thp_or_huge(pmd)   (pmd_huge(pmd) || pmd_trans_huge(pmd))
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-#define pmd_trans_huge(pmd)(pmd_val(pmd)  !(pmd_val(pmd)  
PMD_TABLE_BIT))
-#define pmd_trans_splitting(pmd) (pmd_val(pmd)  PMD_SECT_SPLITTING)
+#define pmd_trans_huge(pmd)(pmd_val(pmd)  !pmd_table(pmd))
+#define pmd_trans_splitting(pmd) (pmd_isset((pmd), PMD_SECT_SPLITTING))
 #endif
 
 #define PMD_BIT_FUNC(fn,op) \
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -214,12 +214,16 @@ static inline pte_t *pmd_page_vaddr(pmd_
 
 #define pte_clear(mm,addr,ptep)set_pte_ext(ptep, __pte(0), 0)
 
+#define pte_isset(pte, val)((u32)(val) == (val) ? pte_val(pte)  (val) \
+   : !!(pte_val(pte)  (val)))
+#define pte_isclear(pte, val)  (!(pte_val(pte)  (val)))
+
 #define pte_none(pte)  (!pte_val(pte))
-#define pte_present(pte)   (pte_val(pte)  L_PTE_PRESENT)
-#define pte_write(pte) (!(pte_val(pte)  L_PTE_RDONLY))
-#define pte_dirty(pte) (pte_val(pte)  L_PTE_DIRTY)
-#define pte_young(pte) (pte_val(pte)  L_PTE_YOUNG)
-#define pte_exec(pte)  (!(pte_val(pte)  L_PTE_XN))
+#define pte_present(pte)   (pte_isset((pte), L_PTE_PRESENT))
+#define pte_write(pte) (pte_isclear((pte), L_PTE_RDONLY))
+#define pte_dirty(pte) (pte_isset((pte), L_PTE_DIRTY))
+#define pte_young(pte) (pte_isset((pte), L_PTE_YOUNG))
+#define pte_exec(pte)  (pte_isclear((pte), L_PTE_XN))
 #define pte_special(pte)   (0)
 
 #define pte_present_user(pte)  (pte_present(pte)  (pte_val(pte)  
L_PTE_USER))


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 35/42] vm: add VM_FAULT_SIGSEGV handling support

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 33692f27597fcab536d7cbbcc8f52905133e4aa7 upstream.

The core VM already knows about VM_FAULT_SIGBUS, but cannot return a
you should SIGSEGV error, because the SIGSEGV case was generally
handled by the caller - usually the architecture fault handler.

That results in lots of duplication - all the architecture fault
handlers end up doing very similar look up vma, check permissions, do
retries etc - but it generally works.  However, there are cases where
the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV.

In particular, when accessing the stack guard page, libsigsegv expects a
SIGSEGV.  And it usually got one, because the stack growth is handled by
that duplicated architecture fault handler.

However, when the generic VM layer started propagating the error return
from the stack expansion in commit fee7e49d4514 (mm: propagate error
from stack expansion even for guard page), that now exposed the
existing VM_FAULT_SIGBUS result to user space.  And user space really
expected SIGSEGV, not SIGBUS.

To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those
duplicate architecture fault handlers about it.  They all already have
the code to handle SIGSEGV, so it's about just tying that new return
value to the existing code, but it's all a bit annoying.

This is the mindless minimal patch to do this.  A more extensive patch
would be to try to gather up the mostly shared fault handling logic into
one generic helper routine, and long-term we really should do that
cleanup.

Just from this patch, you can generally see that most architectures just
copied (directly or indirectly) the old x86 way of doing things, but in
the meantime that original x86 model has been improved to hold the VM
semaphore for shorter times etc and to handle VM_FAULT_RETRY and other
newer things, so it would be a good idea to bring all those
improvements to the generic case and teach other architectures about
them too.

Reported-and-tested-by: Takashi Iwai ti...@suse.de
Tested-by: Jan Engelhardt jeng...@inai.de
Acked-by: Heiko Carstens heiko.carst...@de.ibm.com # s390 still compiles and 
boots
Cc: linux-a...@vger.kernel.org
Cc: sta...@vger.kernel.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
[shengyong: Backport to 3.14
 - adjust context
 - ignore modification for arch nios2, because 3.14 does not support it
 - add SIGSEGV handling to powerpc/cell spu_fault.c, because 3.14 does not
   separate it to copro_fault.c
 - add SIGSEGV handling to mm/memory.c, because 3.14 does not separate it
   to gup.c
]
Signed-off-by: Sheng Yong shengyo...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/alpha/mm/fault.c|2 ++
 arch/arc/mm/fault.c  |2 ++
 arch/avr32/mm/fault.c|2 ++
 arch/cris/mm/fault.c |2 ++
 arch/frv/mm/fault.c  |2 ++
 arch/ia64/mm/fault.c |2 ++
 arch/m32r/mm/fault.c |2 ++
 arch/m68k/mm/fault.c |2 ++
 arch/metag/mm/fault.c|2 ++
 arch/microblaze/mm/fault.c   |2 ++
 arch/mips/mm/fault.c |2 ++
 arch/mn10300/mm/fault.c  |2 ++
 arch/openrisc/mm/fault.c |2 ++
 arch/parisc/mm/fault.c   |2 ++
 arch/powerpc/mm/fault.c  |2 ++
 arch/powerpc/platforms/cell/spu_fault.c  |2 +-
 arch/s390/mm/fault.c |6 ++
 arch/score/mm/fault.c|2 ++
 arch/sh/mm/fault.c   |2 ++
 arch/sparc/mm/fault_32.c |2 ++
 arch/sparc/mm/fault_64.c |2 ++
 arch/tile/mm/fault.c |2 ++
 arch/um/kernel/trap.c|2 ++
 arch/x86/mm/fault.c  |2 ++
 arch/xtensa/mm/fault.c   |2 ++
 drivers/staging/lustre/lustre/llite/vvp_io.c |2 +-
 include/linux/mm.h   |6 --
 mm/ksm.c |2 +-
 mm/memory.c  |5 +++--
 29 files changed, 62 insertions(+), 7 deletions(-)

--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -156,6 +156,8 @@ retry:
if (unlikely(fault  VM_FAULT_ERROR)) {
if (fault  VM_FAULT_OOM)
goto out_of_memory;
+   else if (fault  VM_FAULT_SIGSEGV)
+   goto bad_area;
else if (fault  VM_FAULT_SIGBUS)
goto do_sigbus;
BUG();
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -162,6 +162,8 @@ 

[PATCH 6/6] ARM: dts: berlin: relicense the BG2CD Google Chromecast dts under GPLv2/X11

2015-04-26 Thread Antoine Tenart
The current GPLv2 only licensing on this dts makes it very impractical
for other software components licensed under another license.

In order to make it easier for them to reuse our device trees, relicense
this dts under a GPLv2/X11 dual-license.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 34 +--
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts 
b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
index 30270be4d0c9..772165ad0a52 100644
--- a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
+++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
@@ -3,9 +3,37 @@
  *
  * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
  *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed as is without any
- * warranty of any kind, whether express or implied.
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 34/42] sched: declare pid_alive as inline

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Richard Guy Briggs r...@redhat.com

commit 80e0b6e8a001361316a2d62b748fe677ec46b860 upstream.

We accidentally declared pid_alive without any extern/inline connotation.
Some platforms were fine with this, some like ia64 and mips were very angry.
If the function is inline, the prototype should be inline!

on ia64:
include/linux/sched.h:1718: warning: 'pid_alive' declared inline after
being called

Signed-off-by: Richard Guy Briggs r...@redhat.com
Signed-off-by: Eric Paris epa...@redhat.com
Signed-off-by: hujianyang hujiany...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 include/linux/sched.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1695,7 +1695,7 @@ static inline pid_t task_tgid_vnr(struct
 }
 
 
-static int pid_alive(const struct task_struct *p);
+static inline int pid_alive(const struct task_struct *p);
 static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct 
pid_namespace *ns)
 {
pid_t pid = 0;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] ARM: dts: berlin: relicense the BG2 Sony NSZ-GS7 dts under GPLv2/X11

2015-04-26 Thread Antoine Tenart
The current GPLv2 only licensing on this dts makes it very impractical
for other software components licensed under another license.

In order to make it easier for them to reuse our device trees, relicense
this dts under a GPLv2/X11 dual-license.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts 
b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
index 86d85d8896a3..5c99fb3a4d10 100644
--- a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
+++ b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
@@ -3,9 +3,37 @@
  *
  * Sebastian Hesselbarth sebastian.hesselba...@gmail.com
  *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed as is without any
- * warranty of any kind, whether express or implied.
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] ARM: dts: berlin: relicense the berlin2 dtsi under GPLv2/X11

2015-04-26 Thread Antoine Tenart
The current GPLv2 only licensing on this dtsi makes it very impractical
for other software components licensed under another license.

In order to make it easier for them to reuse our device trees, relicense
this dtsi under a GPLv2/X11 dual-license.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 arch/arm/boot/dts/berlin2.dtsi | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
index 63d00a63cfa6..da9adf8f69da 100644
--- a/arch/arm/boot/dts/berlin2.dtsi
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -6,9 +6,37 @@
  * based on GPL'ed 2.6 kernel sources
  *  (c) Marvell International Ltd.
  *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed as is without any
- * warranty of any kind, whether express or implied.
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include skeleton.dtsi
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] ARM: dts: berlin: relicense the berlin2q dtsi under GPLv2/X11

2015-04-26 Thread Antoine Tenart
The current GPLv2 only licensing on this dtsi makes it very impractical
for other software components licensed under another license.

In order to make it easier for them to reuse our device trees, relicense
this dtsi under a GPLv2/X11 dual-license.

Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com
---
 arch/arm/boot/dts/berlin2q.dtsi | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index be5397288d24..703ce384e0d7 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -1,9 +1,37 @@
 /*
  * Copyright (C) 2014 Antoine Ténart antoine.ten...@free-electrons.com
  *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed as is without any
- * warranty of any kind, whether express or implied.
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include dt-bindings/clock/berlin2q.h
-- 
2.3.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 10/27] tcp: fix FRTO undo on cumulative ACK of SACKed range

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Neal Cardwell ncardw...@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 ncardw...@google.com
Signed-off-by: Yuchung Cheng ych...@google.com
Fixes: e33099f96d99c (tcp: implement RFC5682 F-RTO)
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_input.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3104,10 +3104,11 @@ static int tcp_clean_rtx_queue(struct so
if (!first_ackt.v64)
first_ackt = last_ackt;
 
-   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)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: loop block-mq conversion scalability issues

2015-04-26 Thread Ming Lei
Hi Justin,

On Fri, 24 Apr 2015 16:46:02 -0500
Justin M. Forbes jfor...@fedoraproject.org wrote:

 On Fri, 2015-04-24 at 10:59 +0800, Ming Lei wrote:
  Hi Justin,
  
  Thanks for the report.
  
  On Thu, 23 Apr 2015 16:04:10 -0500
  Justin M. Forbes jfor...@redhat.com wrote:
  
   The block-mq conversion for loop in 4.0 kernels is showing us an
   interesting scalability problem with live CDs (ro, squashfs).  It was
   noticed when testing the Fedora beta that the more CPUs a liveCD image
   was given, the slower it would boot. A 4 core qemu instance or bare
   metal instance took more than twice as long to boot compared to a single
   CPU instance.  After investigating, this came directly to the block-mq
   conversion, reverting these 4 patches will return performance. More
   details are available at
   https://bugzilla.redhat.com/show_bug.cgi?id=1210857
   I don't think that reverting the patches is the ideal solution so I am
   looking for other options.  Since you know this code a bit better than I
   do I thought I would run it by you while I am looking as well.
  
  I can understand the issue because the default @max_active for
  alloc_workqueue() is quite big(512), which may cause too much
  context switchs, then loop I/O performance gets decreased.
  
  Actually I have written the kernel dio/aio based patch for decreasing
  both CPU and memory utilization without sacrificing I/O performance,
  and I will try to improve and push the patch during this cycle and hope
  it can be merged(kernel/aio.c change is dropped, and only fs change is
  needed on fs/direct-io.c).
  
  But the following change should help for your case, could you test it?
  
  ---
  diff --git a/drivers/block/loop.c b/drivers/block/loop.c
  index c6b3726..b1cb41d 100644
  --- a/drivers/block/loop.c
  +++ b/drivers/block/loop.c
  @@ -1831,7 +1831,7 @@ static int __init loop_init(void)
  }
   
  loop_wq = alloc_workqueue(kloopd,
  -   WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0);
  +   WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 32);
  if (!loop_wq) {
  err = -ENOMEM;
  goto misc_out;
  
 Patch tested, it made things work (I gave up after 5 minutes and boot
 still seemed hung). I also tried values of 1, 16, 64, and 128).
 Everything below 128 was much worse than the current situation. Setting
 it at 128 seemed about the same as booting without the patch. I can do
 some more testing over the weekend, but I don't think this is the
 correct solution.

For describing the problem easily, follows the fedora live CD file structure 
first:

Fedora-Live-Workstation-x86_64-22_Beta-TC8.iso
=LiveOS/
squashfs.img
=LiveOS/
ext3fs.img
 
Looks at least two reasons are related with the problem:

- not like other filesyststems(such as ext4), squashfs is a bit special, and
I observed that increasing I/O jobs to access file in squashfs can't improve
I/O performance at all, but it can for ext4

- nested loop: both squashfs.img and ext3fs.img are mounted as loop block

One key idea in the commit b5dd2f60(block: loop: improve performance via blk-mq)
is to submit I/O concurrently from more than one context(worker), like posix
AIO style. Unfortunately this way can't improve I/O performance for squashfs,
and with extra cost of kworker threads, and nested loop makes it worse. 
Meantime,
during booting, there are lots of concurrent tasks requiring CPU, so the high
priority kworker threads for loop can affect other boot tasks, then booting time
is increased.

I think it may improve the problem by removing the nest loop, such as
extract files in ext3fs.img to squashfs.img.

 I would be interested in testing your dio/aio patches as well though.

squashfs doesn't support dio, so the dio/aio patch can't help much, but
the motivation for introducing dio/aio is really for avoiding double cache
and decreasing CPU utilization[1].

[1], http://marc.info/?l=linux-kernelm=142116397525668w=2

The following patch may help the situation, but for this case, I am wondering
it can compete with previous loop.
---
From 0af95571a2a066b4f3bacaac2c75b39e3c701c6e Mon Sep 17 00:00:00 2001
From: Ming Lei ming@canonical.com
Date: Sun, 26 Apr 2015 17:53:56 +0800
Subject: [PATCH] block: loop: avoiding too many pending per work I/O

If there are too many pending per work I/O, too many
high priority work thread can be generated so that
system performance can be effected.

This patch limits the max pending per work I/O as 32,
and will degrage to single queue mode when the max number
is reached.

This patch fixes Fedora 22 live booting performance
regression when it is booted from squashfs over dm
based on loop.

Signed-off-by: Ming Lei ming@canonical.com
---
 drivers/block/loop.c | 21 ++---
 drivers/block/loop.h |  2 ++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/block/loop.c 

Re: [PATCH] x86/microcode: Allow early loading without initrd

2015-04-26 Thread Alexander Hirsch
On Sun, 26 Apr 2015 17:31:13 +0200
Paul Bolle pebo...@tiscali.nl wrote:

 #ifndef CONFIG_BLK_DEV_INITRD?  

Indeed, thank you. I fixed it.

---
From: Alexander 'z33ky' Hirsch 1ze...@gmail.com
Date: Sun, 26 Apr 2015 15:18:18 +0200
Subject: [PATCH] x86, microcode: Allow early loading without initrd

Microcode can be baked into the kernel image via CONFIG_EXTRA_FIRMWARE
and the early loader supports that, but still depended on
BLK_DEV_INITRD.
This dependency is removed.

Signed-off-by: Alexander Hirsch 1ze...@gmail.com
---
 arch/x86/Kconfig|  2 +-
 arch/x86/kernel/cpu/microcode/intel_early.c | 30 +
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 226d569..bc7e187 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1144,7 +1144,7 @@ config MICROCODE_AMD_EARLY
 
 config MICROCODE_EARLY
bool Early load microcode
-   depends on MICROCODE=y  BLK_DEV_INITRD
+   depends on MICROCODE=y
select MICROCODE_INTEL_EARLY if MICROCODE_INTEL
select MICROCODE_AMD_EARLY if MICROCODE_AMD
default y
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c 
b/arch/x86/kernel/cpu/microcode/intel_early.c
index 98d320c..ad7901f 100644
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -691,6 +691,9 @@ int __init save_microcode_in_initrd_intel(void)
unsigned int count = mc_saved_data.mc_saved_count;
struct microcode_intel *mc_saved[MAX_UCODE_COUNT];
int ret = 0;
+#ifndef CONFIG_BLK_DEV_INITRD
+   unsigned long initrd_start = 0;
+#endif
 
if (count == 0)
return ret;
@@ -728,24 +731,32 @@ _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,
 
 void __init load_ucode_intel_bsp(void)
 {
-   u64 start, size;
+   u64 start = 0, size = 0;
+   struct mc_saved_data *mc_saved_data_p;
+   unsigned long *mc_saved_in_initrd_p;
+#ifdef CONFIG_BLK_DEV_INITRD
 #ifdef CONFIG_X86_32
struct boot_params *p;
 
p   = (struct boot_params *)__pa_nodebug(boot_params);
start   = p-hdr.ramdisk_image;
size= p-hdr.ramdisk_size;
-
-   _load_ucode_intel_bsp(
-   (struct mc_saved_data *)__pa_nodebug(mc_saved_data),
-   (unsigned long *)__pa_nodebug(mc_saved_in_initrd),
-   start, size);
 #else
start   = boot_params.hdr.ramdisk_image + PAGE_OFFSET;
size= boot_params.hdr.ramdisk_size;
-
-   _load_ucode_intel_bsp(mc_saved_data, mc_saved_in_initrd, start, size);
 #endif
+#endif
+
+#ifdef CONFIG_X86_32
+   mc_saved_in_initrd_p =
+   (unsigned long *)__pa_nodebug(mc_saved_in_initrd);
+   mc_saved_data_p = (struct mc_saved_data *)__pa_nodebug(mc_saved_data);
+#else
+   mc_saved_data_p = mc_saved_data;
+   mc_saved_in_initrd_p = mc_saved_in_initrd;
+#endif
+
+   _load_ucode_intel_bsp(mc_saved_data_p, mc_saved_in_initrd_p, start, 
size);
 }
 
 void load_ucode_intel_ap(void)
@@ -755,6 +766,9 @@ void load_ucode_intel_ap(void)
unsigned long *mc_saved_in_initrd_p;
unsigned long initrd_start_addr;
enum ucode_state ret;
+#ifndef CONFIG_BLK_DEV_INITRD
+   unsigned long initrd_start = 0;
+#endif
 #ifdef CONFIG_X86_32
unsigned long *initrd_start_p;
 
-- 
2.3.6


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/4] checkpatch: Add multi-line handling for PREFER_ETHER_ADDR_COPY

2015-04-26 Thread Mateusz Kulikowski
Handle multi-line memcpy() properly.

Signed-off-by: Mateusz Kulikowski mateusz.kulikow...@gmail.com
---
 scripts/checkpatch.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c05befe..6311950 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5027,9 +5027,10 @@ sub process {
 
 # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
if ($^V  $^V ge 5.10.0 
-   $line =~ 
/^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) {
+   defined $stat 
+   $stat =~ 
/^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
if (WARN(PREFER_ETHER_ADDR_COPY,
-Prefer ether_addr_copy() over memcpy() if the 
Ethernet addresses are __aligned(2)\n . $herecurr) 
+Prefer ether_addr_copy() over memcpy() if the 
Ethernet addresses are __aligned(2)\n . $here\n$stat\n) 
$fix) {
$fixed[$fixlinenr] =~ 
s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2,
 $7)/;
}
-- 
1.8.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/4] checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr()

2015-04-26 Thread Mateusz Kulikowski
Suggest using eth_zero_addr() or eth_broadcast_addr() instead of memset().

Signed-off-by: Mateusz Kulikowski mateusz.kulikow...@gmail.com
---
 scripts/checkpatch.pl | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0a511b7..263e831 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5043,6 +5043,29 @@ sub process {
 Prefer ether_addr_equal() or 
ether_addr_equal_unaligned() over memcmp()\n . $here\n$stat\n)
}
 
+# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
+# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
+   if ($^V  $^V ge 5.10.0 
+   defined $stat 
+   $stat =~ 
/^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
+
+   my $ms_val = $7;
+
+   if ($ms_val =~ /^(?:0x|)0+$/i) {
+   if (WARN(PREFER_ETH_ZERO_ADDR,
+Prefer eth_zero_addr over memset()\n 
. $here\n$stat\n) 
+   $fix) {
+   $fixed[$fixlinenr] =~ 
s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_addr($2)/;
+   }
+   } elsif ($ms_val =~ /^(?:0xff|255)$/i) {
+   if (WARN(PREFER_ETH_BROADCAST_ADDR,
+Prefer eth_broadcast_addr() over 
memset()\n . $here\n$stat\n) 
+   $fix) {
+   $fixed[$fixlinenr] =~ 
s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broadcast_addr($2)/;
+   }
+   }
+   }
+
 # typecasts on min/max could be min_t/max_t
if ($^V  $^V ge 5.10.0 
defined $stat 
-- 
1.8.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/4] checkpatch: suggest using ether_addr_equal*()

2015-04-26 Thread Mateusz Kulikowski
Check if memcmp() is used to compare ethernet addresses and suggest
using ether_addr_equal() or ether_addr_equal_unaligned()

Signed-off-by: Mateusz Kulikowski mateusz.kulikow...@gmail.com
---
 scripts/checkpatch.pl | 8 
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..0a511b7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5035,6 +5035,14 @@ sub process {
}
}
 
+# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, 
bar)
+   if ($^V  $^V ge 5.10.0 
+   defined $stat 
+   $stat =~ 
/^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
+   WARN(PREFER_ETHER_ADDR_EQUAL,
+Prefer ether_addr_equal() or 
ether_addr_equal_unaligned() over memcmp()\n . $here\n$stat\n)
+   }
+
 # typecasts on min/max could be min_t/max_t
if ($^V  $^V ge 5.10.0 
defined $stat 
-- 
1.8.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.0 1/7] udptunnels: Call handle_offloads after inserting vlan tag.

2015-04-26 Thread Greg Kroah-Hartman
4.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Jesse Gross je...@nicira.com

[ Upstream commit b736a623bd099cdf5521ca9bd03559f3bc7fa31c ]

handle_offloads() calls skb_reset_inner_headers() to store
the layer pointers to the encapsulated packet. However, we
currently push the vlag tag (if there is one) onto the packet
afterwards. This changes the MAC header for the encapsulated
packet but it is not reflected in skb-inner_mac_header, which
breaks GSO and drivers which attempt to use this for encapsulation
offloads.

Fixes: 1eaa8178 (vxlan: Add tx-vlan offload support.)
Signed-off-by: Jesse Gross je...@nicira.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/vxlan.c |   20 ++--
 net/ipv4/geneve.c   |8 
 2 files changed, 14 insertions(+), 14 deletions(-)

--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1713,12 +1713,6 @@ static int vxlan6_xmit_skb(struct dst_en
}
}
 
-   skb = iptunnel_handle_offloads(skb, udp_sum, type);
-   if (IS_ERR(skb)) {
-   err = -EINVAL;
-   goto err;
-   }
-
skb_scrub_packet(skb, xnet);
 
min_headroom = LL_RESERVED_SPACE(dst-dev) + dst-header_len
@@ -1738,6 +1732,12 @@ static int vxlan6_xmit_skb(struct dst_en
goto err;
}
 
+   skb = iptunnel_handle_offloads(skb, udp_sum, type);
+   if (IS_ERR(skb)) {
+   err = -EINVAL;
+   goto err;
+   }
+
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh-vx_flags = htonl(VXLAN_HF_VNI);
vxh-vx_vni = md-vni;
@@ -1798,10 +1798,6 @@ int vxlan_xmit_skb(struct rtable *rt, st
}
}
 
-   skb = iptunnel_handle_offloads(skb, udp_sum, type);
-   if (IS_ERR(skb))
-   return PTR_ERR(skb);
-
min_headroom = LL_RESERVED_SPACE(rt-dst.dev) + rt-dst.header_len
+ VXLAN_HLEN + sizeof(struct iphdr)
+ (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
@@ -1817,6 +1813,10 @@ int vxlan_xmit_skb(struct rtable *rt, st
if (WARN_ON(!skb))
return -ENOMEM;
 
+   skb = iptunnel_handle_offloads(skb, udp_sum, type);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh-vx_flags = htonl(VXLAN_HF_VNI);
vxh-vx_vni = md-vni;
--- a/net/ipv4/geneve.c
+++ b/net/ipv4/geneve.c
@@ -113,10 +113,6 @@ int geneve_xmit_skb(struct geneve_sock *
int min_headroom;
int err;
 
-   skb = udp_tunnel_handle_offloads(skb, csum);
-   if (IS_ERR(skb))
-   return PTR_ERR(skb);
-
min_headroom = LL_RESERVED_SPACE(rt-dst.dev) + rt-dst.header_len
+ GENEVE_BASE_HLEN + opt_len + sizeof(struct iphdr)
+ (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
@@ -131,6 +127,10 @@ int geneve_xmit_skb(struct geneve_sock *
if (unlikely(!skb))
return -ENOMEM;
 
+   skb = udp_tunnel_handle_offloads(skb, csum);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len);
geneve_build_header(gnvh, tun_flags, vni, opt_len, opt);
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.0 5/7] Revert net: Reset secmark when scrubbing packet

2015-04-26 Thread Greg Kroah-Hartman
4.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Herbert Xu herb...@gondor.apana.org.au

[ Upstream commit 4c0ee414e877b899f7fc80aafb98d9425c02797f ]

This patch reverts commit b8fb4e0648a2ab3734140342002f68fb0c7d1602
because the secmark must be preserved even when a packet crosses
namespace boundaries.  The reason is that security labels apply to
the system as a whole and is not per-namespace.

Signed-off-by: Herbert Xu herb...@gondor.apana.org.au
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/core/skbuff.c |1 -
 1 file changed, 1 deletion(-)

--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4178,7 +4178,6 @@ void skb_scrub_packet(struct sk_buff *sk
skb_dst_drop(skb);
skb-mark = 0;
skb_sender_cpu_clear(skb);
-   skb_init_secmark(skb);
secpath_reset(skb);
nf_reset(skb);
nf_reset_trace(skb);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4.0 4/7] bpf: fix verifier memory corruption

2015-04-26 Thread Greg Kroah-Hartman
4.0-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexei Starovoitov a...@plumgrid.com

[ Upstream commit c3de6317d748e23b9e46ba36e10483728d00d144 ]

Due to missing bounds check the DAG pass of the BPF verifier can corrupt
the memory which can cause random crashes during program loading:

[8.449451] BUG: unable to handle kernel paging request at 
[8.451293] IP: [811de33d] kmem_cache_alloc_trace+0x8d/0x2f0
[8.452329] Oops:  [#1] SMP
[8.452329] Call Trace:
[8.452329]  [8116cc82] bpf_check+0x852/0x2000
[8.452329]  [8116b7e4] bpf_prog_load+0x1e4/0x310
[8.452329]  [811b190f] ? might_fault+0x5f/0xb0
[8.452329]  [8116c206] SyS_bpf+0x806/0xa30

Fixes: f1bca824dabb (bpf: add search pruning optimization to verifier)
Signed-off-by: Alexei Starovoitov a...@plumgrid.com
Acked-by: Hannes Frederic Sowa han...@stressinduktion.org
Acked-by: Daniel Borkmann dan...@iogearbox.net
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 kernel/bpf/verifier.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1380,7 +1380,8 @@ peek_stack:
/* tell verifier to check for equivalent states
 * after every call and jump
 */
-   env-explored_states[t + 1] = STATE_LIST_MARK;
+   if (t + 1  insn_cnt)
+   env-explored_states[t + 1] = STATE_LIST_MARK;
} else {
/* conditional jump with two edges */
ret = push_insn(t, t + 1, FALLTHROUGH, env);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 31/31] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Seth Jennings sjenn...@redhat.com

commit 351fc4a99d49fde63fe5ab7412beb35c40d27269 upstream.

Intel IA32 SDM Table 15-14 defines channel 0xf as 'not specified', but
EDAC doesn't know about this and returns and INTERNAL ERROR when the
channel is greater than NUM_CHANNELS:

kernel: [ 1538.886456] CPU 0: Machine Check Exception: 0 Bank 1: 
949f
kernel: [ 1538.886669] TSC 2bc68b22e7e812 ADDR 46dae7000 MISC 0 PROCESSOR 
0:306e4 TIME 1390414572 SOCKET 0 APIC 0
kernel: [ 1538.971948] EDAC MC1: INTERNAL ERROR: channel value is out of range 
(15 = 4)
kernel: [ 1538.972203] EDAC MC1: 0 CE memory read error on unknown memory 
(slot:0 page:0x46dae7 offset:0x0 grain:0 syndrome:0x0 -  area:DRAM 
err_code::009f socket:1 channel_mask:1 rank:0)

This commit changes sb_edac to forward a channel of -1 to EDAC if the
channel is not specified.  edac_mc_handle_error() sets the channel to -1
internally after the error message anyway, so this commit should have no
effect other than avoiding the INTERNAL ERROR message when the channel
is not specified.

Signed-off-by: Seth Jennings sjenn...@redhat.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
Cc: Vinson Lee v...@twopensource.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/edac/sb_edac.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -270,8 +270,9 @@ static const u32 correrrthrsld[] = {
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4
-#define MAX_DIMMS  3   /* Max DIMMS per channel */
+#define NUM_CHANNELS   4
+#define MAX_DIMMS  3   /* Max DIMMS per channel */
+#define CHANNEL_UNSPECIFIED0xf /* Intel IA32 SDM 15-14 */
 
 struct sbridge_info {
u32 mcmtr;
@@ -1451,6 +1452,9 @@ static void sbridge_mce_output_error(str
 
/* FIXME: need support for channel mask */
 
+   if (channel == CHANNEL_UNSPECIFIED)
+   channel = -1;
+
/* Call the helper to output message */
edac_mc_handle_error(tp_event, mci, core_err_cnt,
 m-addr  PAGE_SHIFT, m-addr  ~PAGE_MASK, 0,


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 28/31] vm: add VM_FAULT_SIGSEGV handling support

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 33692f27597fcab536d7cbbcc8f52905133e4aa7 upstream.

The core VM already knows about VM_FAULT_SIGBUS, but cannot return a
you should SIGSEGV error, because the SIGSEGV case was generally
handled by the caller - usually the architecture fault handler.

That results in lots of duplication - all the architecture fault
handlers end up doing very similar look up vma, check permissions, do
retries etc - but it generally works.  However, there are cases where
the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV.

In particular, when accessing the stack guard page, libsigsegv expects a
SIGSEGV.  And it usually got one, because the stack growth is handled by
that duplicated architecture fault handler.

However, when the generic VM layer started propagating the error return
from the stack expansion in commit fee7e49d4514 (mm: propagate error
from stack expansion even for guard page), that now exposed the
existing VM_FAULT_SIGBUS result to user space.  And user space really
expected SIGSEGV, not SIGBUS.

To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those
duplicate architecture fault handlers about it.  They all already have
the code to handle SIGSEGV, so it's about just tying that new return
value to the existing code, but it's all a bit annoying.

This is the mindless minimal patch to do this.  A more extensive patch
would be to try to gather up the mostly shared fault handling logic into
one generic helper routine, and long-term we really should do that
cleanup.

Just from this patch, you can generally see that most architectures just
copied (directly or indirectly) the old x86 way of doing things, but in
the meantime that original x86 model has been improved to hold the VM
semaphore for shorter times etc and to handle VM_FAULT_RETRY and other
newer things, so it would be a good idea to bring all those
improvements to the generic case and teach other architectures about
them too.

Reported-and-tested-by: Takashi Iwai ti...@suse.de
Tested-by: Jan Engelhardt jeng...@inai.de
Acked-by: Heiko Carstens heiko.carst...@de.ibm.com # s390 still compiles and 
boots
Cc: linux-a...@vger.kernel.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
[shengyong: Backport to 3.10
 - adjust context
 - ignore modification for arch nios2, because 3.10 does not support it
 - ignore modification for driver lustre, because 3.10 does not support it
 - ignore VM_FAULT_FALLBACK in VM_FAULT_ERROR, becase 3.10 does not support
   this flag
 - add SIGSEGV handling to powerpc/cell spu_fault.c, because 3.10 does not
   separate it to copro_fault.c
 - add SIGSEGV handling in mm/memory.c, because 3.10 does not separate it
   to gup.c
]
Signed-off-by: Sheng Yong shengyo...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 arch/alpha/mm/fault.c   |2 ++
 arch/arc/mm/fault.c |2 ++
 arch/avr32/mm/fault.c   |2 ++
 arch/cris/mm/fault.c|2 ++
 arch/frv/mm/fault.c |2 ++
 arch/ia64/mm/fault.c|2 ++
 arch/m32r/mm/fault.c|2 ++
 arch/m68k/mm/fault.c|2 ++
 arch/metag/mm/fault.c   |2 ++
 arch/microblaze/mm/fault.c  |2 ++
 arch/mips/mm/fault.c|2 ++
 arch/mn10300/mm/fault.c |2 ++
 arch/openrisc/mm/fault.c|2 ++
 arch/parisc/mm/fault.c  |2 ++
 arch/powerpc/mm/fault.c |2 ++
 arch/powerpc/platforms/cell/spu_fault.c |2 +-
 arch/s390/mm/fault.c|6 ++
 arch/score/mm/fault.c   |2 ++
 arch/sh/mm/fault.c  |2 ++
 arch/sparc/mm/fault_32.c|2 ++
 arch/sparc/mm/fault_64.c|2 ++
 arch/tile/mm/fault.c|2 ++
 arch/um/kernel/trap.c   |2 ++
 arch/x86/mm/fault.c |2 ++
 arch/xtensa/mm/fault.c  |2 ++
 include/linux/mm.h  |5 +++--
 mm/ksm.c|2 +-
 mm/memory.c |5 +++--
 28 files changed, 60 insertions(+), 6 deletions(-)

--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -156,6 +156,8 @@ retry:
if (unlikely(fault  VM_FAULT_ERROR)) {
if (fault  VM_FAULT_OOM)
goto out_of_memory;
+   else if (fault  VM_FAULT_SIGSEGV)
+   goto bad_area;
else if (fault  VM_FAULT_SIGBUS)
goto do_sigbus;
BUG();
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -160,6 +160,8 @@ good_area:
/* TBD: switch to pagefault_out_of_memory() 

[PATCH 3.10 08/31] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/realtek/8139too.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1715,9 +1715,9 @@ static netdev_tx_t rtl8139_start_xmit (s
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;
}


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 04/31] ipv6: Dont reduce hop limit for an interface

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: D.S. Ljungmark ljungm...@modio.se

[ Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a ]

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, Parameter Spoofing

   1.  The attacker includes a Current Hop Limit of one or another small
   number which the attacker knows will cause legitimate packets to
   be dropped before they reach their destination.

   As an example, one possible approach to mitigate this threat is to
   ignore very small hop limits.  The nodes could implement a
   configurable minimum hop limit, and ignore attempts to set it below
   said limit.

Signed-off-by: D.S. Ljungmark ljungm...@modio.se
Acked-by: Hannes Frederic Sowa han...@stressinduktion.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv6/ndisc.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1193,7 +1193,14 @@ static void ndisc_router_discovery(struc
if (rt)
rt6_set_expires(rt, jiffies + (HZ * lifetime));
if (ra_msg-icmph.icmp6_hop_limit) {
-   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   /* Only set hop_limit on the interface if it is higher than
+* the current hop_limit.
+*/
+   if (in6_dev-cnf.hop_limit  ra_msg-icmph.icmp6_hop_limit) {
+   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   } else {
+   ND_PRINTK(2, warn, RA: Got route advertisement with 
lower hop_limit than current\n);
+   }
if (rt)
dst_metric_set(rt-dst, RTAX_HOPLIMIT,
   ra_msg-icmph.icmp6_hop_limit);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 03/31] tcp: prevent fetching dst twice in early demux code

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= mkube...@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 mkube...@suse.cz
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_ipv4.c |2 +-
 net/ipv6/tcp_ipv6.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1901,7 +1901,7 @@ void tcp_v4_early_demux(struct sk_buff *
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);
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1616,7 +1616,7 @@ static void tcp_v6_early_demux(struct sk
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);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 14/31] serial: 8250_dw: Fix deadlock in LCR workaround

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Hurley pe...@hurleysoftware.com

commit 7fd6f640f2dd17dac6ddd6702c378cb0bb9cfa11 upstream.

Trying to write console output from within the serial console driver
while the port-lock is held causes recursive deadlock:

  CPU 0
spin_lock_irqsave(port-lock)
printk()
  console_unlock()
call_console_drivers()
  serial8250_console_write()
spin_lock_irqsave(port-lock)
** DEADLOCK **

The 8250_dw i/o accessors try to write a console error message if the
LCR workaround was unsuccessful. When the port-lock is already held
(eg., when called from serial8250_set_termios()), this deadlocks.

Make the error message a FIXME until a general solution is devised.

Cc: Tim Kryger tim.kry...@gmail.com
Reported-by: Zhang Zhen zhenzhang.zh...@huawei.com
Signed-off-by: Peter Hurley pe...@hurleysoftware.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/tty/serial/8250/8250_dw.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -98,7 +98,10 @@ static void dw8250_serial_out(struct uar
dw8250_force_idle(p);
writeb(value, p-membase + (UART_LCR  p-regshift));
}
-   dev_err(p-dev, Couldn't set LCR to %d\n, value);
+   /*
+* FIXME: this deadlocks if port-lock is already held
+* dev_err(p-dev, Couldn't set LCR to %d\n, value);
+*/
}
 }
 
@@ -128,7 +131,10 @@ static void dw8250_serial_out32(struct u
dw8250_force_idle(p);
writel(value, p-membase + (UART_LCR  p-regshift));
}
-   dev_err(p-dev, Couldn't set LCR to %d\n, value);
+   /*
+* FIXME: this deadlocks if port-lock is already held
+* dev_err(p-dev, Couldn't set LCR to %d\n, value);
+*/
}
 }
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.10 30/31] x86: mm: move mmap_sem unlock from mm_fault_error() to caller

2015-04-26 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 7fb08eca45270d0ae86e1ad9d39c40b7a55d0190 upstream.

This replaces four copies in various stages of mm_fault_error() handling
with just a single one.  It will also allow for more natural placement
of the unlocking after some further cleanup.

Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 arch/x86/mm/fault.c |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -812,11 +812,8 @@ do_sigbus(struct pt_regs *regs, unsigned
  unsigned int fault)
 {
struct task_struct *tsk = current;
-   struct mm_struct *mm = tsk-mm;
int code = BUS_ADRERR;
 
-   up_read(mm-mmap_sem);
-
/* Kernel mode? Handle exceptions or die: */
if (!(error_code  PF_USER)) {
no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
@@ -847,7 +844,6 @@ mm_fault_error(struct pt_regs *regs, uns
   unsigned long address, unsigned int fault)
 {
if (fatal_signal_pending(current)  !(error_code  PF_USER)) {
-   up_read(current-mm-mmap_sem);
no_context(regs, error_code, address, 0, 0);
return;
}
@@ -855,14 +851,11 @@ mm_fault_error(struct pt_regs *regs, uns
if (fault  VM_FAULT_OOM) {
/* Kernel mode? Handle exceptions or die: */
if (!(error_code  PF_USER)) {
-   up_read(current-mm-mmap_sem);
no_context(regs, error_code, address,
   SIGSEGV, SEGV_MAPERR);
return;
}
 
-   up_read(current-mm-mmap_sem);
-
/*
 * We ran out of memory, call the OOM killer, and return the
 * userspace (which will retry the fault, or kill us if we got
@@ -1195,6 +1188,7 @@ good_area:
return;
 
if (unlikely(fault  VM_FAULT_ERROR)) {
+   up_read(mm-mmap_sem);
mm_fault_error(regs, error_code, address, fault);
return;
}


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 21/42] Bluetooth: append new supported device to the list [0b05:17d0]

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Andy Shevchenko andriy.shevche...@linux.intel.com

commit a735f9e22432899cee188d167966782c29246390 upstream.

The device found on Asus Z87 Expert motherboard requires firmware to work
correctly.

T:  Bus=03 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0b05 ProdID=17d0 Rev=00.02
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/ath3k.c |2 ++
 drivers/bluetooth/btusb.c |1 +
 2 files changed, 3 insertions(+)

--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -87,6 +87,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x04CA, 0x300b) },
{ USB_DEVICE(0x0930, 0x0219) },
{ USB_DEVICE(0x0930, 0x0220) },
+   { USB_DEVICE(0x0b05, 0x17d0) },
{ USB_DEVICE(0x0CF3, 0x0036) },
{ USB_DEVICE(0x0CF3, 0x3004) },
{ USB_DEVICE(0x0CF3, 0x3008) },
@@ -135,6 +136,7 @@ static const struct usb_device_id ath3k_
{ USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -157,6 +157,7 @@ static const struct usb_device_id blackl
{ USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
+   { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 19/42] Bluetooth: btusb: Add IMC Networks (Broadcom based)

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Jurgen Kramer gtmkra...@xs4all.nl

commit 9113bfd82dc8ece9cbb898df8794f58a78a36e97 upstream.

Add support for IMC Networks (Broadcom based) to btusb driver.

Below the output of /sys/kernel/debug/usb/devices for this device:

T:  Bus=01 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=13d3 ProdID=3404 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=240A649F8246
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Jurgen Kramer gtmkra...@xs4all.nl
Signed-off-by: Marcel Holtmann mar...@holtmann.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 drivers/bluetooth/btusb.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -116,6 +116,9 @@ static const struct usb_device_id btusb_
/* Belkin F8065bf - Broadcom based */
{ USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) },
 
+   /* IMC Networks - Broadcom based */
+   { USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) },
+
{ } /* Terminating entry */
 };
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 16/42] gianfar: Carefully free skbs in functions called by netpoll.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/freescale/gianfar.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2152,13 +2152,13 @@ static int gfar_start_xmit(struct sk_buf
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;
}
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 42/42] proc/pagemap: walk page tables under pte lock

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Konstantin Khlebnikov khlebni...@yandex-team.ru

commit 05fbf357d94152171bc50f8a369390f1f16efd89 upstream.

Lockless access to pte in pagemap_pte_range() might race with page
migration and trigger BUG_ON(!PageLocked()) in migration_entry_to_page():

CPU A (pagemap)   CPU B (migration)
  lock_page()
  try_to_unmap(page, TTU_MIGRATION...)
   make_migration_entry()
   set_pte_at()
read *pte
pte_to_pagemap_entry()
  remove_migration_ptes()
  unlock_page()
if(is_migration_entry())
migration_entry_to_page()
BUG_ON(!PageLocked(page))

Also lockless read might be non-atomic if pte is larger than wordsize.
Other pte walkers (smaps, numa_maps, clear_refs) already lock ptes.

Fixes: 052fb0d635df (proc: report file/anon bit in /proc/pid/pagemap)
Signed-off-by: Konstantin Khlebnikov khlebni...@yandex-team.ru
Reported-by: Andrey Ryabinin a.ryabi...@samsung.com
Reviewed-by: Cyrill Gorcunov gorcu...@openvz.org
Acked-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com
Acked-by: Kirill A. Shutemov kirill.shute...@linux.intel.com
Cc: sta...@vger.kernel.org[3.5+]
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

---
 fs/proc/task_mmu.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -993,7 +993,7 @@ static int pagemap_pte_range(pmd_t *pmd,
struct vm_area_struct *vma;
struct pagemapread *pm = walk-private;
spinlock_t *ptl;
-   pte_t *pte;
+   pte_t *pte, *orig_pte;
int err = 0;
 
/* find the first VMA at or above 'addr' */
@@ -1054,15 +1054,19 @@ static int pagemap_pte_range(pmd_t *pmd,
BUG_ON(is_vm_hugetlb_page(vma));
 
/* Addresses in the VMA. */
-   for (; addr  min(end, vma-vm_end); addr += PAGE_SIZE) {
+   orig_pte = pte = pte_offset_map_lock(walk-mm, pmd, addr, ptl);
+   for (; addr  min(end, vma-vm_end); pte++, addr += PAGE_SIZE) {
pagemap_entry_t pme;
-   pte = pte_offset_map(pmd, addr);
+
pte_to_pagemap_entry(pme, pm, vma, addr, *pte);
-   pte_unmap(pte);
err = add_to_pagemap(addr, pme, pm);
if (err)
-   return err;
+   break;
}
+   pte_unmap_unlock(orig_pte, ptl);
+
+   if (err)
+   return err;
 
if (addr == end)
break;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 12/42] tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman ebied...@xmission.com

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 ebied...@xmission.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/broadcom/tg3.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6593,7 +6593,7 @@ static void tg3_tx(struct tg3_napi *tnap
pkts_compl++;
bytes_compl += skb-len;
 
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 
if (unlikely(tx_bug)) {
tg3_tx_recover(tp);
@@ -6925,7 +6925,7 @@ static int tg3_rx(struct tg3_napi *tnapi
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;
}
 
@@ -7808,7 +7808,7 @@ static int tigon3_dma_hwbug_workaround(s
  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;
@@ -7823,13 +7823,13 @@ static int tigon3_dma_hwbug_workaround(s
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;
 }
@@ -7872,7 +7872,7 @@ static int tg3_tso_bug(struct tg3 *tp, s
} while (segs);
 
 tg3_tso_bug_end:
-   dev_kfree_skb(skb);
+   dev_kfree_skb_any(skb);
 
return NETDEV_TX_OK;
 }
@@ -8110,7 +8110,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;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-sunxi] [PATCH 2/3] spidev: Add DT binding example.

2015-04-26 Thread Michal Suchanek
On 26 April 2015 at 14:51, Maxime Ripard
maxime.rip...@free-electrons.com wrote:
 On Sun, Apr 26, 2015 at 02:38:18PM +0200, Michal Suchanek wrote:
 On 26 April 2015 at 13:56, Martin Sperl ker...@martin.sperl.org wrote:
 
  On 26.04.2015, at 13:23, Hans de Goede hdego...@redhat.com wrote:
  I think there is actual a use for just binding spidev as spidev,
  think e.g. the spi pins on the raspberry pi.
 
  How do you deal we suggest with such a situation ?
 
  I actually asked the same question a few days ago on the spi list
  (in thread: spi: spidev: Warn loudly if instantiated from DT as “spidev”)
  and the summary was:
 
  You can still do as before, but you have to accept that long
  irritating warning.
 
  Or you patch spidev.c to include your pattern of choice for compatiblity

 So the suggestion is to add a compatible string like olimex,uext-slot
 to spidev and use that compatible in the DT?

 No, you add a compatible for the device that is connected to the bus
 through that slot.

There is no device connected in the slot by design. The slot is there
for connecting random stuff you find in your mailbox or other drawers
and boxes.


 That can certainly be done but adding a new compatible for every board
 that has some random pins looks like a needless nuisance to me.
 Especially compared to i2c where you can just open the bus so long as
 ti is enabled.

 
  Or you implement the following proposal (which needs a volunteer):
  On 23.04.2015, at 09:42, Geert Uytterhoeven ge...@linux-m68k.org wrote:
 
  So what you need is a way to handover from generic spidev to a 
  device-specific
  driver, cfr. what graphics drivers do when the device has been bound to by
  vesafb or simplefb.
 
  Could this be implemented in a generic way in the spi or DT code?
 
  ...
  On 23.04.2015, at 12:36, Mark Brown broo...@kernel.org wrote:
  On Thu, Apr 23, 2015 at 09:45:16AM +0200, Geert Uytterhoeven wrote:
 
  I guess this has been suggested before: the spi core could provide spidev
  access to all spi client devices which are not bound by a driver?
 
  I don't know if it's been suggested before, certainly nobody did the
  work to make it happen.  I don't think I have a massive objection in
  principal.

 Actually, I did it a year ago, and it looked at the time that it
 wasn't what should be done either.

There is nothing like unclaimed device. Either there is a device and
driver for it may in principle be loaded later as a module or the chip
select is reserved for use from userspace.

Userspace driver is valid option and should have the ability to have
the chip select reserved.


 https://lkml.org/lkml/2014/4/28/612

 But how do you know there is a device?

 Devices on i2c can be probed. On spi you just transfer random data and
 hope it does something useful. Some devices have readable registers
 and can be probed in a device-specific way but others are write-only.

 Well, what's the point of communicating with a non-existent device in
 the first place?

I have multitude of SPI devices which are not part of the board and
hence its DT and can be connected to the board with jumper wires.

Most of them don't have a linux driver or compatible to bind with.


 So binding spidev is in my view just saying that you are going to
 transfer random data from userspace on this bus.

 Yes, to a device connected on that bus.

Yes, so I have this red rectangular PCB, blue PCB, and red square PCB
and blue very thin rectangular PCB.

Please enlighten me how to add DT bindings for these and the PCB which
is in the mail and I did not pick up at the post office yet.

Of course, I have some hope that the chips on the PCBs are at least
somewhat compatible with what I ordered but I cannot be sure until I
test that.

Thanks

Michal
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.14 00/42] 3.14.40-stable review

2015-04-26 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.40 release.
There are 42 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Tue Apr 28 13:42:22 UTC 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.40-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman gre...@linuxfoundation.org
Linux 3.14.40-rc1

Konstantin Khlebnikov khlebni...@yandex-team.ru
proc/pagemap: walk page tables under pte lock

Peter Feiner pfei...@google.com
mm: softdirty: unmapped addresses between VMAs are clean

Seth Jennings sjenn...@redhat.com
sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel

Linus Torvalds torva...@linux-foundation.org
x86: mm: move mmap_sem unlock from mm_fault_error() to caller

Steven Capper steve.cap...@linaro.org
ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE

Steven Capper steve.cap...@linaro.org
ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear

Linus Torvalds torva...@linux-foundation.org
vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS

Linus Torvalds torva...@linux-foundation.org
vm: add VM_FAULT_SIGSEGV handling support

Richard Guy Briggs r...@redhat.com
sched: declare pid_alive as inline

Al Viro v...@zeniv.linux.org.uk
move d_rcu from overlapping d_child to overlapping d_alias

Nadav Amit na...@cs.technion.ac.il
KVM: x86: SYSENTER emulation is broken

Florian Westphal f...@strlen.de
netfilter: conntrack: disable generic tracking for known protocols

Naoya Horiguchi n-horigu...@ah.jp.nec.com
mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()

Janne Heikkinen janne.m.heikki...@gmail.com
Bluetooth: Add USB device 04ca:3010 as Atheros AR3012

Dmitry Tunin hanipouspi...@gmail.com
Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device

Anantha Krishnan anan...@codeaurora.org
Bluetooth: Add support for Acer [0489:e078]

Vincent Zwanenburg vince...@topmail.ie
Add a new PID/VID 0227/0930 for AR3012.

Marcel Holtmann mar...@holtmann.org
Bluetooth: Add support for Broadcom device of Asus Z97-DELUXE motherboard

Anantha Krishnan anan...@codeaurora.org
Bluetooth: Add support for Acer [13D3:3432]

Marcel Holtmann mar...@holtmann.org
Bluetooth: Ignore isochronous endpoints for Intel USB bootloader

Marcel Holtmann mar...@holtmann.org
Bluetooth: Add support for Intel bootloader devices

Andy Shevchenko andriy.shevche...@linux.intel.com
Bluetooth: append new supported device to the list [0b05:17d0]

Andy Shevchenko andriy.shevche...@linux.intel.com
Bluetooth: sort the list of IDs in the source code

Jurgen Kramer gtmkra...@xs4all.nl
Bluetooth: btusb: Add IMC Networks (Broadcom based)

Oliver Neukum oli...@neukum.org
Bluetooth: Add firmware update for Atheros 0cf3:311f

Oliver Neukum oli...@neukum.org
Bluetooth: Enable Atheros 0cf3:311e for firmware upload

Eric W. Biederman ebied...@xmission.com
gianfar: Carefully free skbs in functions called by netpoll.

Eric W. Biederman ebied...@xmission.com
benet: Call dev_kfree_skby_any instead of kfree_skb.

Eric W. Biederman ebied...@xmission.com
mlx4: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
ixgb: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
bonding: Call dev_kfree_skby_any instead of kfree_skb.

Eric W. Biederman ebied...@xmission.com
r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.

Eric W. Biederman ebied...@xmission.com
8139cp: Call dev_kfree_skby_any instead of kfree_skb.

Eric Dumazet eduma...@google.com
tcp: tcp_make_synack() should clear skb-tstamp

han...@stressinduktion.org han...@stressinduktion.org
ipv6: protect skb-sk accesses from recursive dereference inside the stack

Neal Cardwell ncardw...@google.com
tcp: fix FRTO undo on cumulative ACK of SACKed range

D.S. Ljungmark ljungm...@modio.se
ipv6: Don't reduce hop limit for an interface

Ido Shamay i...@mellanox.com
net/mlx4_en: Call register_netdevice in the proper location

Michal Kubeček mkube...@suse.cz
tcp: prevent fetching dst twice in early demux code


-

Diffstat:

 Makefile|  4 +-
 arch/alpha/mm/fault.c   |  2 +
 arch/arc/mm/fault.c

[PATCH 3.14 03/42] ipv6: Dont reduce hop limit for an interface

2015-04-26 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: D.S. Ljungmark ljungm...@modio.se

[ Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a ]

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, Parameter Spoofing

   1.  The attacker includes a Current Hop Limit of one or another small
   number which the attacker knows will cause legitimate packets to
   be dropped before they reach their destination.

   As an example, one possible approach to mitigate this threat is to
   ignore very small hop limits.  The nodes could implement a
   configurable minimum hop limit, and ignore attempts to set it below
   said limit.

Signed-off-by: D.S. Ljungmark ljungm...@modio.se
Acked-by: Hannes Frederic Sowa han...@stressinduktion.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv6/ndisc.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1193,7 +1193,14 @@ static void ndisc_router_discovery(struc
if (rt)
rt6_set_expires(rt, jiffies + (HZ * lifetime));
if (ra_msg-icmph.icmp6_hop_limit) {
-   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   /* Only set hop_limit on the interface if it is higher than
+* the current hop_limit.
+*/
+   if (in6_dev-cnf.hop_limit  ra_msg-icmph.icmp6_hop_limit) {
+   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   } else {
+   ND_PRINTK(2, warn, RA: Got route advertisement with 
lower hop_limit than current\n);
+   }
if (rt)
dst_metric_set(rt-dst, RTAX_HOPLIMIT,
   ra_msg-icmph.icmp6_hop_limit);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 01/27] tcp: prevent fetching dst twice in early demux code

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= mkube...@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 READ_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 mkube...@suse.cz
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv4/tcp_ipv4.c |2 +-
 net/ipv6/tcp_ipv6.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1516,7 +1516,7 @@ void tcp_v4_early_demux(struct sk_buff *
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 = READ_ONCE(sk-sk_rx_dst);
 
if (dst)
dst = dst_check(dst, 0);
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1583,7 +1583,7 @@ static void tcp_v6_early_demux(struct sk
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 = READ_ONCE(sk-sk_rx_dst);
 
if (dst)
dst = dst_check(dst, 
inet6_sk(sk)-rx_dst_cookie);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 00/27] 3.19.6-stable review

2015-04-26 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.19.6 release.
There are 27 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Tue Apr 28 13:45:45 UTC 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.19.6-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman gre...@linuxfoundation.org
Linux 3.19.6-rc1

Jann Horn j...@thejh.net
fs: take i_mutex during prepare_binprm for set[ug]id executables

Troy Tan troy_...@realsil.com.cn
rtlwifi: rtl8192ee: Fix handling of new style descriptors

Naoya Horiguchi n-horigu...@ah.jp.nec.com
mm/hugetlb: take page table lock in follow_huge_pmd()

Naoya Horiguchi n-horigu...@ah.jp.nec.com
mm/hugetlb: reduce arch dependent code around follow_huge_*

Ian Abbott abbo...@mev.co.uk
staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

Radim Krčmář rkrc...@redhat.com
KVM: nVMX: mask unrestricted_guest if disabled on L0

Jun'ichi Nomura (NEC) j-nom...@ce.jp.nec.com
tg3: Hold tp-lock before calling tg3_halt() from tg3_init_one()

Ben Hutchings ben.hutchi...@codethink.co.uk
usbnet: Fix tx_bytes statistic running backward in cdc_ncm

Ben Hutchings ben.hutchi...@codethink.co.uk
usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers

Jesse Gross je...@nicira.com
udptunnels: Call handle_offloads after inserting vlan tag.

Herbert Xu herb...@gondor.apana.org.au
skbuff: Do not scrub skb mark within the same name space

Herbert Xu herb...@gondor.apana.org.au
Revert net: Reset secmark when scrubbing packet

Alexei Starovoitov a...@plumgrid.com
bpf: fix verifier memory corruption

Eric Dumazet eduma...@google.com
bnx2x: Fix busy_poll vs netpoll

Eric Dumazet eduma...@google.com
tcp: tcp_make_synack() should clear skb-tstamp

Jack Morgenstein ja...@dev.mellanox.co.il
net/mlx4_core: Fix error message deprecation for ConnectX-2 cards

han...@stressinduktion.org han...@stressinduktion.org
ipv6: protect skb-sk accesses from recursive dereference inside the stack

Neal Cardwell ncardw...@google.com
tcp: fix FRTO undo on cumulative ACK of SACKed range

Jonathan Davies jonathan.dav...@citrix.com
xen-netfront: transmit fully GSO-sized packets

Thomas Graf tg...@suug.ch
openvswitch: Return vport module ref before destruction

Anton Nayshtut an...@swortex.com
bonding: Bonding Overriding Configuration logic restored.

Alexey Kodanev alexey.koda...@oracle.com
net: tcp6: fix double call of tcp_v6_fill_cb()

Alex Gartrell agartr...@fb.com
tun: return proper error code from tun_do_read

D.S. Ljungmark ljungm...@modio.se
ipv6: Don't reduce hop limit for an interface

Ido Shamay i...@mellanox.com
net/mlx4_en: Call register_netdevice in the proper location

Simon Horman simon.hor...@netronome.com
rocker: handle non-bridge master change

Michal Kubeček mkube...@suse.cz
tcp: prevent fetching dst twice in early demux code


-

Diffstat:

 Makefile|   4 +-
 arch/arm/mm/hugetlbpage.c   |   6 --
 arch/arm64/mm/hugetlbpage.c |   6 --
 arch/ia64/mm/hugetlbpage.c  |   6 --
 arch/metag/mm/hugetlbpage.c |   6 --
 arch/mips/mm/hugetlbpage.c  |  18 
 arch/powerpc/mm/hugetlbpage.c   |   8 ++
 arch/s390/mm/hugetlbpage.c  |  20 
 arch/sh/mm/hugetlbpage.c|  12 ---
 arch/sparc/mm/hugetlbpage.c |  12 ---
 arch/tile/mm/hugetlbpage.c  |  28 -
 arch/x86/kvm/vmx.c  |   7 +-
 arch/x86/mm/hugetlbpage.c   |  12 ---
 drivers/net/bonding/bond_main.c |   3 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 137 +---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |   9 +-
 drivers/net/ethernet/broadcom/tg3.c |   2 +
 drivers/net/ethernet/mellanox/mlx4/cmd.c|   3 +-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |  15 +--
 drivers/net/ethernet/rocker/rocker.c|   8 +-
 drivers/net/tun.c   |   2 +-
 drivers/net/usb/asix_common.c   |   2 +
 drivers/net/usb/cdc_ncm.c   |   6 +-
 drivers/net/usb/sr9800.c|   1 +
 drivers/net/usb/usbnet.c|  17 ++-
 drivers/net/vxlan.c |  20 ++--
 drivers/net/wireless/rtlwifi/pci.c  |  31 --
 drivers/net/wireless/rtlwifi/rtl8192ee/sw.c |   3 +-
 drivers/net/wireless/rtlwifi/rtl8192ee/trx.c|   7 +-
 

[PATCH 3.19 11/27] ipv6: protect skb-sk accesses from recursive dereference inside the stack

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: han...@stressinduktion.org han...@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 j...@resnulli.us
Signed-off-by: Hannes Frederic Sowa han...@stressinduktion.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 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(-)

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2159,6 +2159,12 @@ void netdev_freemem(struct net_device *d
 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);
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -453,22 +453,6 @@ static __inline__ void inet_reset_saddr(
 
 #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);
 
 /*
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -174,7 +174,8 @@ int ip6_fragment(struct sk_buff *skb, in
 
 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));
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1812,6 +1812,8 @@ struct dst_entry *__sk_dst_check(struct
 
 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);
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2821,7 +2821,9 @@ static void skb_update_prio(struct sk_bu
 #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
 
 /**
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -651,6 +651,25 @@ static inline void sock_valbool_flag(str
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.
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -541,7 +541,8 @@ int ip6_fragment(struct sk_buff *skb, in
 {
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;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the 

[PATCH 3.19 06/27] net: tcp6: fix double call of tcp_v6_fill_cb()

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexey Kodanev alexey.koda...@oracle.com

[ Upstream commit 4ad19de8774e2a7b075b3e8ea48db85adcf33fa6 ]

tcp_v6_fill_cb() will be called twice if socket's state changes from
TCP_TIME_WAIT to TCP_LISTEN. That can result in control buffer data
corruption because in the second tcp_v6_fill_cb() call it's not copying
IP6CB(skb) anymore, but 'seq', 'end_seq', etc., so we can get weird and
unpredictable results. Performance loss of up to 1200% has been observed
in LTP/vxlan03 test.

This can be fixed by copying inet6_skb_parm to the beginning of 'cb'
only if xfrm6_policy_check() and tcp_v6_fill_cb() are going to be
called again.

Fixes: 2dc49d1680b53 (tcp6: don't move IP6CB before xfrm6_policy_check())

Signed-off-by: Alexey Kodanev alexey.koda...@oracle.com
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv6/tcp_ipv6.c |   11 +++
 1 file changed, 11 insertions(+)

--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1409,6 +1409,15 @@ static void tcp_v6_fill_cb(struct sk_buf
TCP_SKB_CB(skb)-sacked = 0;
 }
 
+static void tcp_v6_restore_cb(struct sk_buff *skb)
+{
+   /* We need to move header back to the beginning if xfrm6_policy_check()
+* and tcp_v6_fill_cb() are going to be called again.
+*/
+   memmove(IP6CB(skb), TCP_SKB_CB(skb)-header.h6,
+   sizeof(struct inet6_skb_parm));
+}
+
 static int tcp_v6_rcv(struct sk_buff *skb)
 {
const struct tcphdr *th;
@@ -1541,6 +1550,7 @@ do_time_wait:
inet_twsk_deschedule(tw, tcp_death_row);
inet_twsk_put(tw);
sk = sk2;
+   tcp_v6_restore_cb(skb);
goto process;
}
/* Fall through to ACK */
@@ -1549,6 +1559,7 @@ do_time_wait:
tcp_v6_timewait_ack(sk, skb);
break;
case TCP_TW_RST:
+   tcp_v6_restore_cb(skb);
goto no_tcp_socket;
case TCP_TW_SUCCESS:
;


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 04/27] ipv6: Dont reduce hop limit for an interface

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: D.S. Ljungmark ljungm...@modio.se

[ Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a ]

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, Parameter Spoofing

   1.  The attacker includes a Current Hop Limit of one or another small
   number which the attacker knows will cause legitimate packets to
   be dropped before they reach their destination.

   As an example, one possible approach to mitigate this threat is to
   ignore very small hop limits.  The nodes could implement a
   configurable minimum hop limit, and ignore attempts to set it below
   said limit.

Signed-off-by: D.S. Ljungmark ljungm...@modio.se
Acked-by: Hannes Frederic Sowa han...@stressinduktion.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 net/ipv6/ndisc.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1216,7 +1216,14 @@ static void ndisc_router_discovery(struc
if (rt)
rt6_set_expires(rt, jiffies + (HZ * lifetime));
if (ra_msg-icmph.icmp6_hop_limit) {
-   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   /* Only set hop_limit on the interface if it is higher than
+* the current hop_limit.
+*/
+   if (in6_dev-cnf.hop_limit  ra_msg-icmph.icmp6_hop_limit) {
+   in6_dev-cnf.hop_limit = ra_msg-icmph.icmp6_hop_limit;
+   } else {
+   ND_PRINTK(2, warn, RA: Got route advertisement with 
lower hop_limit than current\n);
+   }
if (rt)
dst_metric_set(rt-dst, RTAX_HOPLIMIT,
   ra_msg-icmph.icmp6_hop_limit);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3.19 15/27] bpf: fix verifier memory corruption

2015-04-26 Thread Greg Kroah-Hartman
3.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexei Starovoitov a...@plumgrid.com

[ Upstream commit c3de6317d748e23b9e46ba36e10483728d00d144 ]

Due to missing bounds check the DAG pass of the BPF verifier can corrupt
the memory which can cause random crashes during program loading:

[8.449451] BUG: unable to handle kernel paging request at 
[8.451293] IP: [811de33d] kmem_cache_alloc_trace+0x8d/0x2f0
[8.452329] Oops:  [#1] SMP
[8.452329] Call Trace:
[8.452329]  [8116cc82] bpf_check+0x852/0x2000
[8.452329]  [8116b7e4] bpf_prog_load+0x1e4/0x310
[8.452329]  [811b190f] ? might_fault+0x5f/0xb0
[8.452329]  [8116c206] SyS_bpf+0x806/0xa30

Fixes: f1bca824dabb (bpf: add search pruning optimization to verifier)
Signed-off-by: Alexei Starovoitov a...@plumgrid.com
Acked-by: Hannes Frederic Sowa han...@stressinduktion.org
Acked-by: Daniel Borkmann dan...@iogearbox.net
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 kernel/bpf/verifier.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1380,7 +1380,8 @@ peek_stack:
/* tell verifier to check for equivalent states
 * after every call and jump
 */
-   env-explored_states[t + 1] = STATE_LIST_MARK;
+   if (t + 1  insn_cnt)
+   env-explored_states[t + 1] = STATE_LIST_MARK;
} else {
/* conditional jump with two edges */
ret = push_insn(t, t + 1, FALLTHROUGH, env);


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-sunxi] [PATCH 2/3] spidev: Add DT binding example.

2015-04-26 Thread Maxime Ripard
On Sun, Apr 26, 2015 at 04:14:33PM +0200, Michal Suchanek wrote:
 On 26 April 2015 at 14:51, Maxime Ripard
 maxime.rip...@free-electrons.com wrote:
  On Sun, Apr 26, 2015 at 02:38:18PM +0200, Michal Suchanek wrote:
  On 26 April 2015 at 13:56, Martin Sperl ker...@martin.sperl.org wrote:
  
   On 26.04.2015, at 13:23, Hans de Goede hdego...@redhat.com wrote:
   I think there is actual a use for just binding spidev as spidev,
   think e.g. the spi pins on the raspberry pi.
  
   How do you deal we suggest with such a situation ?
  
   I actually asked the same question a few days ago on the spi list
   (in thread: spi: spidev: Warn loudly if instantiated from DT as 
   “spidev”)
   and the summary was:
  
   You can still do as before, but you have to accept that long
   irritating warning.
  
   Or you patch spidev.c to include your pattern of choice for compatiblity
 
  So the suggestion is to add a compatible string like olimex,uext-slot
  to spidev and use that compatible in the DT?
 
  No, you add a compatible for the device that is connected to the bus
  through that slot.
 
 There is no device connected in the slot by design. The slot is there
 for connecting random stuff you find in your mailbox or other drawers
 and boxes.

I know. Our point is add a compatible for that random device you find
in your mailbox.

  That can certainly be done but adding a new compatible for every board
  that has some random pins looks like a needless nuisance to me.
  Especially compared to i2c where you can just open the bus so long as
  ti is enabled.
 
  
   Or you implement the following proposal (which needs a volunteer):
   On 23.04.2015, at 09:42, Geert Uytterhoeven ge...@linux-m68k.org 
   wrote:
  
   So what you need is a way to handover from generic spidev to a 
   device-specific
   driver, cfr. what graphics drivers do when the device has been bound to 
   by
   vesafb or simplefb.
  
   Could this be implemented in a generic way in the spi or DT code?
  
   ...
   On 23.04.2015, at 12:36, Mark Brown broo...@kernel.org wrote:
   On Thu, Apr 23, 2015 at 09:45:16AM +0200, Geert Uytterhoeven wrote:
  
   I guess this has been suggested before: the spi core could provide 
   spidev
   access to all spi client devices which are not bound by a driver?
  
   I don't know if it's been suggested before, certainly nobody did the
   work to make it happen.  I don't think I have a massive objection in
   principal.
 
  Actually, I did it a year ago, and it looked at the time that it
  wasn't what should be done either.
 
 There is nothing like unclaimed device. Either there is a device and
 driver for it may in principle be loaded later as a module or the chip
 select is reserved for use from userspace.

I never said it was perfect.

 Userspace driver is valid option and should have the ability to have
 the chip select reserved.

Whether an userspace driver is a valid option can spawn a whole debate
by its own, but it's true that we should be able to have it exported
to the userspace.

However, having a spidev compatible is not the solution to that
problem.

  https://lkml.org/lkml/2014/4/28/612
 
  But how do you know there is a device?
 
  Devices on i2c can be probed. On spi you just transfer random data and
  hope it does something useful. Some devices have readable registers
  and can be probed in a device-specific way but others are write-only.
 
  Well, what's the point of communicating with a non-existent device in
  the first place?
 
 I have multitude of SPI devices which are not part of the board and
 hence its DT and can be connected to the board with jumper wires.
 
 Most of them don't have a linux driver or compatible to bind with.

Then create such a compatible...

  So binding spidev is in my view just saying that you are going to
  transfer random data from userspace on this bus.
 
  Yes, to a device connected on that bus.
 
 Yes, so I have this red rectangular PCB, blue PCB, and red square PCB
 and blue very thin rectangular PCB.
 
 Please enlighten me how to add DT bindings for these and the PCB which
 is in the mail and I did not pick up at the post office yet.
 
 Of course, I have some hope that the chips on the PCBs are at least
 somewhat compatible with what I ordered but I cannot be sure until I
 test that.

Come on, this is pure bad faith. If you don't even know what that
device is, how do you even know how to interact with it?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-26 Thread Steven Rostedt
On Sun, 26 Apr 2015 17:52:16 +0800
pang.xun...@zte.com.cn wrote:
 
 The problem I tried to describe here is:
 
 We know, there are two main queues each cpu for RT scheduler: 
 run queue and pushable queue.
  
 For RT tasks, the scheduler uses plist to manage the pushable queue,
 so when there are multiple tasks queued at the same priority, they get 
 queued in the FIFO order.
 
 Currently, when an rt task gets queued, it is put to the head or the
 tail of its run queue according to different scenarios. Then if it 
 is migratable, it will also and always be put to the tail of its 
 pushable queue.
 
 For one cpu, assuming initially it has multiple migratable tasks queued 
 at the same priority as current(RT) in run queue and pushable queue 
 both in the same order. At some time, when current gets preempted, it 
 will be put behind these tasks in the pushable queue, while it still 
 stays ahead of these tasks in the run queue. Afterwards, if there comes 
 a pull from other cpu or a push from local cpu, the task behind current 
 in the run queue will be pulled from the pushable queue and gets 
 running.
 
 Obviously, to maintain the same order between the two queues, when current 
 
 is preempted(not involving re-queue in the run queue), we want to put it 
 
 ahead of all those tasks queued at the same priority in the pushable 
 queue.
 
 -Xunlei


I think what Xunlei is trying to say, is that we don't currently keep
FIFO when preemption or migration is involved. If a task is currently
running, strict FIFO denotes that it should run ahead of all other
tasks queued at its priority or less until it decides to schedule out.
But the issue is, if it gets preempted or migrates, it gets placed
behind other tasks of the same priority as itself, but it never
voluntarily relinquished the CPU.

Thus, if it gets preempted by a higher priority task, it should at a
minimum be placed ahead of all other tasks of its priority or less to
run on the CPU again. If it gets migrated to another CPU, it should at
least be placed ahead of other tasks on that new CPU of the same
priority. Although, for the migration case, I'm not sure why it would
be migrated to a CPU where it couldn't run right away in the first
place, as the push/pull logic only migrates RT tasks that can run on
the new CPU. Unless, he's talking about a race where a new task just
got scheduled before it made it to the CPU? But that's a separate issue.

But at least for being preempted by a higher priority task, it should
be placed back ahead of the currently running tasks, unless it did a
yield or is RR and its time ran out.

I'm not sure why your solution with yield_task_rt() and task_tick_rt()
doesn't work. Maybe Xunlei is looking too deep into the solution.
Monday, I'll try to spend some time looking at the scheduler logic
there.

-- Steve
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys

2015-04-26 Thread Aleksa Sarai
Hey,

static struct cftype cgroup_dfl_base_files[];
   +#define for_each_subsys_which(ss_mask, ss, ssid) \
   + for_each_subsys((ss), (ssid)) \
   + if ((ss_mask)  (1  (ssid)))
 
  Maybe using for_each_set_bit() is better?
 
  #define for_each_subsys_which(ss_mask, ss, ssid)\
  for_each_set_bit(ssid, (ss_mask), CGROUP_SUBSYS_COUNT) \
  if ((ss) = group_subsys[ssid]  false) \
  ;   \
  else

 Clever that ;-)

 Thanks.  It kinda bothers me that for_each_set_bit() doesn't collapse
 to combo of ffs() + clearing bit off of a temp mask when size is const
 and = ulong, which would be quite a bit lighter.  Right now it'd be
 calling into generic find_first/next_bit() functions unconditionally.
 Ah well, it can be optimized later.

This macro causes issues with lines like:
   for_each_subsys_which(ss, ssid, ~cgrp_dfl_root_inhibit_ss_mask)

In addition, there are a bunch of cgroup_* functions that use unsigned
ints for bitops (cgroup_calc_child_subsys_mask, rebind_subsystems,
cgroup_print_ss_mask). Is there a better solution to this problem, or
should I just switch back to my naive solution?

--
Aleksa Sarai (cyphar)
www.cyphar.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   >