[PATCH 2/2] ARM: at91/dt: use "atmel,sama5d3-nfc" compatible for nfc

2016-05-09 Thread Wenyou Yang
Due to the compatible "atmel,sama5d4-nfc" removal, use
"atmel,sama5d3-nfc" for the sama5d2's nfc node.

Signed-off-by: Wenyou Yang 
---

 arch/arm/boot/dts/sama5d2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 78996bd..9817090 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -280,7 +280,7 @@
status = "disabled";
 
nfc@c000 {
-   compatible = "atmel,sama5d4-nfc";
+   compatible = "atmel,sama5d3-nfc";
#address-cells = <1>;
#size-cells = <1>;
reg = < /* NFC Command Registers */
-- 
2.7.4



Re: [PATCH] gpio: sch: Fix Oops on module load on Asus Eee PC 1201

2016-05-09 Thread Mika Westerberg
On Fri, May 06, 2016 at 10:49:25PM +0100, Colin Pitrat wrote:
> This fixes the issue descirbe in bug 117531. 

Can you include the oops log in the changelog as well?

> It's a regression introduced in linux 4.5 that causes a Oops at load of
> gpio_sch and prevents powering off the computer.
> 
> The patch consist in reverting commit 
> 737c8fccf1c5b2aae3c6d9a66dce17e35fc39b71 
> (a.k.a 'gpio: sch: use gpiochip data pointer') that causes this regression.
> However, although it does work for me, I'm not sure of the impact of reverting
> only this part of the patch.

What happens here is that after the change we expect that
gpiochip_get_data() returns the correct pointer but that only happens
after devm_gpiochip_add_data() is called, which is the last call in
sch_gpio_probe(). Before that we call sch_gpio_reg_set() couple of times
if the device id is PCI_DEVICE_ID_INTEL_SCH_LPC and that causes NULL
pointer dereference.

I think better fix is to make sch_gpio_reg_get() and sch_gpio_reg_set()
take pointer to struct sch_gpio and use that directly like:

static void sch_gpio_reg_set(struct sch_gpio *sch, unsigned gpio,
 unsigned reg, int val)
{
...
}

Neither function actually need gc for anything anyway.


Re: [PATCH 0/6] Intel Secure Guard Extensions

2016-05-09 Thread Greg KH
On Mon, May 09, 2016 at 08:38:25AM +0300, Jarkko Sakkinen wrote:
> On Fri, May 06, 2016 at 01:54:14PM +0200, Thomas Gleixner wrote:
> > On Fri, 6 May 2016, Jarkko Sakkinen wrote:
> > 
> > > On Tue, May 03, 2016 at 04:06:27AM -0500, Dr. Greg Wettstein wrote:
> > > > It would be helpful and instructive for anyone involved in this debate
> > > > to review the following URL which details Intel's SGX licening
> > > > program:
> > > > 
> > > > https://software.intel.com/en-us/articles/intel-sgx-product-licensing
> > > 
> > > I think it would be good  to note that the licensing process is available
> > > only for Windows. For Linux you can only use debug enclaves at the
> > > moment. The default LE has "allow-all" policy for debug enclaves.
> > 
> > Which makes the feature pretty useless.
> >  
> > > > I think the only way forward to make all of this palatable is to
> > > > embrace something similar to what has been done with Secure Boot.  The
> > > > Root Enclave Key will need to be something which can be reconfigured
> > > > by the Platform Owner through BIOS/EFI.  That model would take Intel
> > > > off the hook from a security perspective and establish the notion of
> > > > platform trust to be a bilateral relationship between a service
> > > > provider and client.
> > > 
> > > This concern has been raised many times now. Sadly this did not make
> > > into Skyle but in future we will have one shot MSRs (can be set only
> > > once per boot cycle) for defining your own root of trust.
> > 
> > We'll wait for that to happen.
> 
> I fully understand if you (and others) want to keep this standpoint but
> what if we could get it to staging after I've revised it with suggested
> changes and internal changes in my TODO? Then it would not pollute the
> mainline kernel but still would be easily available for experimentation.

No, staging is not a "dumping ground", it's for code that is not ready
to be merged, and has some work left to do on it and it shows forward
progress on that goal.  I don't put things in there that the maintainers
of the subsystems it affects do not want merged.  See the many previous
examples of code that has been rejected for staging as examples of this.

sorry,

greg k-h


Re: [PATCH] sched: fix the calculation of __sched_period in sched_slice()

2016-05-09 Thread Peter Zijlstra
On Mon, May 09, 2016 at 10:45:57AM +0800, Zhou Chengming wrote:
> When we get the sched_slice of a sched_entity, we use cfs_rq->nr_running
> to calculate the whole __sched_period. But cfs_rq->nr_running is the
> number of sched_entity in that cfs_rq, rq->nr_running is the number
> of all the tasks that are not throttled. So we should use the
> rq->nr_running to calculate the whole __sched_period value.

No, this was very much on purpose.


[RFC PATCH] regulator: introduce boot protection flag

2016-05-09 Thread WEN Pingbo
In some platforms, critical shared regulator is initialized in
bootloader. But during kernel booting, the driver probing order and
conflicting operations from other regulator consumers, may set the
regulator in a undefined state, which will cause serious problem.

This patch try to add a boot_protection flag in regulator constraints.
And regulator core will postpone all operations until all consumers
have taked their place.

The boot_protection flag only work before late_initicall. And as other
constraints liked, you can specify this flag in a board file, or in
dts file.

Signed-off-by: WEN Pingbo 
---
 drivers/regulator/core.c  | 106 +++---
 drivers/regulator/internal.h  |   2 +
 drivers/regulator/of_regulator.c  |   3 ++
 include/linux/regulator/driver.h  |   3 ++
 include/linux/regulator/machine.h |   1 +
 5 files changed, 109 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index fe47d38..f994a0f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -55,6 +55,7 @@ static LIST_HEAD(regulator_map_list);
 static LIST_HEAD(regulator_ena_gpio_list);
 static LIST_HEAD(regulator_supply_alias_list);
 static bool has_full_constraints;
+static bool regulator_has_booted;
 
 static struct dentry *debugfs_root;
 
@@ -1030,6 +1031,13 @@ static int set_machine_constraints(struct regulator_dev 
*rdev,
if (!rdev->constraints)
return -ENOMEM;
 
+   /*
+* If a regulator driver is registered after late_initcall, the
+* boot_protection should be ingnored.
+*/
+   if (regulator_has_booted)
+   rdev->constraints->boot_protection = 0;
+
ret = machine_constraints_voltage(rdev, rdev->constraints);
if (ret != 0)
return ret;
@@ -2195,8 +2203,14 @@ static int _regulator_disable(struct regulator_dev *rdev)
if (rdev->use_count == 1 &&
(rdev->constraints && !rdev->constraints->always_on)) {
 
-   /* we are last user */
-   if (regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) {
+   /*
+* We are last user.
+*
+* If boot_protection is set, we only clear use_count,
+* and regulator_init_complete() will disable it.
+*/
+   if (!rdev->constraints->boot_protection &&
+   regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) {
ret = _notifier_call_chain(rdev,
   REGULATOR_EVENT_PRE_DISABLE,
   NULL);
@@ -2297,6 +2311,10 @@ int regulator_force_disable(struct regulator *regulator)
struct regulator_dev *rdev = regulator->rdev;
int ret;
 
+   WARN(rdev->constraints->boot_protection,
+   "disable regulator %s with boot protection flag\n",
+   rdev->desc->name);
+
mutex_lock(&rdev->mutex);
regulator->uA_load = 0;
ret = _regulator_force_disable(regulator->rdev);
@@ -2852,6 +2870,10 @@ static int regulator_set_voltage_unlocked(struct 
regulator *regulator,
if (ret < 0)
goto out2;
 
+   /* We need to change voltage, but boot_protection is set. */
+   if (rdev->constraints->boot_protection)
+   goto out;
+
if (rdev->supply && (rdev->desc->min_dropout_uV ||
!rdev->desc->ops->get_voltage)) {
int current_supply_uV;
@@ -3069,6 +3091,9 @@ int regulator_sync_voltage(struct regulator *regulator)
if (ret < 0)
goto out;
 
+   if (rdev->constraints->boot_protection)
+   goto out;
+
ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
 
 out:
@@ -3161,6 +3186,15 @@ int regulator_set_current_limit(struct regulator 
*regulator,
if (ret < 0)
goto out;
 
+   /*
+* Stage new current value, and applied it later.
+*/
+   if (rdev->constraints->boot_protection) {
+   regulator->min_uA = min_uA;
+   regulator->max_uA = max_uA;
+   goto out;
+   }
+
ret = rdev->desc->ops->set_current_limit(rdev, min_uA, max_uA);
 out:
mutex_unlock(&rdev->mutex);
@@ -3240,6 +3274,11 @@ int regulator_set_mode(struct regulator *regulator, 
unsigned int mode)
if (ret < 0)
goto out;
 
+   if (rdev->constraints->boot_protection) {
+   rdev->boot_mode = mode;
+   goto out;
+   }
+
ret = rdev->desc->ops->set_mode(rdev, mode);
 out:
mutex_unlock(&rdev->mutex);
@@ -3306,11 +3345,14 @@ EXPORT_SYMBOL_GPL(regulator_get_mode);
 int regulator_set_load(struct regulator *regulator, int uA_load)
 {
struct regulator_dev *rdev = regulator->rdev;
-   int ret;
+   int ret = 0;
 
mutex_lock(&rdev->mutex);
 

Re: [GIT PULL] move ARM LCD display driver to auxdisplay

2016-05-09 Thread Robin van der Gracht
On Fri, 29 Apr 2016 17:53:17 +0300
Tomi Valkeinen  wrote:

[...] 
> >>
> >> Small problem for me, but Robin is submitting a brand new
> >> auxdisplay driver:
> >> http://marc.info/?l=linux-kernel&m=146001950512999&w=2
> >> http://marc.info/?l=linux-kernel&m=146001988013230&w=2  
> > 
> > My understanding is that Tomi doesn't want any new fbdev drivers, so
> > I'm not sure this is the right place for those patches.  
> 
> Hmm, that one looks like an fbdev driver, not an auxdisplay driver.
> But, not relevant for this patch, of course.

If you guys feel like auxdisplay is not the right subsystem for the
driver, and would like me to move it, please share.

Regards,
Robin van der Gracht


Re: [PATCH 3/6] intel_sgx: driver for Intel Secure Guard eXtensions

2016-05-09 Thread Jarkko Sakkinen
On Mon, May 09, 2016 at 08:29:17AM +0300, Jarkko Sakkinen wrote:
> On Fri, Apr 29, 2016 at 03:22:19PM -0700, Jethro Beekman wrote:
> > On 29-04-16 13:04, Jarkko Sakkinen wrote:
> > >>> Why would you want to do that?
> > >>
> > >> ...
> > >
> > > Do you see this as a performance issue or why do you think that this
> > > would hurt that much?
> > 
> > I don't think it's a performance issue at all. I'm just giving an example 
> > of why
> > you'd want to do this. I'm sure people who want to use this instruction set 
> > can
> > come up with other uses, so I think the driver should support it. Other 
> > drivers
> > on different platform might support this, in which case we should be 
> > compatible
> > (to achieve the same enclave measurement). Other Linux drivers support it 
> > [1]. I
> > would ask: why would you not want to do this? It seems trivial to expand the
> > current flag into 16 separate flags; one for each 256-byte chunk in the 
> > page.
> 
> I'm fine with adding a 16-bit bitmask.

I did some experiementation and since this doesn't make the API more
complicated it is probably ok.

Field that I declared was:

  __u16 mrmask;

Measure one page:

  add_page.mrmask = ~0;

Skip the measurement:

  add_page.mrmask = 0:

/Jarkko


[PATCH] x86: text_poke, check if text_mutex is held

2016-05-09 Thread Jiri Slaby
This is required by the function, so use lockdep (if available) to
check the dependency.

Signed-off-by: Jiri Slaby 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: x...@kernel.org
---
 arch/x86/kernel/alternative.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 5cb272a7a5a3..233b718be213 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -694,6 +694,8 @@ void *text_poke(void *addr, const void *opcode, size_t len)
struct page *pages[2];
int i;
 
+   lockdep_assert_held(&text_mutex);
+
if (!core_kernel_text((unsigned long)addr)) {
pages[0] = vmalloc_to_page(addr);
pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
-- 
2.8.2



Re: [PATCH v2 1/2] mm, kasan: improve double-free detection

2016-05-09 Thread Dmitry Vyukov
On Sat, May 7, 2016 at 5:15 PM, Luruo, Kuthonuzo
 wrote:
> Thank you for the review!
>
>> > +
>> > +/* acquire per-object lock for access to KASAN metadata. */
>>
>> I believe there's strong reason not to use standard spin_lock() or
>> similar. I think it's proper place to explain it.
>>
>
> will do.
>
>> > +void kasan_meta_lock(struct kasan_alloc_meta *alloc_info)
>> > +{
>> > +   union kasan_alloc_data old, new;
>> > +
>> > +   preempt_disable();
>>
>> It's better to disable and enable preemption inside the loop
>> on each iteration, to decrease contention.
>>
>
> ok, makes sense; will do.
>
>> > +   for (;;) {
>> > +   old.packed = READ_ONCE(alloc_info->data);
>> > +   if (unlikely(old.lock)) {
>> > +   cpu_relax();
>> > +   continue;
>> > +   }
>> > +   new.packed = old.packed;
>> > +   new.lock = 1;
>> > +   if (likely(cmpxchg(&alloc_info->data, old.packed, new.packed)
>> > +   == old.packed))
>> > +   break;
>> > +   }
>> > +}
>> > +
>> > +/* release lock after a kasan_meta_lock(). */
>> > +void kasan_meta_unlock(struct kasan_alloc_meta *alloc_info)
>> > +{
>> > +   union kasan_alloc_data alloc_data;
>> > +
>> > +   alloc_data.packed = READ_ONCE(alloc_info->data);
>> > +   alloc_data.lock = 0;
>> > +   if (unlikely(xchg(&alloc_info->data, alloc_data.packed) !=
>> > +   (alloc_data.packed | 0x1U)))
>> > +   WARN_ONCE(1, "%s: lock not held!\n", __func__);
>>
>> Nitpick. It never happens in normal case, correct?. Why don't you place it 
>> under
>> some developer config, or even leave at dev branch? The function will
>> be twice shorter without it.
>
> ok, will remove/shorten

My concern here is performance.
We do lock/unlock 3 times per allocated object. Currently that's 6
atomic RMW. The unlock one is not necessary, so that would reduce
number of atomic RMWs to 3.


Re: [PATCH -repost] kgdb: depends on VT

2016-05-09 Thread Jiri Slaby
On 03/31/2016, 02:01 PM, Jason Wessel wrote:
> On 03/31/2016 03:29 AM, Jiri Slaby wrote:
>> With VT=n, the kernel build fails with:
>> drivers/built-in.o: In function `kgdboc_pre_exp_handler':
>> kgdboc.c:(.text+0x7b5aa): undefined reference to `fg_console'
>> kgdboc.c:(.text+0x7b5ce): undefined reference to `vc_cons'
>> kgdboc.c:(.text+0x7b5d5): undefined reference to `vc_cons'
>>
>> kgdboc.o is built when KGDB_SERIAL_CONSOLE is set. So make
>> KGDB_SERIAL_CONSOLE depend on HW_CONSOLE which includes those symbols.
> 
> Acked-by: Jason Wessel 
> 
> 
> I'll put this in the kgdb-next branch and submit it to the upstream,
> unless it gets merged in another queue.

Nobody else seemed to put it in any queue. And since it haven't appeared
in -next, it seems neither you did?

thanks,
-- 
js
suse labs


Re: [PATCH 1/4] locking/rwsem: Avoid stale ->count for rwsem_down_write_failed()

2016-05-09 Thread Peter Zijlstra
On Sun, May 08, 2016 at 10:36:21PM -0700, Peter Hurley wrote:
> On 05/08/2016 09:56 PM, Davidlohr Bueso wrote:
> > The field is obviously updated w.o the lock and needs a READ_ONCE
> > while waiting for lock holder(s) to go away, just like we do with
> > all other ->count accesses.
> 
> This isn't actually fixing a bug because it's passed through
> several full barriers which will force reloading from sem->count.
> 
> I think the patch is ok if you want it just for consistency anyway,
> but please change $subject and changelog.

Agreed, and note that the READ_ONCE does prohibit load-tearing, while
the current code does not.

So in that respect the patched code is more strict. But yes, the current
code does not allow using a stale value of sem->count() because, as
PeterH notes, we've just passed through at least the full memory barrier
implied by set_current_state().


[PATCH 7/7] tty: 8250, kill DEBUG_INTR

2016-05-09 Thread Jiri Slaby
Convert DEBUG_INTR to pr_debug:
* defined semantics (DEBUG, DYNAMIC_DEBUG)
* KERN_DEBUG level instead of KERN_DEFAULT
* emit __func__ and \n
* verified 'fmt' even when !DEBUG

I wonder if anybody ever used that or whether we should just drop the
lines.

Signed-off-by: Jiri Slaby 
---
 drivers/tty/serial/8250/8250.h  | 6 --
 drivers/tty/serial/8250/8250_core.c | 4 ++--
 drivers/tty/serial/8250/8250_port.c | 6 +++---
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 563ccbe3612b..31b3d55211d0 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -235,9 +235,3 @@ static inline int serial_index(struct uart_port *port)
 {
return port->minor - 64;
 }
-
-#if 0
-#define DEBUG_INTR(fmt...) printk(fmt)
-#else
-#define DEBUG_INTR(fmt...) do { } while (0)
-#endif
diff --git a/drivers/tty/serial/8250/8250_core.c 
b/drivers/tty/serial/8250/8250_core.c
index e938ac93743a..fa823a54cf35 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -114,7 +114,7 @@ static irqreturn_t serial8250_interrupt(int irq, void 
*dev_id)
struct list_head *l, *end = NULL;
int pass_counter = 0, handled = 0;
 
-   DEBUG_INTR("serial8250_interrupt(%d)...", irq);
+   pr_debug("%s(%d): start\n", __func__, irq);
 
spin_lock(&i->lock);
 
@@ -144,7 +144,7 @@ static irqreturn_t serial8250_interrupt(int irq, void 
*dev_id)
 
spin_unlock(&i->lock);
 
-   DEBUG_INTR("end.\n");
+   pr_debug("%s(%d): end\n", __func__, irq);
 
return IRQ_RETVAL(handled);
 }
diff --git a/drivers/tty/serial/8250/8250_port.c 
b/drivers/tty/serial/8250/8250_port.c
index d4036038a4dd..b10d05f2004b 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1686,7 +1686,7 @@ static void serial8250_read_char(struct uart_8250_port 
*up, unsigned char lsr)
lsr &= port->read_status_mask;
 
if (lsr & UART_LSR_BI) {
-   DEBUG_INTR("handling break");
+   pr_debug("%s: handling break\n", __func__);
flag = TTY_BREAK;
} else if (lsr & UART_LSR_PE)
flag = TTY_PARITY;
@@ -1757,7 +1757,7 @@ void serial8250_tx_chars(struct uart_8250_port *up)
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port);
 
-   DEBUG_INTR("THRE...");
+   pr_debug("%s: THRE\n", __func__);
 
/*
 * With RPM enabled, we have to wait until the FIFO is empty before the
@@ -1823,7 +1823,7 @@ int serial8250_handle_irq(struct uart_port *port, 
unsigned int iir)
 
status = serial_port_in(port, UART_LSR);
 
-   DEBUG_INTR("status = %x...", status);
+   pr_debug("%s: status = %x\n", __func__, status);
 
if (status & (UART_LSR_DR | UART_LSR_BI)) {
if (!up->dma || handle_rx_dma(up, iir))
-- 
2.8.2



[PATCH 6/7] tty: 8250, drop unused members from struct old_serial_port

2016-05-09 Thread Jiri Slaby
hub6 and irqflags from struct old_serial_port are nowhere set. Drop
them from the structure and replace the reads by zeros.

Signed-off-by: Jiri Slaby 
---
 drivers/tty/serial/8250/8250.h  | 2 --
 drivers/tty/serial/8250/8250_core.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 215a99237e95..563ccbe3612b 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -53,11 +53,9 @@ struct old_serial_port {
unsigned int port;
unsigned int irq;
upf_tflags;
-   unsigned char hub6;
unsigned char io_type;
unsigned char __iomem *iomem_base;
unsigned short iomem_reg_shift;
-   unsigned long irqflags;
 };
 
 struct serial8250_config {
diff --git a/drivers/tty/serial/8250/8250_core.c 
b/drivers/tty/serial/8250/8250_core.c
index 0fbd7c033a25..e938ac93743a 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -546,10 +546,10 @@ static void __init serial8250_isa_init_ports(void)
 
port->iobase   = old_serial_port[i].port;
port->irq  = irq_canonicalize(old_serial_port[i].irq);
-   port->irqflags = old_serial_port[i].irqflags;
+   port->irqflags = 0;
port->uartclk  = old_serial_port[i].baud_base * 16;
port->flags= old_serial_port[i].flags;
-   port->hub6 = old_serial_port[i].hub6;
+   port->hub6 = 0;
port->membase  = old_serial_port[i].iomem_base;
port->iotype   = old_serial_port[i].io_type;
port->regshift = old_serial_port[i].iomem_reg_shift;
-- 
2.8.2



[PATCH 1/7] tty: ipwireless, cleanup TIOCGSERIAL

2016-05-09 Thread Jiri Slaby
In ipwireless_get_serial_info, struct serial_struct is memset to 0 and
then some members set to 0 explicitly.

Remove the latter as it is obviously superfluous.

And remove the retinfo check against NULL. copy_to_user will take care
of that.

Part of hub6 cleanup series.

Signed-off-by: Jiri Slaby 
Cc: Jiri Kosina 
Cc: David Sterba 
---
 drivers/tty/ipwireless/tty.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index 345cebb07ae7..2685d59d2724 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -252,20 +252,11 @@ static int ipwireless_get_serial_info(struct ipw_tty *tty,
 {
struct serial_struct tmp;
 
-   if (!retinfo)
-   return (-EFAULT);
-
memset(&tmp, 0, sizeof(tmp));
tmp.type = PORT_UNKNOWN;
tmp.line = tty->index;
-   tmp.port = 0;
-   tmp.irq = 0;
-   tmp.flags = 0;
tmp.baud_base = 115200;
-   tmp.close_delay = 0;
-   tmp.closing_wait = 0;
-   tmp.custom_divisor = 0;
-   tmp.hub6 = 0;
+
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
 
-- 
2.8.2



[PATCH 5/7] tty: stop defining STD_COM_FLAGS in drivers

2016-05-09 Thread Jiri Slaby
STD_COM_FLAGS is mostly a bad name for what the drivers thinks it is.
Stop using it and pass the flags directly.

cyclades defines it as 0, so we do not assign anything to freshly
tty_port_init'ed structure.

Signed-off-by: Jiri Slaby 
---
 arch/xtensa/platforms/xt2000/setup.c | 1 -
 drivers/tty/cyclades.c   | 3 ---
 drivers/tty/serial/m32r_sio.c| 5 +
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/xtensa/platforms/xt2000/setup.c 
b/arch/xtensa/platforms/xt2000/setup.c
index 5f4bd71971d6..4904c5c16918 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -113,7 +113,6 @@ void platform_heartbeat(void)
 }
 
 //#define RS_TABLE_SIZE 2
-//#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF|UPF_SKIP_TEST)
 
 #define _SERIAL_PORT(_base,_irq)   \
 {  \
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 7251430bf149..5d535cb902dc 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -93,8 +93,6 @@ static void cy_send_xchar(struct tty_struct *tty, char ch);
 #defineSERIAL_XMIT_SIZE(min(PAGE_SIZE, 4096))
 #endif
 
-#define STD_COM_FLAGS (0)
-
 /* firmware stuff */
 #define ZL_MAX_BLOCKS  16
 #define DRIVER_VERSION 0x02010203
@@ -3083,7 +3081,6 @@ static int cy_init_card(struct cyclades_card *cinfo)
 
info->port.closing_wait = CLOSING_WAIT_DELAY;
info->port.close_delay = 5 * HZ / 10;
-   info->port.flags = STD_COM_FLAGS;
init_completion(&info->shutdown_wait);
 
if (cy_is_Z(cinfo)) {
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index 68765f7c2645..1b01504cf306 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -51,9 +51,6 @@
 
 #define PASS_LIMIT 256
 
-/* Standard COM flags */
-#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
-
 static const struct {
unsigned int port;
unsigned int irq;
@@ -892,7 +889,7 @@ static void __init m32r_sio_init_ports(void)
up->port.iobase   = old_serial_port[i].port;
up->port.irq  = irq_canonicalize(old_serial_port[i].irq);
up->port.uartclk  = BAUD_RATE * 16;
-   up->port.flags= STD_COM_FLAGS;
+   up->port.flags= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
up->port.membase  = 0;
up->port.iotype   = 0;
up->port.regshift = 0;
-- 
2.8.2



[PATCH 3/7] tty: cyclades+mxser, do not initialize to zero

2016-05-09 Thread Jiri Slaby
Do not initialize members of initialized structures to zero. They are
zeroed automatically.

Part of hub6 cleanup series.

Signed-off-by: Jiri Slaby 
---
 drivers/tty/cyclades.c | 1 -
 drivers/tty/mxser.c| 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 2943d6ff54df..7251430bf149 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -2288,7 +2288,6 @@ static int cy_get_serial_info(struct cyclades_port *info,
.closing_wait = info->port.closing_wait,
.baud_base = info->baud,
.custom_divisor = info->custom_divisor,
-   .hub6 = 0,  /*!!! */
};
return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
 }
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index ebb8c0034101..2ff280d8045a 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1219,7 +1219,6 @@ static int mxser_get_serial_info(struct tty_struct *tty,
.close_delay = info->port.close_delay,
.closing_wait = info->port.closing_wait,
.custom_divisor = info->custom_divisor,
-   .hub6 = 0
};
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
-- 
2.8.2



[PATCH 2/7] net: ircomm, cleanup TIOCGSERIAL

2016-05-09 Thread Jiri Slaby
In ircomm_tty_get_serial_info, struct serial_struct is memset to 0 and
then some members set to 0 explicitly.

Remove the latter as it is obviously superfluous.

And remove the retinfo check against NULL. copy_to_user will take care
of that.

Part of hub6 cleanup series.

Signed-off-by: Jiri Slaby 
Cc: Samuel Ortiz 
Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
---
 net/irda/ircomm/ircomm_tty_ioctl.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c 
b/net/irda/ircomm/ircomm_tty_ioctl.c
index 17c49bf26313..0985588c9dec 100644
--- a/net/irda/ircomm/ircomm_tty_ioctl.c
+++ b/net/irda/ircomm/ircomm_tty_ioctl.c
@@ -246,9 +246,6 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb 
*self,
 {
struct serial_struct info;
 
-   if (!retinfo)
-   return -EFAULT;
-
memset(&info, 0, sizeof(info));
info.line = self->line;
info.flags = self->port.flags;
@@ -258,11 +255,6 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb 
*self,
 
/* For compatibility  */
info.type = PORT_16550A;
-   info.port = 0;
-   info.irq = 0;
-   info.xmit_fifo_size = 0;
-   info.hub6 = 0;
-   info.custom_divisor = 0;
 
if (copy_to_user(retinfo, &info, sizeof(*retinfo)))
return -EFAULT;
-- 
2.8.2



[PATCH 4/7] tty: frv, remove unused serial macros

2016-05-09 Thread Jiri Slaby
STD_COM_FLAGS needs not be defined as it is not used anywhere on frv.

SERIAL_PORT_DFNS is defined to be empty. 8250 is aware of empty
SERIAL_PORT_DFNS and does:
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif

So no need to define it on frv.

Signed-off-by: Jiri Slaby 
Cc: David Howells 
---
 arch/frv/include/asm/serial.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/frv/include/asm/serial.h b/arch/frv/include/asm/serial.h
index bce0d0d07e60..614c6d76789a 100644
--- a/arch/frv/include/asm/serial.h
+++ b/arch/frv/include/asm/serial.h
@@ -12,7 +12,3 @@
  * the base baud is derived from the clock speed and so is variable
  */
 #define BASE_BAUD 0
-
-#define STD_COM_FLAGS  UPF_BOOT_AUTOCONF
-
-#define SERIAL_PORT_DFNS
-- 
2.8.2



[PATCH v2] debugobjects: insulate non-fixup logic related to static obj from fixup callbacks

2016-05-09 Thread changbin . du
From: "Du, Changbin" 

When activate a static object, we need make sure that the object is
tracked in the object tracker. If it is a non-static object, then
the activation illegal.

In previous implementation, each subsystem need take care of this in
their fixup callbacks. Actually we can put it into debugobjects core.
Thus we can save duplicated code, and have *pure* fixup callbacks.

To achieve this, a new callback "is_static_object" is introduced to
let the type specific code decide whether a object is static or not.
If yes, we take it into object tracker, otherwise give warning and
invoke fixup callback.

This change has paassed debugobjects selftest, and I also do some test
with all debugobjects supports enabled.

At last, I have a concern about the fixups that can it change the
object which is in incorrect state on fixup? Because the 'addr' may
not point to any valid object if a non-static object is not tracked.
Then Change such object can overwrite someone's memory and cause
unexpected behaviour. For example, the timer_fixup_activate bind
timer to function stub_timer.

Signed-off-by: "Du, Changbin" 
---
This patch depends on patch set:
[PATCH 0/7] Make debugobjects fixup functions return bool type

v2:
  improve code comments where invoke the new is_static_object callback

---
 include/linux/debugobjects.h |  2 ++
 kernel/rcu/update.c  | 26 +++
 kernel/time/hrtimer.c|  7 +--
 kernel/time/timer.c  | 43 +-
 kernel/workqueue.c   | 42 -
 lib/debugobjects.c   | 49 +---
 6 files changed, 60 insertions(+), 109 deletions(-)

diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index a899f10..46056cb 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -38,6 +38,7 @@ struct debug_obj {
  * @name:  name of the object typee
  * @debug_hint:function returning address, which have 
associated
  * kernel symbol, to allow identify the object
+ * @is_static_object   return true if the obj is static, otherwise return false
  * @fixup_init:fixup function, which is called when the init 
check
  * fails. All fixup functions must return true if fixup
  * was successful, otherwise return false
@@ -53,6 +54,7 @@ struct debug_obj {
 struct debug_obj_descr {
const char  *name;
void *(*debug_hint)(void *addr);
+   bool (*is_static_object)(void *addr);
bool (*fixup_init)(void *addr, enum debug_obj_state state);
bool (*fixup_activate)(void *addr, enum debug_obj_state state);
bool (*fixup_destroy)(void *addr, enum debug_obj_state state);
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index a2897d7..f0d8322 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -380,29 +380,9 @@ void destroy_rcu_head(struct rcu_head *head)
debug_object_free(head, &rcuhead_debug_descr);
 }
 
-/*
- * fixup_activate is called when:
- * - an active object is activated
- * - an unknown object is activated (might be a statically initialized object)
- * Activation is performed internally by call_rcu().
- */
-static bool rcuhead_fixup_activate(void *addr, enum debug_obj_state state)
+static bool rcuhead_is_static_object(void *addr)
 {
-   struct rcu_head *head = addr;
-
-   switch (state) {
-
-   case ODEBUG_STATE_NOTAVAILABLE:
-   /*
-* This is not really a fixup. We just make sure that it is
-* tracked in the object tracker.
-*/
-   debug_object_init(head, &rcuhead_debug_descr);
-   debug_object_activate(head, &rcuhead_debug_descr);
-   return false;
-   default:
-   return true;
-   }
+   return true;
 }
 
 /**
@@ -440,7 +420,7 @@ EXPORT_SYMBOL_GPL(destroy_rcu_head_on_stack);
 
 struct debug_obj_descr rcuhead_debug_descr = {
.name = "rcu_head",
-   .fixup_activate = rcuhead_fixup_activate,
+   .is_static_object = rcuhead_is_static_object,
 };
 EXPORT_SYMBOL_GPL(rcuhead_debug_descr);
 #endif /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index f962a58..8c7392c 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -351,16 +351,11 @@ static bool hrtimer_fixup_init(void *addr, enum 
debug_obj_state state)
 /*
  * fixup_activate is called when:
  * - an active object is activated
- * - an unknown object is activated (might be a statically initialized object)
+ * - an unknown non-static object is activated
  */
 static bool hrtimer_fixup_activate(void *addr, enum debug_obj_state state)
 {
switch (state) {
-
-   case ODEBUG_STATE_NOTAVAILABLE:
-   WARN_ON_ONCE(1);
-   return false;
-
case ODEBUG_STATE_ACTI

[PATCH 3.14 12/23] batman-adv: Check skb size before using encapsulated ETH+VLAN header

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Sven Eckelmann 

commit c78296665c3d81f040117432ab9e1cb125521b0c upstream.

The encapsulated ethernet and VLAN header may be outside the received
ethernet frame. Thus the skb buffer size has to be checked before it can be
parsed to find out if it encapsulates another batman-adv packet.

Fixes: 420193573f11 ("batman-adv: softif bridge loop avoidance")
Signed-off-by: Sven Eckelmann 
Signed-off-by: Marek Lindner 
Signed-off-by: Antonio Quartulli 
Signed-off-by: Greg Kroah-Hartman 

---
 net/batman-adv/soft-interface.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -356,11 +356,17 @@ void batadv_interface_rx(struct net_devi
 */
nf_reset(skb);
 
+   if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+   goto dropped;
+
vid = batadv_get_vid(skb, 0);
ethhdr = eth_hdr(skb);
 
switch (ntohs(ethhdr->h_proto)) {
case ETH_P_8021Q:
+   if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+   goto dropped;
+
vhdr = (struct vlan_ethhdr *)skb->data;
 
if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -372,8 +378,6 @@ void batadv_interface_rx(struct net_devi
}
 
/* skb->dev & skb->pkt_type are set here */
-   if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
-   goto dropped;
skb->protocol = eth_type_trans(skb, soft_iface);
 
/* should not be necessary anymore as we use skb_pull_rcsum()




[PATCH 3.14 16/23] x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Chen Yu 

commit 886123fb3a8656699dff40afa0573df359abeb18 upstream.

Currently we read the tsc radio: ratio = (MSR_PLATFORM_INFO >> 8) & 0x1f;

Thus we get bit 8-12 of MSR_PLATFORM_INFO, however according to the SDM
(35.5), the ratio bits are bit 8-15.

Ignoring the upper bits can result in an incorrect tsc ratio, which causes the
TSC calibration and the Local APIC timer frequency to be incorrect.

Fix this problem by masking 0xff instead.

[ tglx: Massaged changelog ]

Fixes: 7da7c1561366 "x86, tsc: Add static (MSR) TSC calibration on Intel Atom 
SoCs"
Signed-off-by: Chen Yu 
Cc: "Rafael J. Wysocki" 
Cc: Bin Gao 
Cc: Len Brown 
Link: 
http://lkml.kernel.org/r/1462505619-5516-1-git-send-email-yu.c.c...@intel.com
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/tsc_msr.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void
 
if (freq_desc_tables[cpu_index].msr_plat) {
rdmsr(MSR_PLATFORM_INFO, lo, hi);
-   ratio = (lo >> 8) & 0x1f;
+   ratio = (lo >> 8) & 0xff;
} else {
rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
ratio = (hi >> 8) & 0x1f;




[PATCH 3.14 14/23] batman-adv: Reduce refcnt of removed router when updating route

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Sven Eckelmann 

commit d1a65f1741bfd9c69f9e4e2ad447a89b6810427d upstream.

_batadv_update_route rcu_derefences orig_ifinfo->router outside of a
spinlock protected region to print some information messages to the debug
log. But this pointer is not checked again when the new pointer is assigned
in the spinlock protected region. Thus is can happen that the value of
orig_ifinfo->router changed in the meantime and thus the reference counter
of the wrong router gets reduced after the spinlock protected region.

Just rcu_dereferencing the value of orig_ifinfo->router inside the spinlock
protected region (which also set the new pointer) is enough to get the
correct old router object.

Fixes: e1a5382f978b ("batman-adv: Make orig_node->router an rcu protected 
pointer")
Signed-off-by: Sven Eckelmann 
Signed-off-by: Marek Lindner 
Signed-off-by: Antonio Quartulli 
Signed-off-by: Greg Kroah-Hartman 

---
 net/batman-adv/routing.c |9 +
 1 file changed, 9 insertions(+)

--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -88,6 +88,15 @@ static void _batadv_update_route(struct
neigh_node = NULL;
 
spin_lock_bh(&orig_node->neigh_list_lock);
+   /* curr_router used earlier may not be the current orig_ifinfo->router
+* anymore because it was dereferenced outside of the neigh_list_lock
+* protected region. After the new best neighbor has replace the current
+* best neighbor the reference counter needs to decrease. Consequently,
+* the code needs to ensure the curr_router variable contains a pointer
+* to the replaced best neighbor.
+*/
+   curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+
rcu_assign_pointer(orig_ifinfo->router, neigh_node);
spin_unlock_bh(&orig_node->neigh_list_lock);
batadv_orig_ifinfo_free_ref(orig_ifinfo);




[PATCH 3.14 00/23] 3.14.69-stable review

2016-05-09 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.69 release.
There are 23 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 Wed May 11 07:16:11 UTC 2016.
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.x/stable-review/patch-3.14.69-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 3.14.69-rc1

Anton Blanchard 
powerpc: scan_features() updates incorrect bits for REAL_LE

Andrey Gelman 
Input: ads7846 - correct the value got from SPI

Krzysztof Kozlowski 
iio: ak8975: Fix NULL pointer exception on early interrupt

Jasem Mutlaq 
USB: serial: cp210x: add Straizona Focusers device ids

Mike Manning 
USB: serial: cp210x: add ID for Link ECU

Prarit Bhargava 
ACPICA: Dispatcher: Update thread ID for recursive method calls

Wang YanQing 
x86/sysfb_efi: Fix valid BAR address range check

Chen Yu 
x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO

Matt Fleming 
MAINTAINERS: Remove asterisk from EFI directory names

Sven Eckelmann 
batman-adv: Reduce refcnt of removed router when updating route

Linus Lüssing 
batman-adv: Fix broadcast/ogm queue limit on a removed interface

Sven Eckelmann 
batman-adv: Check skb size before using encapsulated ETH+VLAN header

Mathias Krause 
proc: prevent accessing /proc//environ until it's ready

Knut Wohlrab 
Input: zforce_ts - fix dual touch recognition

Sascha Hauer 
ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel

Chunyu Hu 
tracing: Don't display trigger file for events that can't be enabled

Arnd Bergmann 
lpfc: fix misleading indentation

Linus Walleij 
clk: versatile: sp810: support reentrance

Dan Streetman 
nbd: ratelimit error msgs after socket close

Marco Angaroni 
ipvs: correct initial offset of Call-ID header search in SIP persistence 
engine

Behan Webster 
x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id"

Paolo Bonzini 
compiler-gcc: disable -ftracer for __noclone functions

Joe Perches 
compiler-gcc: integrate the various compiler-gcc[345].h files


-

Diffstat:

 MAINTAINERS  |   4 +-
 Makefile |   4 +-
 arch/arm/mach-socfpga/headsmp.S  |   1 +
 arch/powerpc/include/uapi/asm/cputable.h |   1 +
 arch/powerpc/kernel/prom.c   |   2 +-
 arch/x86/kernel/sysfb_efi.c  |  14 +++-
 arch/x86/kernel/tsc_msr.c|   2 +-
 drivers/acpi/acpica/dsmethod.c   |   3 +
 drivers/block/nbd.c  |   4 +-
 drivers/clk/versatile/clk-sp810.c|   4 +-
 drivers/iio/magnetometer/ak8975.c|   4 +-
 drivers/input/touchscreen/ads7846.c  |   8 ++-
 drivers/input/touchscreen/zforce_ts.c|   4 +-
 drivers/scsi/lpfc/lpfc_init.c|   5 +-
 drivers/usb/serial/cp210x.c  |   4 ++
 fs/proc/base.c   |   3 +-
 include/linux/compiler-gcc.h | 120 +--
 include/linux/compiler-gcc3.h|  23 --
 include/linux/compiler-gcc4.h|  88 ---
 include/linux/compiler-gcc5.h|  66 -
 include/linux/mod_devicetable.h  |   8 +++
 kernel/trace/trace_events.c  |   9 ++-
 net/batman-adv/routing.c |   9 +++
 net/batman-adv/send.c|   6 ++
 net/batman-adv/soft-interface.c  |   8 ++-
 net/netfilter/ipvs/ip_vs_pe_sip.c|   2 +-
 26 files changed, 200 insertions(+), 206 deletions(-)




[PATCH 3.14 10/23] Input: zforce_ts - fix dual touch recognition

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Knut Wohlrab 

commit 6984ab1ab35f422292b7781c65284038bcc0f6a6 upstream.

A wrong decoding of the touch coordinate message causes a wrong touch
ID. Touch ID for dual touch must be 0 or 1.

According to the actual Neonode nine byte touch coordinate coding,
the state is transported in the lower nibble and the touch ID in
the higher nibble of payload byte five.

Signed-off-by: Knut Wohlrab 
Signed-off-by: Oleksij Rempel 
Signed-off-by: Dirk Behme 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/touchscreen/zforce_ts.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -350,8 +350,8 @@ static int zforce_touch_event(struct zfo
point.coord_x = point.coord_y = 0;
}
 
-   point.state = payload[9 * i + 5] & 0x03;
-   point.id = (payload[9 * i + 5] & 0xfc) >> 2;
+   point.state = payload[9 * i + 5] & 0x0f;
+   point.id = (payload[9 * i + 5] & 0xf0) >> 4;
 
/* determine touch major, minor and orientation */
point.area_major = max(payload[9 * i + 6],




[PATCH 3.14 01/23] compiler-gcc: integrate the various compiler-gcc[345].h files

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Joe Perches 

commit f320793e52aee78f0fbb8bcaf10e6614d2e67bfc upstream.

[ Upstream commit cb984d101b30eb7478d32df56a0023e4603cba7f ]

As gcc major version numbers are going to advance rather rapidly in the
future, there's no real value in separate files for each compiler
version.

Deduplicate some of the macros #defined in each file too.

Neaten comments using normal kernel commenting style.

Signed-off-by: Joe Perches 
Cc: Andi Kleen 
Cc: Michal Marek 
Cc: Segher Boessenkool 
Cc: Sasha Levin 
Cc: Anton Blanchard 
Cc: Alan Modra 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/compiler-gcc.h  |  120 --
 include/linux/compiler-gcc3.h |   23 
 include/linux/compiler-gcc4.h |   88 --
 include/linux/compiler-gcc5.h |   66 ---
 4 files changed, 116 insertions(+), 181 deletions(-)

--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -100,10 +100,122 @@
 #define __maybe_unused __attribute__((unused))
 #define __always_unused__attribute__((unused))
 
-#define __gcc_header(x) #x
-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
-#define gcc_header(x) _gcc_header(x)
-#include gcc_header(__GNUC__)
+/* gcc version specific checks */
+
+#if GCC_VERSION < 30200
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
+#if GCC_VERSION < 30300
+# define __used__attribute__((__unused__))
+#else
+# define __used__attribute__((__used__))
+#endif
+
+#ifdef CONFIG_GCOV_KERNEL
+# if GCC_VERSION < 30400
+#   error "GCOV profiling support for gcc versions below 3.4 not included"
+# endif /* __GNUC_MINOR__ */
+#endif /* CONFIG_GCOV_KERNEL */
+
+#if GCC_VERSION >= 30400
+#define __must_check   __attribute__((warn_unused_result))
+#endif
+
+#if GCC_VERSION >= 4
+
+/* GCC 4.1.[01] miscompiles __weak */
+#ifdef __KERNEL__
+# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
+#  error Your version of gcc miscompiles the __weak directive
+# endif
+#endif
+
+#define __used __attribute__((__used__))
+#define __compiler_offsetof(a, b)  \
+   __builtin_offsetof(a, b)
+
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+#endif
+
+#if GCC_VERSION >= 40300
+/* Mark functions as cold. gcc will assume any path leading to a call
+ * to them will be unlikely.  This means a lot of manual unlikely()s
+ * are unnecessary now for any paths leading to the usual suspects
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
+ * older compilers]
+ *
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
+ * in the preprocessor, but we can live with this because they're unreleased.
+ * Maketime probing would be overkill here.
+ *
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
+ * a special section, but I don't see any sense in this right now in
+ * the kernel context
+ */
+#define __cold __attribute__((__cold__))
+
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+
+#ifndef __CHECKER__
+# define __compiletime_warning(message) __attribute__((warning(message)))
+# define __compiletime_error(message) __attribute__((error(message)))
+#endif /* __CHECKER__ */
+#endif /* GCC_VERSION >= 40300 */
+
+#if GCC_VERSION >= 40500
+/*
+ * Mark a position in code as unreachable.  This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ *
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
+ * this in the preprocessor, but we can live with this because they're
+ * unreleased.  Really, we need to have autoconf for the kernel.
+ */
+#define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone  __attribute__((__noclone__))
+
+#endif /* GCC_VERSION >= 40500 */
+
+#if GCC_VERSION >= 40600
+/*
+ * Tell the optimizer that something else uses this function or variable.
+ */
+#define __visible  __attribute__((externally_visible))
+#endif
+
+/*
+ * GCC 'asm goto' miscompiles certain code sequences:
+ *
+ *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+ *
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+ *
+ * (asm goto is automatically volatile - the naming reflects this.)
+ */
+#define asm_volatile_goto(x...)do { asm goto(x); asm (""); } while (0)
+
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+#if GCC_VERSION >= 40400
+#define __HAVE_BUILTIN_BSWAP32__
+#define __HAVE_BUILTIN_BSWAP64__
+#endif
+#if GCC_VERSION >= 40800 || (defin

[PATCH 3.14 09/23] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Sascha Hauer 

commit 5616f36713ea77f57ae908bf2fef641364403c9f upstream.

The secondary CPU starts up in ARM mode. When the kernel is compiled in
thumb2 mode we have to explicitly compile the secondary startup
trampoline in ARM mode, otherwise the CPU will go to Nirvana.

Signed-off-by: Sascha Hauer 
Reported-by: Steffen Trumtrar 
Suggested-by: Ard Biesheuvel 
Signed-off-by: Dinh Nguyen 
Signed-off-by: Kevin Hilman 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mach-socfpga/headsmp.S |1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/mach-socfpga/headsmp.S
+++ b/arch/arm/mach-socfpga/headsmp.S
@@ -11,6 +11,7 @@
 #include 
 
.arch   armv7-a
+   .arm
 
 ENTRY(secondary_trampoline)
movwr2, #:lower16:cpu1start_addr




[PATCH 4.4 02/67] RDMA/iw_cxgb4: Fix bar2 virt addr calculation for T4 chips

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Hariprasad S 

commit 32cc92c7b5e52357a0a24010bae9eb257fa75d3e upstream.

For T4, kernel mode qps don't use the user doorbell. User mode qps during
flow control db ringing are forced into kernel, where user doorbell is
treated as kernel doorbell and proper bar2 offset in bar2 virtual space is
calculated, which incase of T4 is a bogus address, causing a kernel panic
due to illegal write during doorbell ringing.
In case of T4, kernel mode qp bar2 virtual address should be 0. Added T4
check during bar2 virtual address calculation to return 0. Fixed Bar2
range checks based on bar2 physical address.

The below oops will be fixed

  <1>BUG: unable to handle kernel paging request at 0002aa08
  <1>IP: [] c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4>PGD 1416a8067 PUD 15bf35067 PMD 0
  <4>Oops: 0002 [#1] SMP
  <4>last sysfs file:
  /sys/devices/pci:00/:00:03.0/:02:00.4/infiniband/cxgb4_0/node_guid
  <4>CPU 5
  <4>Modules linked in: rdma_ucm rdma_cm ib_cm ib_sa ib_mad ib_uverbs
  ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE
  iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack
  ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables bridge autofs4
  target_core_iblock target_core_file target_core_pscsi target_core_mod
  configfs bnx2fc cnic uio fcoe libfcoe libfc scsi_transport_fc scsi_tgt 8021q
  garp stp llc cpufreq_ondemand acpi_cpufreq freq_table mperf vhost_net macvtap
  macvlan tun kvm uinput microcode iTCO_wdt iTCO_vendor_support sg joydev
  serio_raw i2c_i801 i2c_core lpc_ich mfd_core e1000e ptp pps_core ioatdma dca
  i7core_edac edac_core shpchp ext3 jbd mbcache sd_mod crc_t10dif pata_acpi
  ata_generic ata_piix iw_cxgb4 iw_cm ib_core ib_addr cxgb4 ipv6 dm_mirror
  dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
  <4>
  Supermicro X8ST3/X8ST3
  <4>RIP: 0010:[]  []
  c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4>RSP: :880155a03db0  EFLAGS: 00010006
  <4>RAX: 001d RBX: 88013ae5fc00 RCX: 880155adb180
  <4>RDX: 0002aa00 RSI: 0001 RDI: 88013ae5fdf8
  <4>RBP: 880155a03e10 R08:  R09: 0001
  <4>R10:  R11:  R12: 
  <4>R13: 001d R14: 880156414ab0 R15: e8c05b88
  <4>FS:  () GS:8800282a() 
knlGS:
  <4>CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
  <4>CR2: 0002aa08 CR3: 00015bd0e000 CR4: 07e0
  <4>DR0:  DR1:  DR2: 
  <4>DR3:  DR6: 0ff0 DR7: 0400
  <4>Process cxgb4 (pid: 394, threadinfo 880155a0, task 
880156414ab0)
  <4>Stack:
  <4> 880156415068 880155adb180 880155a03df0 a00a344b
  <4> 03e8 88015592 0004 88015592
  <4> 88015592d438 a00a3860 880155a03fd8 e8c05b88
  <4>Call Trace:
  <4> [] ? enable_txq_db+0x2b/0x80 [cxgb4]
  <4> [] ? process_db_full+0x0/0xa0 [cxgb4]
  <4> [] process_db_full+0x46/0xa0 [cxgb4]
  <4> [] worker_thread+0x170/0x2a0
  <4> [] ? autoremove_wake_function+0x0/0x40
  <4> [] ? worker_thread+0x0/0x2a0
  <4> [] kthread+0x9e/0xc0
  <4> [] child_rip+0xa/0x20
  <4> [] ? kthread+0x0/0xc0
  <4> [] ? child_rip+0x0/0x20
  <4>Code: e9 ba 00 00 00 66 0f 1f 44 00 00 44 8b 05 29 07 02 00 45 85 c0 0f 85
  71 02 00 00 8b 83 70 01 00 00 45 0f b7 ed c1 e0 0f 44 09 e8 <89> 42 08 0f ae 
f8
  66 c7 83 82 01 00 00 00 00 44 0f b7 ab dc 01
  <1>RIP  [] c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4> RSP 
  <4>CR2: 0002aa08`

Based on original work by Bharat Potnuri 

Fixes: 74217d4c6a4fb0d8 ("iw_cxgb4: support for bar2 qid densities exceeding 
the page size")

Signed-off-by: Steve Wise 
Signed-off-by: Hariprasad Shenai 
Reviewed-by: Leon Romanovsky 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/infiniband/hw/cxgb4/cq.c |2 +-
 drivers/infiniband/hw/cxgb4/qp.c |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -162,7 +162,7 @@ static int create_cq(struct c4iw_rdev *r
cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS,
  &cq->bar2_qid,
  user ? &cq->bar2_pa : NULL);
-   if (user && !cq->bar2_va) {
+   if (user && !cq->bar2_pa) {
pr_warn(MOD "%s: cqid %u not in BAR2 range.\n",
pci_name(rdev->lldi.pdev), cq->cqid);
ret = -EINVAL;
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -185,6 +185,10 @@ void __iomem *c4iw_bar2_addrs(struct c4i
 
if (pbar2_pa)
*pbar2_pa = (rdev->bar2_pa + bar2_qoffset) 

[PATCH 4.4 03/67] ipvs: handle ip_vs_fill_iph_skb_off failure

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Arnd Bergmann 

commit 3f20efba41916ee17ce82f0fdd02581ada2872b2 upstream.

ip_vs_fill_iph_skb_off() may not find an IP header, and gcc has
determined that ip_vs_sip_fill_param() then incorrectly accesses
the protocol fields:

net/netfilter/ipvs/ip_vs_pe_sip.c: In function 'ip_vs_sip_fill_param':
net/netfilter/ipvs/ip_vs_pe_sip.c:76:5: error: 'iph.protocol' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  if (iph.protocol != IPPROTO_UDP)
 ^
net/netfilter/ipvs/ip_vs_pe_sip.c:81:10: error: 'iph.len' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  dataoff = iph.len + sizeof(struct udphdr);
  ^

This adds a check for the ip_vs_fill_iph_skb_off() return code
before looking at the ip header data returned from it.

Signed-off-by: Arnd Bergmann 
Fixes: b0e010c527de ("ipvs: replace ip_vs_fill_ip4hdr with 
ip_vs_fill_iph_skb_off")
Acked-by: Julian Anastasov 
Signed-off-by: Simon Horman 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/ipvs/ip_vs_pe_sip.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -70,10 +70,10 @@ ip_vs_sip_fill_param(struct ip_vs_conn_p
const char *dptr;
int retc;
 
-   ip_vs_fill_iph_skb(p->af, skb, false, &iph);
+   retc = ip_vs_fill_iph_skb(p->af, skb, false, &iph);
 
/* Only useful with UDP */
-   if (iph.protocol != IPPROTO_UDP)
+   if (!retc || iph.protocol != IPPROTO_UDP)
return -EINVAL;
/* todo: IPv6 fragments:
 *   I think this only should be done for the first fragment. /HS




[PATCH 4.4 13/67] clk: rockchip: free memory in error cases when registering clock branches

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Shawn Lin 

commit 2467b6745e0ae9c6cdccff24c4cceeb14b1cce3f upstream.

Add free memeory if rockchip_clk_register_branch fails.

Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure...")
Signed-off-by: Shawn Lin 
Signed-off-by: Heiko Stuebner 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/rockchip/clk.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register
if (gate_offset >= 0) {
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
if (!gate)
-   return ERR_PTR(-ENOMEM);
+   goto err_gate;
 
gate->flags = gate_flags;
gate->reg = base + gate_offset;
@@ -82,7 +82,7 @@ static struct clk *rockchip_clk_register
if (div_width > 0) {
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
-   return ERR_PTR(-ENOMEM);
+   goto err_div;
 
div->flags = div_flags;
div->reg = base + muxdiv_offset;
@@ -102,6 +102,11 @@ static struct clk *rockchip_clk_register
 flags);
 
return clk;
+err_div:
+   kfree(gate);
+err_gate:
+   kfree(mux);
+   return ERR_PTR(-ENOMEM);
 }
 
 static struct clk *rockchip_clk_register_frac_branch(const char *name,




[PATCH 4.4 19/67] ath9k: ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Oleksij Rempel 

commit de478a61389cacafe94dc8b035081b681b878f9d upstream.

by moving common code to ar5008_hw_cmn_spur_mitigate i forgot to move
mask_m & mask_p initialisation. This coused a performance regression
on ar9281.

Fixes: f911085ffa88 ("ath9k: split ar5008_hw_spur_mitigate and reuse common 
code in ar9002_hw_spur_mitigate.")
Reported-by: Gustav Frederiksen 
Tested-by: Gustav Frederiksen 
Signed-off-by: Oleksij Rempel 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath9k/ar5008_phy.c |8 +++-
 drivers/net/wireless/ath/ath9k/ar9002_phy.c |5 -
 2 files changed, 3 insertions(+), 10 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct
};
static const int inc[4] = { 0, 100, 0, 0 };
 
+   memset(&mask_m, 0, sizeof(int8_t) * 123);
+   memset(&mask_p, 0, sizeof(int8_t) * 123);
+
cur_bin = -6000;
upper = bin + 100;
lower = bin - 100;
@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(stru
int tmp, new;
int i;
 
-   int8_t mask_m[123];
-   int8_t mask_p[123];
int cur_bb_spur;
bool is2GHz = IS_CHAN_2GHZ(chan);
 
-   memset(&mask_m, 0, sizeof(int8_t) * 123);
-   memset(&mask_p, 0, sizeof(int8_t) * 123);
-
for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
if (AR_NO_SPUR == cur_bb_spur)
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(stru
int i;
struct chan_centers centers;
 
-   int8_t mask_m[123];
-   int8_t mask_p[123];
int cur_bb_spur;
bool is2GHz = IS_CHAN_2GHZ(chan);
 
-   memset(&mask_m, 0, sizeof(int8_t) * 123);
-   memset(&mask_p, 0, sizeof(int8_t) * 123);
-
ath9k_hw_get_channel_centers(ah, chan, ¢ers);
freq = centers.synth_center;
 




[PATCH 4.4 01/67] Revert: "powerpc/tm: Check for already reclaimed tasks"

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

This reverts commit e924c60db1b4891e45d15a33474ac5fab62cf029 which was
commit 7f821fc9c77a9b01fe7b1d6e72717b33d8d64142 upstream.

It shouldn't have been applied as the original was already in 4.4.

Reported-by: Jiri Slaby 
Cc: Michael Neuling 
Cc: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/kernel/process.c |   18 --
 1 file changed, 18 deletions(-)

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




[PATCH 3.14 19/23] USB: serial: cp210x: add ID for Link ECU

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Mike Manning 

commit 1d377f4d690637a0121eac8701f84a0aa1e69a69 upstream.

The Link ECU is an aftermarket ECU computer for vehicles that provides
full tuning abilities as well as datalogging and displaying capabilities
via the USB to Serial adapter built into the device.

Signed-off-by: Mike Manning 
Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/cp210x.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -140,6 +140,8 @@ static const struct usb_device_id id_tab
{ USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */
{ USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem 
*/
{ USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 
100EU */
+   { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */
+   { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
{ USB_DEVICE(0x13AD, 0x) }, /* Baltech card reader */
{ USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
{ USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal 
Automation Controller */




[PATCH 4.4 08/67] ata: ahci_xgene: dereferencing uninitialized pointer in probe

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit 8134233e8d346aaa1c929dc510e75482ae318bce upstream.

If the call to acpi_get_object_info() fails then "info" hasn't been
initialized.  In that situation, we already know that "version" should
be XGENE_AHCI_V1 so we don't actually need to dereference "info".

Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of 
APM X-Gene SoC AHCI SATA Host controller.')
Signed-off-by: Dan Carpenter 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/ata/ahci_xgene.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -739,9 +739,9 @@ static int xgene_ahci_probe(struct platf
dev_warn(&pdev->dev, "%s: Error reading device 
info. Assume version1\n",
__func__);
version = XGENE_AHCI_V1;
-   }
-   if (info->valid & ACPI_VALID_CID)
+   } else if (info->valid & ACPI_VALID_CID) {
version = XGENE_AHCI_V2;
+   }
}
}
 #endif




[PATCH 3.14 22/23] Input: ads7846 - correct the value got from SPI

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Andrey Gelman 

commit 879f2fea8a5a748bcbf98d2cdce9139c045505d3 upstream.

According to the touch controller spec, SPI return a 16 bit value, only 12
bits are valid, they are bit[14-3].

The value of MISO and MOSI can be configured when SPI is in idle mode.
Currently this touch driver assumes the SPI bus sets the MOSI and MISO in
low level when SPI bus is in idle mode. So the bit[15] of the value got
from SPI bus is always 0. But when SPI bus congfigures the MOSI and MISO in
high level during the SPI idle mode, the bit[15] of the value get from SPI
is always 1. If bit[15] is not masked, we may get the wrong value.

Mask the invalid bit to make sure the correct value gets returned.
Regardless of the SPI bus idle configuration.

Signed-off-by: Andrey Gelman 
Signed-off-by: Haibo Chen 
Signed-off-by: Igor Grinberg 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/touchscreen/ads7846.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -668,18 +668,22 @@ static int ads7846_no_filter(void *ads,
 
 static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m)
 {
+   int value;
struct spi_transfer *t =
list_entry(m->transfers.prev, struct spi_transfer, 
transfer_list);
 
if (ts->model == 7845) {
-   return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3;
+   value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1]));
} else {
/*
 * adjust:  on-wire is a must-ignore bit, a BE12 value, then
 * padding; built from two 8 bit values written msb-first.
 */
-   return be16_to_cpup((__be16 *)t->rx_buf) >> 3;
+   value = be16_to_cpup((__be16 *)t->rx_buf);
}
+
+   /* enforce ADC output is 12 bits width */
+   return (value >> 3) & 0xfff;
 }
 
 static void ads7846_update_value(struct spi_message *m, int val)




[PATCH 3.14 04/23] ipvs: correct initial offset of Call-ID header search in SIP persistence engine

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Marco Angaroni 

commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.

The IPVS SIP persistence engine is not able to parse the SIP header
"Call-ID" when such header is inserted in the first positions of
the SIP message.

When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries
in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn

Problematic SIP messages are SIP responses having "Call-ID" header
positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]

When "Call-ID" header is positioned down (after a few other headers)
it is correctly recognized.

This is due to the data offset used in get_callid function call inside
ip_vs_pe_sip.c file: since dptr already points to the start of the
SIP message, the value of dataoff should be initially 0.
Otherwise the header is searched starting from some bytes after the
first character of the SIP message.

Fixes: 758ff0338722 ("IPVS: sip persistence engine")
Signed-off-by: Marco Angaroni 
Acked-by: Julian Anastasov 
Signed-off-by: Simon Horman 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/ipvs/ip_vs_pe_sip.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_p
dptr = skb->data + dataoff;
datalen = skb->len - dataoff;
 
-   if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
+   if (get_callid(dptr, 0, datalen, &matchoff, &matchlen))
return -EINVAL;
 
/* N.B: pe_data is only set on success,




[PATCH 4.4 18/67] lpfc: fix misleading indentation

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Arnd Bergmann 

commit aeb6641f8ebdd61939f462a8255b316f9bfab707 upstream.

gcc-6 complains about the indentation of the lpfc_destroy_vport_work_array()
call in lpfc_online(), which clearly doesn't look right:

drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_online':
drivers/scsi/lpfc/lpfc_init.c:2880:3: warning: statement is indented as if it 
were guarded by... [-Wmisleading-indentation]
   lpfc_destroy_vport_work_array(phba, vports);
   ^
drivers/scsi/lpfc/lpfc_init.c:2863:2: note: ...this 'if' clause, but it is not
  if (vports != NULL)
  ^~

Looking at the patch that introduced this code, it's clear that the
behavior is correct and the indentation is wrong.

This fixes the indentation and adds curly braces around the previous
if() block for clarity, as that is most likely what caused the code
to be misindented in the first place.

Signed-off-by: Arnd Bergmann 
Fixes: 549e55cd2a1b ("[SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list")
Reviewed-by: Sebastian Herbszt 
Reviewed-by: Hannes Reinecke 
Reviewed-by: Ewan D. Milne 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/scsi/lpfc/lpfc_init.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2855,7 +2855,7 @@ lpfc_online(struct lpfc_hba *phba)
}
 
vports = lpfc_create_vport_work_array(phba);
-   if (vports != NULL)
+   if (vports != NULL) {
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
struct Scsi_Host *shost;
shost = lpfc_shost_from_vport(vports[i]);
@@ -2872,7 +2872,8 @@ lpfc_online(struct lpfc_hba *phba)
}
spin_unlock_irq(shost->host_lock);
}
-   lpfc_destroy_vport_work_array(phba, vports);
+   }
+   lpfc_destroy_vport_work_array(phba, vports);
 
lpfc_unblock_mgmt_io(phba);
return 0;




[PATCH 4.4 43/67] fs/pnode.c: treat zero mnt_group_id-s as unequal

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Maxim Patlasov 

commit 7ae8fd0351f912b075149a1e03a017be8b903b9a upstream.

propagate_one(m) calculates "type" argument for copy_tree() like this:

>if (m->mnt_group_id == last_dest->mnt_group_id) {
>type = CL_MAKE_SHARED;
>} else {
>type = CL_SLAVE;
>if (IS_MNT_SHARED(m))
>   type |= CL_MAKE_SHARED;
>   }

The "type" argument then governs clone_mnt() behavior with respect to flags
and mnt_master of new mount. When we iterate through a slave group, it is
possible that both current "m" and "last_dest" are not shared (although,
both are slaves, i.e. have non-NULL mnt_master-s). Then the comparison
above erroneously makes new mount shared and sets its mnt_master to
last_source->mnt_master. The patch fixes the problem by handling zero
mnt_group_id-s as though they are unequal.

The similar problem exists in the implementation of "else" clause above
when we have to ascend upward in the master/slave tree by calling:

>last_source = last_source->mnt_master;
>last_dest = last_source->mnt_parent;

proper number of times. The last step is governed by
"n->mnt_group_id != last_dest->mnt_group_id" condition that may lie if
both are zero. The patch fixes this case in the same way as the former one.

[AV: don't open-code an obvious helper...]

Signed-off-by: Maxim Patlasov 
Signed-off-by: Al Viro 
Cc: Seth Forshee 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/pnode.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -202,6 +202,11 @@ static struct mount *last_dest, *last_so
 static struct mountpoint *mp;
 static struct hlist_head *list;
 
+static inline bool peers(struct mount *m1, struct mount *m2)
+{
+   return m1->mnt_group_id == m2->mnt_group_id && m1->mnt_group_id;
+}
+
 static int propagate_one(struct mount *m)
 {
struct mount *child;
@@ -212,7 +217,7 @@ static int propagate_one(struct mount *m
/* skip if mountpoint isn't covered by it */
if (!is_subdir(mp->m_dentry, m->mnt.mnt_root))
return 0;
-   if (m->mnt_group_id == last_dest->mnt_group_id) {
+   if (peers(m, last_dest)) {
type = CL_MAKE_SHARED;
} else {
struct mount *n, *p;
@@ -223,7 +228,7 @@ static int propagate_one(struct mount *m
last_source = last_source->mnt_master;
last_dest = last_source->mnt_parent;
}
-   if (n->mnt_group_id != last_dest->mnt_group_id) 
{
+   if (!peers(n, last_dest)) {
last_source = last_source->mnt_master;
last_dest = last_source->mnt_parent;
}




[PATCH 4.4 21/67] tracing: Dont display trigger file for events that cant be enabled

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Chunyu Hu 

commit 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd upstream.

Currently register functions for events will be called
through the 'reg' field of event class directly without
any check when seting up triggers.

Triggers for events that don't support register through
debug fs (events under events/ftrace are for trace-cmd to
read event format, and most of them don't have a register
function except events/ftrace/functionx) can't be enabled
at all, and an oops will be hit when setting up trigger
for those events, so just not creating them is an easy way
to avoid the oops.

Link: http://lkml.kernel.org/r/1462275274-3911-1-git-send-email-ch...@redhat.com

Fixes: 85f2b08268c01 ("tracing: Add basic event trigger framework")
Signed-off-by: Chunyu Hu 
Signed-off-by: Steven Rostedt 
Signed-off-by: Greg Kroah-Hartman 

---
 kernel/trace/trace_events.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2107,8 +2107,13 @@ event_create_dir(struct dentry *parent,
trace_create_file("filter", 0644, file->dir, file,
  &ftrace_event_filter_fops);
 
-   trace_create_file("trigger", 0644, file->dir, file,
- &event_trigger_fops);
+   /*
+* Only event directories that can be enabled should have
+* triggers.
+*/
+   if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
+   trace_create_file("trigger", 0644, file->dir, file,
+ &event_trigger_fops);
 
trace_create_file("format", 0444, file->dir, call,
  &ftrace_event_format_fops);




[PATCH 4.4 04/67] ipvs: correct initial offset of Call-ID header search in SIP persistence engine

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Marco Angaroni 

commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.

The IPVS SIP persistence engine is not able to parse the SIP header
"Call-ID" when such header is inserted in the first positions of
the SIP message.

When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries
in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn

Problematic SIP messages are SIP responses having "Call-ID" header
positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]

When "Call-ID" header is positioned down (after a few other headers)
it is correctly recognized.

This is due to the data offset used in get_callid function call inside
ip_vs_pe_sip.c file: since dptr already points to the start of the
SIP message, the value of dataoff should be initially 0.
Otherwise the header is searched starting from some bytes after the
first character of the SIP message.

Fixes: 758ff0338722 ("IPVS: sip persistence engine")
Signed-off-by: Marco Angaroni 
Acked-by: Julian Anastasov 
Signed-off-by: Simon Horman 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/ipvs/ip_vs_pe_sip.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_p
dptr = skb->data + dataoff;
datalen = skb->len - dataoff;
 
-   if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
+   if (get_callid(dptr, 0, datalen, &matchoff, &matchlen))
return -EINVAL;
 
/* N.B: pe_data is only set on success,




[PATCH 4.4 16/67] clk: versatile: sp810: support reentrance

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Walleij 

commit ec7957a6aa0aaf981fb8356dc47a2cdd01cde03c upstream.

Despite care take to allocate clocks state containers the
SP810 driver actually just supports creating one instance:
all clocks registered for every instance will end up with the
exact same name and __clk_init() will fail.

Rename the timclken<0> .. timclken to sp810__
so every clock on every instance gets a unique name.

This is necessary for the RealView PBA8 which has two SP810
blocks: the second block will not register its clocks unless
every clock on every instance is unique and results in boot
logs like this:

[ cut here ]
WARNING: CPU: 0 PID: 0 at ../drivers/clk/versatile/clk-sp810.c:137
  clk_sp810_of_setup+0x110/0x154()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.5.0-rc2-00030-g352718fc39f6-dirty #225
Hardware name: ARM RealView Machine (Device Tree Support)
[] (unwind_backtrace) from []
 (show_stack+0x10/0x14)
[] (show_stack) from []
 (dump_stack+0x84/0x9c)
[] (dump_stack) from []
 (warn_slowpath_common+0x74/0xb0)
[] (warn_slowpath_common) from []
 (warn_slowpath_null+0x1c/0x24)
[] (warn_slowpath_null) from []
 (clk_sp810_of_setup+0x110/0x154)
[] (clk_sp810_of_setup) from []
 (of_clk_init+0x12c/0x1c8)
[] (of_clk_init) from []
 (time_init+0x20/0x2c)
[] (time_init) from []
 (start_kernel+0x244/0x3c4)
[] (start_kernel) from [<7000807c>] (0x7000807c)
---[ end trace cb88537fdc8fa200 ]---

Cc: Michael Turquette 
Cc: Pawel Moll 
Fixes: 6e973d2c4385 "clk: vexpress: Add separate SP810 driver"
Signed-off-by: Linus Walleij 
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/versatile/clk-sp810.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -92,6 +92,7 @@ static void __init clk_sp810_of_setup(st
int num = ARRAY_SIZE(parent_names);
char name[12];
struct clk_init_data init;
+   static int instance;
int i;
bool deprecated;
 
@@ -118,7 +119,7 @@ static void __init clk_sp810_of_setup(st
deprecated = !of_find_property(node, "assigned-clock-parents", NULL);
 
for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
-   snprintf(name, ARRAY_SIZE(name), "timerclken%d", i);
+   snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);
 
sp810->timerclken[i].sp810 = sp810;
sp810->timerclken[i].channel = i;
@@ -139,5 +140,6 @@ static void __init clk_sp810_of_setup(st
}
 
of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810);
+   instance++;
 }
 CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup);




[PATCH 4.4 00/67] 4.4.10-stable review

2016-05-09 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.10 release.
There are 67 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 Wed May 11 07:18:08 UTC 2016.
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/v4.x/stable-review/patch-4.4.10-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.4.10-rc1

Mat Martineau 
drm/i915/skl: Fix DMC load on Skylake J0 and K0

Vitaly Kuznetsov 
lib/test-string_helpers.c: fix and improve string_get_size() tests

Srinivas Pandruvada 
ACPI / processor: Request native thermal interrupt handling via _OSC

Shashank Sharma 
drm/i915: Fake HDMI live status

Ville Syrjälä 
drm/i915: Make RPS EI/thresholds multiple of 25 on SNB-BDW

Mika Kahola 
drm/i915: Fix eDP low vswing for Broadwell

Imre Deak 
drm/i915/ddi: Fix eDP VDD handling during booting and suspend/resume

Alex Deucher 
drm/radeon: make sure vertical front porch is at least 1

Richard Leitner 
iio: ak8975: fix maybe-uninitialized warning

Krzysztof Kozlowski 
iio: ak8975: Fix NULL pointer exception on early interrupt

Dave Airlie 
drm/amdgpu: set metadata pointer to NULL after freeing.

Alex Deucher 
drm/amdgpu: make sure vertical front porch is at least 1

Philipp Zabel 
gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading

Stanislav Meduna 
nvmem: mxs-ocotp: fix buffer overflow in read

Jasem Mutlaq 
USB: serial: cp210x: add Straizona Focusers device ids

Mike Manning 
USB: serial: cp210x: add ID for Link ECU

Srinivas Kandagatla 
ata: ahci-platform: Add ports-implemented DT bindings.

Srinivas Kandagatla 
libahci: save port map for forced port map

Anton Blanchard 
powerpc: Fix bad inline asm constraint in create_zero_mask()

Prarit Bhargava 
ACPICA: Dispatcher: Update thread ID for recursive method calls

Wang YanQing 
x86/sysfb_efi: Fix valid BAR address range check

Vineet Gupta 
ARC: Add missing io barriers to io{read,write}{16,32}be()

James Morse 
ARM: cpuidle: Pass on arm_cpuidle_suspend()'s return value

Eric W. Biederman 
propogate_mnt: Handle the first propogated copy being a slave

Maxim Patlasov 
fs/pnode.c: treat zero mnt_group_id-s as unequal

Chen Yu 
x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO

Matt Fleming 
MAINTAINERS: Remove asterisk from EFI directory names

Howard Cochran 
writeback: Fix performance regression in wb_over_bg_thresh()

Sven Eckelmann 
batman-adv: Reduce refcnt of removed router when updating route

Linus Lüssing 
batman-adv: Fix broadcast/ogm queue limit on a removed interface

Sven Eckelmann 
batman-adv: Check skb size before using encapsulated ETH+VLAN header

Antonio Quartulli 
batman-adv: fix DAT candidate selection (must use vid)

Jason Baron 
mm: update min_free_kbytes from khugepaged after core initialization

Mathias Krause 
proc: prevent accessing /proc//environ until it's ready

Knut Wohlrab 
Input: zforce_ts - fix dual touch recognition

Nazar Mokrynskyi 
HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk

Ping Cheng 
HID: wacom: Add support for DTK-1651

Jan Beulich 
xen/evtchn: fix ring resize when binding new events

Ross Lagerwall 
xen/balloon: Fix crash when ballooning on x86 32 bit PAE

Ross Lagerwall 
xen: Fix page <-> pfn conversion on 32 bit systems

Sascha Hauer 
ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel

Krzysztof Kozlowski 
ARM: EXYNOS: Properly skip unitialized parent clock in power domain on

Dan Streetman 
mm/zswap: provide unique zpool name

Hugh Dickins 
mm, cma: prevent nr_isolated_* counters from going negative

Linus Torvalds 
Minimal fix-up of bad hashing behavior of hash_64()

Shaohua Li 
MD: make bio mergeable

Chunyu Hu 
tracing: Don't display trigger file for events that can't be enabled

Johannes Berg 
mac80211: fix statistics leak if dev_alloc_name() fails

Oleksij Rempel 
ath9k: ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p 
initialisation

Arnd Bergmann 
lpfc: fix misleading indentation

Stephen Boyd 
clk: qcom: msm8960: Fix ce3_src register offset

Linus Walleij 
clk: versatile: sp810: support reentrance

Srinivas Kandagatla 
clk: qcom: msm8960: fix ce3_core clk enable register

Andreas Färber 
clk: meson: Fix meson_clk_register_clks() signature type mismatch

Shawn Lin 
clk: rockchip: free memory in error cases when registering clock branches

Shawn Lin 
soc: rockchip: power-domain: fix err handle while probing

Heiko Stuebner 
clk-divider: make sure read-only dividers do not write to their register

Krzysztof Halasa 
CNS3xxx: Fix PCI cns3xxx_write_config()

Amitkuma

[PATCH 3.14 21/23] iio: ak8975: Fix NULL pointer exception on early interrupt

2016-05-09 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Krzysztof Kozlowski 

commit 07d2390e36ee5b3265e9cc8305f2a106c8721e16 upstream.

In certain probe conditions the interrupt came right after registering
the handler causing a NULL pointer exception because of uninitialized
waitqueue:

$ udevadm trigger
i2c-gpio i2c-gpio-1: using pins 143 (SDA) and 144 (SCL)
i2c-gpio i2c-gpio-3: using pins 53 (SDA) and 52 (SCL)
Unable to handle kernel NULL pointer dereference at virtual address 
pgd = e8b38000
[] *pgd=
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in: snd_soc_i2s(+) i2c_gpio(+) snd_soc_idma snd_soc_s3c_dma 
snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer snd soundcore ac97_bus 
spi_s3c64xx pwm_samsung dwc2 exynos_adc phy_exynos_usb2 exynosdrm exynos_rng 
rng_core rtc_s3c
CPU: 0 PID: 717 Comm: data-provider-m Not tainted 
4.6.0-rc1-next-20160401-00011-g1b8d87473b9e-dirty #101
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
(...)
(__wake_up_common) from [] (__wake_up+0x38/0x4c)
(__wake_up) from [] (ak8975_irq_handler+0x28/0x30)
(ak8975_irq_handler) from [] (handle_irq_event_percpu+0x88/0x140)
(handle_irq_event_percpu) from [] (handle_irq_event+0x44/0x68)
(handle_irq_event) from [] (handle_edge_irq+0xf0/0x19c)
(handle_edge_irq) from [] (generic_handle_irq+0x24/0x34)
(generic_handle_irq) from [] (exynos_eint_gpio_irq+0x50/0x68)
(exynos_eint_gpio_irq) from [] (handle_irq_event_percpu+0x88/0x140)
(handle_irq_event_percpu) from [] (handle_irq_event+0x44/0x68)
(handle_irq_event) from [] (handle_fasteoi_irq+0xb4/0x194)
(handle_fasteoi_irq) from [] (generic_handle_irq+0x24/0x34)
(generic_handle_irq) from [] (__handle_domain_irq+0x5c/0xb4)
(__handle_domain_irq) from [] (gic_handle_irq+0x54/0x94)
(gic_handle_irq) from [] (__irq_usr+0x50/0x80)

The bug was reproduced on exynos4412-trats2 (with a max77693 device also
using i2c-gpio) after building max77693 as a module.

Fixes: 94a6d5cf7caa ("iio:ak8975 Implement data ready interrupt handling")
Signed-off-by: Krzysztof Kozlowski 
Tested-by: Gregor Boirie 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iio/magnetometer/ak8975.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -151,6 +151,8 @@ static int ak8975_setup_irq(struct ak897
int rc;
int irq;
 
+   init_waitqueue_head(&data->data_ready_queue);
+   clear_bit(0, &data->flags);
if (client->irq)
irq = client->irq;
else
@@ -166,8 +168,6 @@ static int ak8975_setup_irq(struct ak897
return rc;
}
 
-   init_waitqueue_head(&data->data_ready_queue);
-   clear_bit(0, &data->flags);
data->eoc_irq = irq;
 
return rc;




[PATCH 4.4 46/67] ARC: Add missing io barriers to io{read,write}{16,32}be()

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Vineet Gupta 

commit e5bc0478ab6cf565619224536d75ecb2aedca43b upstream.

While reviewing a different change to asm-generic/io.h Arnd spotted that
ARC ioread32 and ioread32be both of which come from asm-generic versions
are not symmetrical in terms of calling the io barriers.

generic ioread32   -> ARC readl()  [ has barriers]
generic ioread32be -> __be32_to_cpu(__raw_readl()) [ lacks barriers]

While generic ioread32be is being remediated to call readl(), that involves
a swab32(), causing double swaps on ioread32be() on Big Endian systems.

So provide our versions of big endian IO accessors to ensure io barrier
calls while also keeping them optimal

Suggested-by: Arnd Bergmann 
Acked-by: Arnd Bergmann 
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arc/include/asm/io.h |   27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -13,6 +13,15 @@
 #include 
 #include 
 
+#ifdef CONFIG_ISA_ARCV2
+#include 
+#define __iormb()  rmb()
+#define __iowmb()  wmb()
+#else
+#define __iormb()  do { } while (0)
+#define __iowmb()  do { } while (0)
+#endif
+
 extern void __iomem *ioremap(unsigned long physaddr, unsigned long size);
 extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
  unsigned long flags);
@@ -22,6 +31,15 @@ extern void iounmap(const void __iomem *
 #define ioremap_wc(phy, sz)ioremap(phy, sz)
 #define ioremap_wt(phy, sz)ioremap(phy, sz)
 
+/*
+ * io{read,write}{16,32}be() macros
+ */
+#define ioread16be(p)  ({ u16 __v = be16_to_cpu((__force 
__be16)__raw_readw(p)); __iormb(); __v; })
+#define ioread32be(p)  ({ u32 __v = be32_to_cpu((__force 
__be32)__raw_readl(p)); __iormb(); __v; })
+
+#define iowrite16be(v,p)   ({ __iowmb(); __raw_writew((__force 
u16)cpu_to_be16(v), p); })
+#define iowrite32be(v,p)   ({ __iowmb(); __raw_writel((__force 
u32)cpu_to_be32(v), p); })
+
 /* Change struct page to physical address */
 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
 
@@ -99,15 +117,6 @@ static inline void __raw_writel(u32 w, v
 
 }
 
-#ifdef CONFIG_ISA_ARCV2
-#include 
-#define __iormb()  rmb()
-#define __iowmb()  wmb()
-#else
-#define __iormb()  do { } while (0)
-#define __iowmb()  do { } while (0)
-#endif
-
 /*
  * MMIO can also get buffered/optimized in micro-arch, so barriers needed
  * Based on ARM model for the typical use case




[PATCH 4.4 11/67] clk-divider: make sure read-only dividers do not write to their register

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Heiko Stuebner 

commit 50359819794b4a16ae35051cd80f2dab025f6019 upstream.

Commit e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1") removed
the special ops struct for read-only clocks and instead opted to handle
them inside the regular ops.

On the rk3368 this results in breakage as aclkm now gets set a value.
While it is the same divider value, the A53 core still doesn't like it,
which can result in the cpu ending up in a hang.
The reason being that "ACLKENMasserts one clock cycle before the rising
edge of ACLKM" and the clock should only be touched when STANDBYWFIL2
is asserted.

To fix this, reintroduce the read-only ops but do include the round_rate
callback. That way no writes that may be unsafe are done to the divider
register in any case.

The Rockchip use of the clk_divider_ops is adapted to this split again,
as is the nxp, lpc18xx-ccu driver that was included since the original
commit. On lpc18xx-ccu the divider seems to always be read-only
so only uses the new ops now.

Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Reported-by: Zhang Qing 
Signed-off-by: Heiko Stuebner 
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/clk-divider.c |   11 ++-
 drivers/clk/nxp/clk-lpc18xx-ccu.c |2 +-
 drivers/clk/rockchip/clk.c|4 +++-
 include/linux/clk-provider.h  |1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -422,6 +422,12 @@ const struct clk_ops clk_divider_ops = {
 };
 EXPORT_SYMBOL_GPL(clk_divider_ops);
 
+const struct clk_ops clk_divider_ro_ops = {
+   .recalc_rate = clk_divider_recalc_rate,
+   .round_rate = clk_divider_round_rate,
+};
+EXPORT_SYMBOL_GPL(clk_divider_ro_ops);
+
 static struct clk *_register_divider(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
void __iomem *reg, u8 shift, u8 width,
@@ -445,7 +451,10 @@ static struct clk *_register_divider(str
return ERR_PTR(-ENOMEM);
 
init.name = name;
-   init.ops = &clk_divider_ops;
+   if (clk_divider_flags & CLK_DIVIDER_READ_ONLY)
+   init.ops = &clk_divider_ro_ops;
+   else
+   init.ops = &clk_divider_ops;
init.flags = flags | CLK_IS_BASIC;
init.parent_names = (parent_name ? &parent_name: NULL);
init.num_parents = (parent_name ? 1 : 0);
--- a/drivers/clk/nxp/clk-lpc18xx-ccu.c
+++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c
@@ -222,7 +222,7 @@ static void lpc18xx_ccu_register_branch_
div->width = 1;
 
div_hw = &div->hw;
-   div_ops = &clk_divider_ops;
+   div_ops = &clk_divider_ro_ops;
}
 
branch->gate.reg = branch->offset + reg_base;
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register
div->width = div_width;
div->lock = lock;
div->table = div_table;
-   div_ops = &clk_divider_ops;
+   div_ops = (div_flags & CLK_DIVIDER_READ_ONLY)
+   ? &clk_divider_ro_ops
+   : &clk_divider_ops;
}
 
clk = clk_register_composite(NULL, name, parent_names, num_parents,
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -384,6 +384,7 @@ struct clk_divider {
 #define CLK_DIVIDER_MAX_AT_ZEROBIT(6)
 
 extern const struct clk_ops clk_divider_ops;
+extern const struct clk_ops clk_divider_ro_ops;
 
 unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
unsigned int val, const struct clk_div_table *table,




[PATCH 4.4 48/67] ACPICA: Dispatcher: Update thread ID for recursive method calls

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Prarit Bhargava 

commit 93d68841a23a5779cef6fb9aa0ef32e7c5bd00da upstream.

ACPICA commit 7a3bd2d962f221809f25ddb826c9e551b916eb25

Set the mutex owner thread ID.
Original patch from: Prarit Bhargava 

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115121
Link: https://github.com/acpica/acpica/commit/7a3bd2d9
Signed-off-by: Prarit Bhargava 
Tested-by: Andy Lutomirski  # On a Dell XPS 13 9350
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/acpi/acpica/dsmethod.c |3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -417,6 +417,9 @@ acpi_ds_begin_method_execution(struct ac
obj_desc->method.mutex->mutex.
original_sync_level =
obj_desc->method.mutex->mutex.sync_level;
+
+   obj_desc->method.mutex->mutex.thread_id =
+   acpi_os_get_thread_id();
}
}
 




[PATCH 4.4 30/67] xen/evtchn: fix ring resize when binding new events

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Jan Beulich 

commit 27e0e6385377c4dc68a4ddaf1a35a2dfa951f3c5 upstream.

The copying of ring data was wrong for two cases: For a full ring
nothing got copied at all (as in that case the canonicalized producer
and consumer indexes are identical). And in case one or both of the
canonicalized (after the resize) indexes would point into the second
half of the buffer, the copied data ended up in the wrong (free) part
of the new buffer. In both cases uninitialized data would get passed
back to the caller.

Fix this by simply copying the old ring contents twice: Once to the
low half of the new buffer, and a second time to the high half.

This addresses the inability to boot a HVM guest with 64 or more
vCPUs.  This regression was caused by 8620015499101090 (xen/evtchn:
dynamically grow pending event channel ring).

Reported-by: Konrad Rzeszutek Wilk 
Signed-off-by: Jan Beulich 
Signed-off-by: David Vrabel 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/xen/evtchn.c |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per
 {
unsigned int new_size;
evtchn_port_t *new_ring, *old_ring;
-   unsigned int p, c;
 
/*
 * Ensure the ring is large enough to capture all possible
@@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per
/*
 * Copy the old ring contents to the new ring.
 *
-* If the ring contents crosses the end of the current ring,
-* it needs to be copied in two chunks.
+* To take care of wrapping, a full ring, and the new index
+* pointing into the second half, simply copy the old contents
+* twice.
 *
 * +-++--+
-* |34567  12| -> |   1234567|
-* +-p-c-++--+
+* |34567  12| -> |34567  1234567  12|
+* +-p-c-++---c--p---+
 */
-   p = evtchn_ring_offset(u, u->ring_prod);
-   c = evtchn_ring_offset(u, u->ring_cons);
-   if (p < c) {
-   memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * 
sizeof(*u->ring));
-   memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring));
-   } else
-   memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring));
+   memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring));
+   memcpy(new_ring + u->ring_size, old_ring,
+  u->ring_size * sizeof(*u->ring));
 
u->ring = new_ring;
u->ring_size = new_size;




[PATCH 4.5 12/88] ata: ahci_xgene: dereferencing uninitialized pointer in probe

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter 

commit 8134233e8d346aaa1c929dc510e75482ae318bce upstream.

If the call to acpi_get_object_info() fails then "info" hasn't been
initialized.  In that situation, we already know that "version" should
be XGENE_AHCI_V1 so we don't actually need to dereference "info".

Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of 
APM X-Gene SoC AHCI SATA Host controller.')
Signed-off-by: Dan Carpenter 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/ata/ahci_xgene.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -821,9 +821,9 @@ static int xgene_ahci_probe(struct platf
dev_warn(&pdev->dev, "%s: Error reading device 
info. Assume version1\n",
__func__);
version = XGENE_AHCI_V1;
-   }
-   if (info->valid & ACPI_VALID_CID)
+   } else if (info->valid & ACPI_VALID_CID) {
version = XGENE_AHCI_V2;
+   }
}
}
 #endif




[PATCH 4.4 49/67] powerpc: Fix bad inline asm constraint in create_zero_mask()

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Anton Blanchard 

commit b4c112114aab9aff5ed4568ca5e662bb02cdfe74 upstream.

In create_zero_mask() we have:

addi%1,%2,-1
andc%1,%1,%2
popcntd %0,%1

using the "r" constraint for %2. r0 is a valid register in the "r" set,
but addi X,r0,X turns it into an li:

li  r7,-1
andcr7,r7,r0
popcntd r4,r7

Fix this by using the "b" constraint, for which r0 is not a valid
register.

This was found with a kernel build using gcc trunk, narrowed down to
when -frename-registers was enabled at -O2. It is just luck however
that we aren't seeing this on older toolchains.

Thanks to Segher for working with me to find this issue.

Fixes: d0cebfa650a0 ("powerpc: word-at-a-time optimization for 64-bit Little 
Endian")
Signed-off-by: Anton Blanchard 
Signed-off-by: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/include/asm/word-at-a-time.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -82,7 +82,7 @@ static inline unsigned long create_zero_
"andc   %1,%1,%2\n\t"
"popcntd%0,%1"
: "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask)
-   : "r" (bits));
+   : "b" (bits));
 
return leading_zero_bits;
 }




[PATCH 4.4 28/67] xen: Fix page <-> pfn conversion on 32 bit systems

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Ross Lagerwall 

commit 60901df3aed230d4565dca003f11b6a95fbf30d9 upstream.

Commit 1084b1988d22dc165c9dbbc2b0e057f9248ac4db (xen: Add Xen specific
page definition) caused a regression in 4.4.

The xen functions to convert between pages and pfns fail due to an
overflow on systems where a physical address may not fit in an
unsigned long (e.g. x86 32 bit PAE systems). Rework the conversion to
avoid overflow. This should also result in simpler object code.

This bug manifested itself as disk corruption with Linux 4.4 when
using blkfront in a Xen HVM x86 32 bit guest with more than 4 GiB of
memory.

Signed-off-by: Ross Lagerwall 
Signed-off-by: David Vrabel 
Signed-off-by: Greg Kroah-Hartman 

---
 include/xen/page.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -15,9 +15,9 @@
  */
 
 #define xen_pfn_to_page(xen_pfn)   \
-   ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> 
PAGE_SHIFT)))
+   (pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT)))
 #define page_to_xen_pfn(page)  \
-   (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT)
+   ((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT))
 
 #define XEN_PFN_PER_PAGE   (PAGE_SIZE / XEN_PAGE_SIZE)
 




[PATCH 4.5 01/88] clocksource/drivers/tango-xtal: Fix boot hang due to incorrect test

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Daniel Lezcano 

commit 16eeed7e5558a3dcf30f75526a896b2632f299f9 upstream.

Commit 0881841f7e78 introduced a regression by inverting a test check
after calling clocksource_mmio_init(). That results on the system to
hang at boot time.

Fix it by inverting the test again.

Fixes: 0881841f7e78 ("Replace code by clocksource_mmio_init")
Reported-by: Marc Gonzalez 
Signed-off-by: Daniel Lezcano 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clocksource/tango_xtal.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/clocksource/tango_xtal.c
+++ b/drivers/clocksource/tango_xtal.c
@@ -42,7 +42,7 @@ static void __init tango_clocksource_ini
 
ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350,
32, clocksource_mmio_readl_up);
-   if (!ret) {
+   if (ret) {
pr_err("%s: registration failed\n", np->full_name);
return;
}




[PATCH 4.5 11/88] null_blk: add lightnvm null_blk device to the nullb_list

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Wenwei Tao 

commit 3681c85dffda70e551dead31c8d102bd69033fe8 upstream.

After register null_blk devices into lightnvm, we forget
to add these devices to the the nullb_list, makes them
invisible to the null_blk driver.

Signed-off-by: Wenwei Tao 
Fixes: a514379b0c77 ("null_blk: oops when initializing without lightnvm")
Signed-off-by: Jens Axboe 
Signed-off-by: Greg Kroah-Hartman 

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

--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -742,10 +742,11 @@ static int null_add_dev(void)
 
add_disk(disk);
 
+done:
mutex_lock(&lock);
list_add_tail(&nullb->list, &nullb_list);
mutex_unlock(&lock);
-done:
+
return 0;
 
 out_cleanup_lightnvm:




[PATCH 4.5 14/88] ath10k: fix pktlog in QCA99X0

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Ashok Raj Nagarajan 

commit 53a5c9bc53ce51f65699a43c67ab167436d28083 upstream.

Currently, we are providing wrong payload data of pktlog to trace points.
Data we receive from FW through copy engine 8 contains pktlog data alone.
We don't need to parse anything in driver before handing it to trace
points.

Fixes: afb0bf7f530b ("ath10k: add support for pktlog in QCA99X0")
Signed-off-by: Ashok Raj Nagarajan 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ath/ath10k/htt_rx.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2143,11 +2143,7 @@ EXPORT_SYMBOL(ath10k_htt_t2h_msg_handler
 void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
 struct sk_buff *skb)
 {
-   struct ath10k_pktlog_10_4_hdr *hdr =
-   (struct ath10k_pktlog_10_4_hdr *)skb->data;
-
-   trace_ath10k_htt_pktlog(ar, hdr->payload,
-   sizeof(*hdr) + __le16_to_cpu(hdr->size));
+   trace_ath10k_htt_pktlog(ar, skb->data, skb->len);
dev_kfree_skb_any(skb);
 }
 EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);




[PATCH 4.4 52/67] USB: serial: cp210x: add ID for Link ECU

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Mike Manning 

commit 1d377f4d690637a0121eac8701f84a0aa1e69a69 upstream.

The Link ECU is an aftermarket ECU computer for vehicles that provides
full tuning abilities as well as datalogging and displaying capabilities
via the USB to Serial adapter built into the device.

Signed-off-by: Mike Manning 
Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/cp210x.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -140,6 +140,8 @@ static const struct usb_device_id id_tab
{ USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */
{ USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem 
*/
{ USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 
100EU */
+   { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */
+   { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
{ USB_DEVICE(0x13AD, 0x) }, /* Baltech card reader */
{ USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
{ USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal 
Automation Controller */




[PATCH v2] TTY: serial, handle platform_get_irq retval properly

2016-05-09 Thread Jiri Slaby
platform_get_irq can fail, so we should handle negative value when
returned.

[v2]

platform_get_irq can actually return zero on some platforms. So do not
remove checks for irq == 0 there.

Signed-off-by: Jiri Slaby 
Cc: Russell King 
Cc: "Uwe Kleine-König" 
Cc: Russell King 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Michael Ellerman 
Cc: Laxman Dewangan 
Cc: Stephen Warren 
Cc: Thierry Reding 
Cc: Alexandre Courbot 
Cc: linux-ser...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-te...@vger.kernel.org
---
 drivers/tty/serial/amba-pl011.c   | 8 +++-
 drivers/tty/serial/fsl_lpuart.c   | 8 +++-
 drivers/tty/serial/pmac_zilog.c   | 2 +-
 drivers/tty/serial/serial-tegra.c | 7 ++-
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index a2aa655f56c4..c70bb41800f1 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2553,11 +2553,17 @@ static int sbsa_uart_probe(struct platform_device *pdev)
if (!uap)
return -ENOMEM;
 
+   ret = platform_get_irq(pdev, 0);
+   if (ret < 0) {
+   dev_err(&pdev->dev, "cannot obtain irq\n");
+   return ret;
+   }
+   uap->port.irq   = ret;
+
uap->reg_offset = vendor_sbsa.reg_offset;
uap->vendor = &vendor_sbsa;
uap->fifosize   = 32;
uap->port.iotype = vendor_sbsa.access_32b ? UPIO_MEM32 : UPIO_MEM;
-   uap->port.irq   = platform_get_irq(pdev, 0);
uap->port.ops   = &sbsa_uart_pops;
uap->fixed_baud = baudrate;
 
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 3d790033744e..7f95f782a485 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1830,7 +1830,13 @@ static int lpuart_probe(struct platform_device *pdev)
sport->port.dev = &pdev->dev;
sport->port.type = PORT_LPUART;
sport->port.iotype = UPIO_MEM;
-   sport->port.irq = platform_get_irq(pdev, 0);
+   ret = platform_get_irq(pdev, 0);
+   if (ret < 0) {
+   dev_err(&pdev->dev, "cannot obtain irq\n");
+   return ret;
+   }
+   sport->port.irq = ret;
+
if (sport->lpuart32)
sport->port.ops = &lpuart32_pops;
else
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index e156e39d620c..b24b0556f5a8 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1720,7 +1720,7 @@ static int __init pmz_init_port(struct uart_pmac_port 
*uap)
 
r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(uap->pdev, 0);
-   if (!r_ports || !irq)
+   if (!r_ports || irq <= 0)
return -ENODEV;
 
uap->port.mapbase  = r_ports->start;
diff --git a/drivers/tty/serial/serial-tegra.c 
b/drivers/tty/serial/serial-tegra.c
index bee1e5867426..4c4674b51db9 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1310,7 +1310,12 @@ static int tegra_uart_probe(struct platform_device *pdev)
}
 
u->iotype = UPIO_MEM32;
-   u->irq = platform_get_irq(pdev, 0);
+   ret = platform_get_irq(pdev, 0);
+   if (ret < 0) {
+   dev_err(&pdev->dev, "Couldn't get IRQ\n");
+   return ret;
+   }
+   u->irq = ret;
u->regshift = 2;
ret = uart_add_one_port(&tegra_uart_driver, u);
if (ret < 0) {
-- 
2.8.2



[PATCH 4.4 31/67] HID: wacom: Add support for DTK-1651

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Ping Cheng 

commit e1123fe975852cc0970b4e53ea65ca917e54c923 upstream.

DTK-1651 is a display pen-only tablet

Signed-off-by: Ping Cheng 
Signed-off-by: Jiri Kosina 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/hid/wacom_wac.c |5 +
 1 file changed, 5 insertions(+)

--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -3449,6 +3449,10 @@ static const struct wacom_features wacom
{ "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
  INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
  .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
+static const struct wacom_features wacom_features_0x343 =
+   { "Wacom DTK1651", 34616, 19559, 1023, 0,
+ DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4,
+ WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
 
 static const struct wacom_features wacom_features_HID_ANY_ID =
{ "Wacom HID", .type = HID_GENERIC };
@@ -3614,6 +3618,7 @@ const struct hid_device_id wacom_ids[] =
{ USB_DEVICE_WACOM(0x33C) },
{ USB_DEVICE_WACOM(0x33D) },
{ USB_DEVICE_WACOM(0x33E) },
+   { USB_DEVICE_WACOM(0x343) },
{ USB_DEVICE_WACOM(0x4001) },
{ USB_DEVICE_WACOM(0x4004) },
{ USB_DEVICE_WACOM(0x5000) },




[PATCH 4.4 36/67] batman-adv: fix DAT candidate selection (must use vid)

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Antonio Quartulli 

commit 2871734e85e920503d49b3a8bc0afbe0773b6036 upstream.

Now that DAT is VLAN aware, it must use the VID when
computing the DHT address of the candidate nodes where
an entry is going to be stored/retrieved.

Fixes: be1db4f6615b ("batman-adv: make the Distributed ARP Table vlan aware")
Signed-off-by: Antonio Quartulli 
[s...@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann 
Signed-off-by: Marek Lindner 
Signed-off-by: Greg Kroah-Hartman 

---
 net/batman-adv/distributed-arp-table.c |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -553,6 +553,7 @@ static void batadv_choose_next_candidate
  * be sent to
  * @bat_priv: the bat priv with all the soft interface information
  * @ip_dst: ipv4 to look up in the DHT
+ * @vid: VLAN identifier
  *
  * An originator O is selected if and only if its DHT_ID value is one of three
  * closest values (from the LEFT, with wrap around if needed) then the hash
@@ -561,7 +562,8 @@ static void batadv_choose_next_candidate
  * Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM.
  */
 static struct batadv_dat_candidate *
-batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
+batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst,
+unsigned short vid)
 {
int select;
batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
@@ -577,7 +579,7 @@ batadv_dat_select_candidates(struct bata
return NULL;
 
dat.ip = ip_dst;
-   dat.vid = 0;
+   dat.vid = vid;
ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
BATADV_DAT_ADDR_MAX);
 
@@ -597,6 +599,7 @@ batadv_dat_select_candidates(struct bata
  * @bat_priv: the bat priv with all the soft interface information
  * @skb: payload to send
  * @ip: the DHT key
+ * @vid: VLAN identifier
  * @packet_subtype: unicast4addr packet subtype to use
  *
  * This function copies the skb with pskb_copy() and is sent as unicast packet
@@ -607,7 +610,7 @@ batadv_dat_select_candidates(struct bata
  */
 static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
 struct sk_buff *skb, __be32 ip,
-int packet_subtype)
+unsigned short vid, int packet_subtype)
 {
int i;
bool ret = false;
@@ -616,7 +619,7 @@ static bool batadv_dat_send_data(struct
struct sk_buff *tmp_skb;
struct batadv_dat_candidate *cand;
 
-   cand = batadv_dat_select_candidates(bat_priv, ip);
+   cand = batadv_dat_select_candidates(bat_priv, ip, vid);
if (!cand)
goto out;
 
@@ -1004,7 +1007,7 @@ bool batadv_dat_snoop_outgoing_arp_reque
ret = true;
} else {
/* Send the request to the DHT */
-   ret = batadv_dat_send_data(bat_priv, skb, ip_dst,
+   ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid,
   BATADV_P_DAT_DHT_GET);
}
 out:
@@ -1132,8 +1135,8 @@ void batadv_dat_snoop_outgoing_arp_reply
/* Send the ARP reply to the candidates for both the IP addresses that
 * the node obtained from the ARP reply
 */
-   batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
-   batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
+   batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT);
+   batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT);
 }
 
 /**




[PATCH 4.4 50/67] libahci: save port map for forced port map

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Srinivas Kandagatla 

commit 2fd0f46cb1b82587c7ae4a616d69057fb9bd0af7 upstream.

In usecases where force_port_map is used saved_port_map is never set,
resulting in not programming the PORTS_IMPL register as part of initial
config. This patch fixes this by setting it to port_map even in case
where force_port_map is used, making it more inline with other parts of
the code.

Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3")
Signed-off-by: Srinivas Kandagatla 
Acked-by: Tejun Heo 
Reviewed-by: Andy Gross 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/ata/libahci.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -467,6 +467,7 @@ void ahci_save_initial_config(struct dev
dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
 port_map, hpriv->force_port_map);
port_map = hpriv->force_port_map;
+   hpriv->saved_port_map = port_map;
}
 
if (hpriv->mask_port_map) {




[PATCH 4.4 54/67] nvmem: mxs-ocotp: fix buffer overflow in read

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Stanislav Meduna 

commit d1306eb675ad7a9a760b6b8e8e189824b8db89e7 upstream.

This patch fixes the issue where the mxs_ocotp_read is reading
the ocotp in reg_size steps but decrements the remaining size
by 1. The number of iterations is thus four times higher,
overwriting the area behind the output buffer.

Fixes: c01e9a11ab6f ("nvmem: add driver for ocotp in i.MX23 and i.MX28")
Tested-by: Stefan Wahren 
Signed-off-by: Stanislav Meduna 
Signed-off-by: Srinivas Kandagatla 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/nvmem/mxs-ocotp.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/nvmem/mxs-ocotp.c
+++ b/drivers/nvmem/mxs-ocotp.c
@@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context,
if (ret)
goto close_banks;
 
-   while (val_size) {
+   while (val_size >= reg_size) {
if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) {
/* fill up non-data register */
*buf = 0;
@@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context,
}
 
buf++;
-   val_size--;
+   val_size -= reg_size;
offset += reg_size;
}
 




[PATCH 4.4 56/67] drm/amdgpu: make sure vertical front porch is at least 1

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher 

commit 0126d4b9a516256f2432ca0dc78ab293a8255378 upstream.

hw doesn't like a 0 value.

Signed-off-by: Alex Deucher 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(
&& (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay 
+ 2;
 
+   /* vertical FP must be at least 1 */
+   if (mode->crtc_vsync_start == mode->crtc_vdisplay)
+   adjusted_mode->crtc_vsync_start++;
+
/* get the native mode for scaling */
if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
amdgpu_panel_mode_fixup(encoder, adjusted_mode);




[PATCH 4.5 15/88] mwifiex: fix corner case association failure

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Amitkumar Karwar 

commit a6139b6271f9f95377fe3486aed6120c9142779b upstream.

This patch corrects the error case in association path by returning
-1. Earlier "media_connected" used to remain on in this error case
causing failure for further association attempts.

Signed-off-by: Amitkumar Karwar 
Fixes: b887664d882ee4 ('mwifiex: channel switch handling for station')
Signed-off-by: Cathy Luo 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -314,6 +314,7 @@ int mwifiex_bss_start(struct mwifiex_pri
mwifiex_dbg(adapter, ERROR,
"Attempt to reconnect on csa closed 
chan(%d)\n",
bss_desc->channel);
+   ret = -1;
goto done;
}
 




[PATCH 4.4 47/67] x86/sysfb_efi: Fix valid BAR address range check

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Wang YanQing 

commit c10fcb14c7afd6688c7b197a814358fecf244222 upstream.

The code for checking whether a BAR address range is valid will break
out of the loop when a start address of 0x0 is encountered.

This behaviour is wrong since by breaking out of the loop we may miss
the BAR that describes the EFI frame buffer in a later iteration.

Because of this bug I can't use video=efifb: boot parameter to get
efifb on my new ThinkPad E550 for my old linux system hard disk with
3.10 kernel. In 3.10, efifb is the only choice due to DRM/I915 not
supporting the GPU.

This patch also add a trivial optimization to break out after we find
the frame buffer address range without testing later BARs.

Signed-off-by: Wang YanQing 
[ Rewrote changelog. ]
Signed-off-by: Matt Fleming 
Reviewed-by: Peter Jones 
Cc: Ard Biesheuvel 
Cc: David Herrmann 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: Tomi Valkeinen 
Cc: linux-...@vger.kernel.org
Link: 
http://lkml.kernel.org/r/1462454061-21561-2-git-send-email-m...@codeblueprint.co.uk
Signed-off-by: Ingo Molnar 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/sysfb_efi.c |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/sysfb_efi.c
+++ b/arch/x86/kernel/sysfb_efi.c
@@ -106,14 +106,24 @@ static int __init efifb_set_system(const
continue;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;
+   unsigned long flags;
+
+   flags = pci_resource_flags(dev, i);
+   if (!(flags & IORESOURCE_MEM))
+   continue;
+
+   if (flags & IORESOURCE_UNSET)
+   continue;
+
+   if (pci_resource_len(dev, i) == 0)
+   continue;
 
start = pci_resource_start(dev, i);
-   if (start == 0)
-   break;
end = pci_resource_end(dev, i);
if (screen_info.lfb_base >= start &&
screen_info.lfb_base < end) {
found_bar = 1;
+   break;
}
}
}




[PATCH 4.4 34/67] proc: prevent accessing /proc//environ until its ready

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Mathias Krause 

commit 8148a73c9901a8794a50f950083c00ccf97d43b3 upstream.

If /proc//environ gets read before the envp[] array is fully set up
in create_{aout,elf,elf_fdpic,flat}_tables(), we might end up trying to
read more bytes than are actually written, as env_start will already be
set but env_end will still be zero, making the range calculation
underflow, allowing to read beyond the end of what has been written.

Fix this as it is done for /proc//cmdline by testing env_end for
zero.  It is, apparently, intentionally set last in create_*_tables().

This bug was found by the PaX size_overflow plugin that detected the
arithmetic underflow of 'this_len = env_end - (env_start + src)' when
env_end is still zero.

The expected consequence is that userland trying to access
/proc//environ of a not yet fully set up process may get
inconsistent data as we're in the middle of copying in the environment
variables.

Fixes: https://forums.grsecurity.net/viewtopic.php?f=3&t=4363
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=116461
Signed-off-by: Mathias Krause 
Cc: Emese Revfy 
Cc: Pax Team 
Cc: Al Viro 
Cc: Mateusz Guzik 
Cc: Alexey Dobriyan 
Cc: Cyrill Gorcunov 
Cc: Jarod Wilson 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/proc/base.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -954,7 +954,8 @@ static ssize_t environ_read(struct file
int ret = 0;
struct mm_struct *mm = file->private_data;
 
-   if (!mm)
+   /* Ensure the process spawned far enough to have an environment. */
+   if (!mm || !mm->env_end)
return 0;
 
page = (char *)__get_free_page(GFP_TEMPORARY);




[PATCH 4.5 13/88] wlcore: fix error handling in wlcore_event_fw_logger

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Andrzej Hajda 

commit 68f37e5d7a2e00306adab033fba6c3042b33e8e1 upstream.

wlcore_read/wlcore_write can return negative values so it should
be assigned to signed variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2120705

Fixes: 3719c17e1816 ("wlcore/wl18xx: fw logger over sdio")
Signed-off-by: Andrzej Hajda 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/ti/wlcore/event.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/ti/wlcore/event.c
+++ b/drivers/net/wireless/ti/wlcore/event.c
@@ -38,7 +38,7 @@
 
 int wlcore_event_fw_logger(struct wl1271 *wl)
 {
-   u32 ret;
+   int ret;
struct fw_logger_information fw_log;
u8  *buffer;
u32 internal_fw_addrbase = WL18XX_DATA_RAM_BASE_ADDRESS;




[PATCH 4.4 53/67] USB: serial: cp210x: add Straizona Focusers device ids

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Jasem Mutlaq 

commit 613ac23a46e10d4d4339febdd534fafadd68e059 upstream.

Adding VID:PID for Straizona Focusers to cp210x driver.

Signed-off-by: Jasem Mutlaq 
Signed-off-by: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/serial/cp210x.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -108,6 +108,7 @@ static const struct usb_device_id id_tab
{ USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., 
Fasttrax GPS demonstration module */
{ USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */
{ USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
+   { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */
{ USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
{ USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
{ USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
@@ -117,6 +118,7 @@ static const struct usb_device_id id_tab
{ USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 
GSM/GPRS Modem */
{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
+   { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
{ USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */




[PATCH 4.4 51/67] ata: ahci-platform: Add ports-implemented DT bindings.

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Srinivas Kandagatla 

commit 17dcc37e3e847bc0e67a5b1ec52471fcc6c18682 upstream.

On some SOCs PORTS_IMPL register value is never programmed by the
firmware and left at zero value. Which means that no sata ports are
available for software. AHCI driver used to cope up with this by
fabricating the port_map if the PORTS_IMPL register is read zero,
but recent patch broke this workaround as zero value was valid for
NVMe disks.

This patch adds ports-implemented DT bindings as workaround for this issue
in a way that DT can can override the PORTS_IMPL register in cases where
the firmware did not program it already.

Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3")
Signed-off-by: Srinivas Kandagatla 
Acked-by: Tejun Heo 
Reviewed-by: Andy Gross 
Signed-off-by: Tejun Heo 
Signed-off-by: Greg Kroah-Hartman 

---
 Documentation/devicetree/bindings/ata/ahci-platform.txt |4 
 drivers/ata/ahci_platform.c |3 +++
 2 files changed, 7 insertions(+)

--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -30,6 +30,10 @@ Optional properties:
 - target-supply : regulator for SATA target power
 - phys  : reference to the SATA PHY node
 - phy-names : must be "sata-phy"
+- ports-implemented : Mask that indicates which ports that the HBA supports
+ are available for software to use. Useful if PORTS_IMPL
+ is not programmed by the BIOS, which is true with
+ some embedded SOC's.
 
 Required properties when using sub-nodes:
 - #address-cells: number of cells to encode an address
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -51,6 +51,9 @@ static int ahci_probe(struct platform_de
if (rc)
return rc;
 
+   of_property_read_u32(dev->of_node,
+"ports-implemented", &hpriv->force_port_map);
+
if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
 




[PATCH 4.4 60/67] drm/radeon: make sure vertical front porch is at least 1

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher 

commit 3104b8128d4d646a574ed9d5b17c7d10752cd70b upstream.

hw doesn't like a 0 value.

Signed-off-by: Alex Deucher 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/radeon/atombios_encoders.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struc
&& (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay 
+ 2;
 
+   /* vertical FP must be at least 1 */
+   if (mode->crtc_vsync_start == mode->crtc_vdisplay)
+   adjusted_mode->crtc_vsync_start++;
+
/* get the native mode for scaling */
if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
radeon_panel_mode_fixup(encoder, adjusted_mode);




[PATCH 4.4 32/67] HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Nazar Mokrynskyi 

commit 567a44ecb44eb2584ddb93e962cfb133ce77e0bb upstream.

Needed for v2 of the device firmware, otherwise kernel will stuck for few
seconds and throw "usb_submit_urb(ctrl) failed: -1" early on system boot.

Signed-off-by: Nazar Mokrynskyi 
Reviewed-by: Benjamin Tissoires 
Signed-off-by: Jiri Kosina 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/hid/hid-ids.h   |1 +
 drivers/hid/usbhid/hid-quirks.c |1 +
 2 files changed, 2 insertions(+)

--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -255,6 +255,7 @@
 #define USB_DEVICE_ID_CORSAIR_K90  0x1b02
 
 #define USB_VENDOR_ID_CREATIVELABS 0x041e
+#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c
 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
 
 #define USB_VENDOR_ID_CVTOUCH  0x1ff7
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -70,6 +70,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, 
HID_QUIRK_NOGET },
{ USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_CHICONY, 
USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
+   { USB_VENDOR_ID_CREATIVELABS, 
USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, 
HID_QUIRK_MULTI_INPUT },
{ USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },




[PATCH 4.4 66/67] lib/test-string_helpers.c: fix and improve string_get_size() tests

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Vitaly Kuznetsov 

commit 72676bb53f33fd0ef3a1484fc1ecfd306dc6ff40 upstream.

Recently added commit 564b026fbd0d ("string_helpers: fix precision loss
for some inputs") fixed precision issues for string_get_size() and broke
tests.

Fix and improve them: test both STRING_UNITS_2 and STRING_UNITS_10 at a
time, better failure reporting, test small an huge values.

Fixes: 564b026fbd0d28e9 ("string_helpers: fix precision loss for some inputs")
Signed-off-by: Vitaly Kuznetsov 
Cc: Andy Shevchenko 
Cc: Rasmus Villemoes 
Cc: James Bottomley 
Cc: James Bottomley 
Cc: "James E.J. Bottomley" 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 lib/test-string_helpers.c |   67 +-
 1 file changed, 49 insertions(+), 18 deletions(-)

--- a/lib/test-string_helpers.c
+++ b/lib/test-string_helpers.c
@@ -327,36 +327,67 @@ out:
 }
 
 #define string_get_size_maxbuf 16
-#define test_string_get_size_one(size, blk_size, units, exp_result)
\
+#define test_string_get_size_one(size, blk_size, exp_result10, exp_result2)
\
do {   \
-   BUILD_BUG_ON(sizeof(exp_result) >= string_get_size_maxbuf);\
-   __test_string_get_size((size), (blk_size), (units),\
-  (exp_result));  \
+   BUILD_BUG_ON(sizeof(exp_result10) >= string_get_size_maxbuf);  \
+   BUILD_BUG_ON(sizeof(exp_result2) >= string_get_size_maxbuf);   \
+   __test_string_get_size((size), (blk_size), (exp_result10), \
+  (exp_result2)); \
} while (0)
 
 
-static __init void __test_string_get_size(const u64 size, const u64 blk_size,
- const enum string_size_units units,
- const char *exp_result)
+static __init void test_string_get_size_check(const char *units,
+ const char *exp,
+ char *res,
+ const u64 size,
+ const u64 blk_size)
 {
-   char buf[string_get_size_maxbuf];
-
-   string_get_size(size, blk_size, units, buf, sizeof(buf));
-   if (!memcmp(buf, exp_result, strlen(exp_result) + 1))
+   if (!memcmp(res, exp, strlen(exp) + 1))
return;
 
-   buf[sizeof(buf) - 1] = '\0';
-   pr_warn("Test 'test_string_get_size_one' failed!\n");
-   pr_warn("string_get_size(size = %llu, blk_size = %llu, units = %d\n",
+   res[string_get_size_maxbuf - 1] = '\0';
+
+   pr_warn("Test 'test_string_get_size' failed!\n");
+   pr_warn("string_get_size(size = %llu, blk_size = %llu, units = %s)\n",
size, blk_size, units);
-   pr_warn("expected: '%s', got '%s'\n", exp_result, buf);
+   pr_warn("expected: '%s', got '%s'\n", exp, res);
+}
+
+static __init void __test_string_get_size(const u64 size, const u64 blk_size,
+ const char *exp_result10,
+ const char *exp_result2)
+{
+   char buf10[string_get_size_maxbuf];
+   char buf2[string_get_size_maxbuf];
+
+   string_get_size(size, blk_size, STRING_UNITS_10, buf10, sizeof(buf10));
+   string_get_size(size, blk_size, STRING_UNITS_2, buf2, sizeof(buf2));
+
+   test_string_get_size_check("STRING_UNITS_10", exp_result10, buf10,
+  size, blk_size);
+
+   test_string_get_size_check("STRING_UNITS_2", exp_result2, buf2,
+  size, blk_size);
 }
 
 static __init void test_string_get_size(void)
 {
-   test_string_get_size_one(16384, 512, STRING_UNITS_2, "8.00 MiB");
-   test_string_get_size_one(8192, 4096, STRING_UNITS_10, "32.7 MB");
-   test_string_get_size_one(1, 512, STRING_UNITS_10, "512 B");
+   /* small values */
+   test_string_get_size_one(0, 512, "0 B", "0 B");
+   test_string_get_size_one(1, 512, "512 B", "512 B");
+   test_string_get_size_one(1100, 1, "1.10 kB", "1.07 KiB");
+
+   /* normal values */
+   test_string_get_size_one(16384, 512, "8.39 MB", "8.00 MiB");
+   test_string_get_size_one(500118192, 512, "256 GB", "238 GiB");
+   test_string_get_size_one(8192, 4096, "33.6 MB", "32.0 MiB");
+
+   /* weird block sizes */
+   test_string_get_size_one(3000, 1900, "5.70 MB", "5.44 MiB");
+
+   /* huge values */
+   test_string_get_size_one(U64_MAX, 4096, "75.6 ZB", "64.0 ZiB");
+   test_string_get_size_one(4096, U64_MAX, "75.6 ZB", "64.0 ZiB");
 }
 
 static int __init test_string_helpers_init(void)




[PATCH 4.4 35/67] mm: update min_free_kbytes from khugepaged after core initialization

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Jason Baron 

commit bc22af74f271ef76b2e6f72f3941f91f0da3f5f8 upstream.

Khugepaged attempts to raise min_free_kbytes if its set too low.
However, on boot khugepaged sets min_free_kbytes first from
subsys_initcall(), and then the mm 'core' over-rides min_free_kbytes
after from init_per_zone_wmark_min(), via a module_init() call.

Khugepaged used to use a late_initcall() to set min_free_kbytes (such
that it occurred after the core initialization), however this was
removed when the initialization of min_free_kbytes was integrated into
the starting of the khugepaged thread.

The fix here is simply to invoke the core initialization using a
core_initcall() instead of module_init(), such that the previous
initialization ordering is restored.  I didn't restore the
late_initcall() since start_stop_khugepaged() already sets
min_free_kbytes via set_recommended_min_free_kbytes().

This was noticed when we had a number of page allocation failures when
moving a workload to a kernel with this new initialization ordering.  On
an 8GB system this restores min_free_kbytes back to 67584 from 11365
when CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.

Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
Signed-off-by: Jason Baron 
Acked-by: Kirill A. Shutemov 
Acked-by: David Rientjes 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

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

--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6193,7 +6193,7 @@ int __meminit init_per_zone_wmark_min(vo
setup_per_zone_inactive_ratio();
return 0;
 }
-module_init(init_per_zone_wmark_min)
+core_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so




[PATCH 4.4 33/67] Input: zforce_ts - fix dual touch recognition

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Knut Wohlrab 

commit 6984ab1ab35f422292b7781c65284038bcc0f6a6 upstream.

A wrong decoding of the touch coordinate message causes a wrong touch
ID. Touch ID for dual touch must be 0 or 1.

According to the actual Neonode nine byte touch coordinate coding,
the state is transported in the lower nibble and the touch ID in
the higher nibble of payload byte five.

Signed-off-by: Knut Wohlrab 
Signed-off-by: Oleksij Rempel 
Signed-off-by: Dirk Behme 
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/touchscreen/zforce_ts.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -370,8 +370,8 @@ static int zforce_touch_event(struct zfo
point.coord_x = point.coord_y = 0;
}
 
-   point.state = payload[9 * i + 5] & 0x03;
-   point.id = (payload[9 * i + 5] & 0xfc) >> 2;
+   point.state = payload[9 * i + 5] & 0x0f;
+   point.id = (payload[9 * i + 5] & 0xf0) >> 4;
 
/* determine touch major, minor and orientation */
point.area_major = max(payload[9 * i + 6],




[PATCH 4.4 37/67] batman-adv: Check skb size before using encapsulated ETH+VLAN header

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Sven Eckelmann 

commit c78296665c3d81f040117432ab9e1cb125521b0c upstream.

The encapsulated ethernet and VLAN header may be outside the received
ethernet frame. Thus the skb buffer size has to be checked before it can be
parsed to find out if it encapsulates another batman-adv packet.

Fixes: 420193573f11 ("batman-adv: softif bridge loop avoidance")
Signed-off-by: Sven Eckelmann 
Signed-off-by: Marek Lindner 
Signed-off-by: Antonio Quartulli 
Signed-off-by: Greg Kroah-Hartman 

---
 net/batman-adv/soft-interface.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -407,11 +407,17 @@ void batadv_interface_rx(struct net_devi
 */
nf_reset(skb);
 
+   if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+   goto dropped;
+
vid = batadv_get_vid(skb, 0);
ethhdr = eth_hdr(skb);
 
switch (ntohs(ethhdr->h_proto)) {
case ETH_P_8021Q:
+   if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+   goto dropped;
+
vhdr = (struct vlan_ethhdr *)skb->data;
 
if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -423,8 +429,6 @@ void batadv_interface_rx(struct net_devi
}
 
/* skb->dev & skb->pkt_type are set here */
-   if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
-   goto dropped;
skb->protocol = eth_type_trans(skb, soft_iface);
 
/* should not be necessary anymore as we use skb_pull_rcsum()




[PATCH 4.4 58/67] iio: ak8975: Fix NULL pointer exception on early interrupt

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Krzysztof Kozlowski 

commit 07d2390e36ee5b3265e9cc8305f2a106c8721e16 upstream.

In certain probe conditions the interrupt came right after registering
the handler causing a NULL pointer exception because of uninitialized
waitqueue:

$ udevadm trigger
i2c-gpio i2c-gpio-1: using pins 143 (SDA) and 144 (SCL)
i2c-gpio i2c-gpio-3: using pins 53 (SDA) and 52 (SCL)
Unable to handle kernel NULL pointer dereference at virtual address 
pgd = e8b38000
[] *pgd=
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in: snd_soc_i2s(+) i2c_gpio(+) snd_soc_idma snd_soc_s3c_dma 
snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer snd soundcore ac97_bus 
spi_s3c64xx pwm_samsung dwc2 exynos_adc phy_exynos_usb2 exynosdrm exynos_rng 
rng_core rtc_s3c
CPU: 0 PID: 717 Comm: data-provider-m Not tainted 
4.6.0-rc1-next-20160401-00011-g1b8d87473b9e-dirty #101
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
(...)
(__wake_up_common) from [] (__wake_up+0x38/0x4c)
(__wake_up) from [] (ak8975_irq_handler+0x28/0x30)
(ak8975_irq_handler) from [] (handle_irq_event_percpu+0x88/0x140)
(handle_irq_event_percpu) from [] (handle_irq_event+0x44/0x68)
(handle_irq_event) from [] (handle_edge_irq+0xf0/0x19c)
(handle_edge_irq) from [] (generic_handle_irq+0x24/0x34)
(generic_handle_irq) from [] (exynos_eint_gpio_irq+0x50/0x68)
(exynos_eint_gpio_irq) from [] (handle_irq_event_percpu+0x88/0x140)
(handle_irq_event_percpu) from [] (handle_irq_event+0x44/0x68)
(handle_irq_event) from [] (handle_fasteoi_irq+0xb4/0x194)
(handle_fasteoi_irq) from [] (generic_handle_irq+0x24/0x34)
(generic_handle_irq) from [] (__handle_domain_irq+0x5c/0xb4)
(__handle_domain_irq) from [] (gic_handle_irq+0x54/0x94)
(gic_handle_irq) from [] (__irq_usr+0x50/0x80)

The bug was reproduced on exynos4412-trats2 (with a max77693 device also
using i2c-gpio) after building max77693 as a module.

Fixes: 94a6d5cf7caa ("iio:ak8975 Implement data ready interrupt handling")
Signed-off-by: Krzysztof Kozlowski 
Tested-by: Gregor Boirie 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/iio/magnetometer/ak8975.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -462,6 +462,8 @@ static int ak8975_setup_irq(struct ak897
int rc;
int irq;
 
+   init_waitqueue_head(&data->data_ready_queue);
+   clear_bit(0, &data->flags);
if (client->irq)
irq = client->irq;
else
@@ -477,8 +479,6 @@ static int ak8975_setup_irq(struct ak897
return rc;
}
 
-   init_waitqueue_head(&data->data_ready_queue);
-   clear_bit(0, &data->flags);
data->eoc_irq = irq;
 
return rc;




[PATCH 4.5 17/88] clk-divider: make sure read-only dividers do not write to their register

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Heiko Stuebner 

commit 50359819794b4a16ae35051cd80f2dab025f6019 upstream.

Commit e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1") removed
the special ops struct for read-only clocks and instead opted to handle
them inside the regular ops.

On the rk3368 this results in breakage as aclkm now gets set a value.
While it is the same divider value, the A53 core still doesn't like it,
which can result in the cpu ending up in a hang.
The reason being that "ACLKENMasserts one clock cycle before the rising
edge of ACLKM" and the clock should only be touched when STANDBYWFIL2
is asserted.

To fix this, reintroduce the read-only ops but do include the round_rate
callback. That way no writes that may be unsafe are done to the divider
register in any case.

The Rockchip use of the clk_divider_ops is adapted to this split again,
as is the nxp, lpc18xx-ccu driver that was included since the original
commit. On lpc18xx-ccu the divider seems to always be read-only
so only uses the new ops now.

Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Reported-by: Zhang Qing 
Signed-off-by: Heiko Stuebner 
Signed-off-by: Stephen Boyd 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/clk-divider.c |   11 ++-
 drivers/clk/nxp/clk-lpc18xx-ccu.c |2 +-
 drivers/clk/rockchip/clk.c|4 +++-
 include/linux/clk-provider.h  |1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -423,6 +423,12 @@ const struct clk_ops clk_divider_ops = {
 };
 EXPORT_SYMBOL_GPL(clk_divider_ops);
 
+const struct clk_ops clk_divider_ro_ops = {
+   .recalc_rate = clk_divider_recalc_rate,
+   .round_rate = clk_divider_round_rate,
+};
+EXPORT_SYMBOL_GPL(clk_divider_ro_ops);
+
 static struct clk *_register_divider(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
void __iomem *reg, u8 shift, u8 width,
@@ -446,7 +452,10 @@ static struct clk *_register_divider(str
return ERR_PTR(-ENOMEM);
 
init.name = name;
-   init.ops = &clk_divider_ops;
+   if (clk_divider_flags & CLK_DIVIDER_READ_ONLY)
+   init.ops = &clk_divider_ro_ops;
+   else
+   init.ops = &clk_divider_ops;
init.flags = flags | CLK_IS_BASIC;
init.parent_names = (parent_name ? &parent_name: NULL);
init.num_parents = (parent_name ? 1 : 0);
--- a/drivers/clk/nxp/clk-lpc18xx-ccu.c
+++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c
@@ -222,7 +222,7 @@ static void lpc18xx_ccu_register_branch_
div->width = 1;
 
div_hw = &div->hw;
-   div_ops = &clk_divider_ops;
+   div_ops = &clk_divider_ro_ops;
}
 
branch->gate.reg = branch->offset + reg_base;
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register
div->width = div_width;
div->lock = lock;
div->table = div_table;
-   div_ops = &clk_divider_ops;
+   div_ops = (div_flags & CLK_DIVIDER_READ_ONLY)
+   ? &clk_divider_ro_ops
+   : &clk_divider_ops;
}
 
clk = clk_register_composite(NULL, name, parent_names, num_parents,
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -385,6 +385,7 @@ struct clk_divider {
 #define CLK_DIVIDER_MAX_AT_ZEROBIT(6)
 
 extern const struct clk_ops clk_divider_ops;
+extern const struct clk_ops clk_divider_ro_ops;
 
 unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
unsigned int val, const struct clk_div_table *table,




[PATCH 4.4 67/67] drm/i915/skl: Fix DMC load on Skylake J0 and K0

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Mat Martineau 

commit a41c8882592fb80458959b10e37632ce030b68ca upstream.

The driver does not load firmware for unknown steppings, so these new
steppings must be added to the list.

Cc: Rodrigo Vivi 
Signed-off-by: Mat Martineau 
Reviewed-by: Rodrigo Vivi 
Signed-off-by: Rodrigo Vivi 
Link: 
http://patchwork.freedesktop.org/patch/msgid/1454023163-25469-1-git-send-email-mathew.j.martin...@linux.intel.com
Cc: Jani Nikula 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/i915/intel_csr.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -180,7 +180,8 @@ struct stepping_info {
 static const struct stepping_info skl_stepping_info[] = {
{'A', '0'}, {'B', '0'}, {'C', '0'},
{'D', '0'}, {'E', '0'}, {'F', '0'},
-   {'G', '0'}, {'H', '0'}, {'I', '0'}
+   {'G', '0'}, {'H', '0'}, {'I', '0'},
+   {'J', '0'}, {'K', '0'}
 };
 
 static struct stepping_info bxt_stepping_info[] = {




[PATCH 4.4 65/67] ACPI / processor: Request native thermal interrupt handling via _OSC

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Srinivas Pandruvada 

commit a21211672c9a1d730a39aa65d4a5b3414700adfb upstream.

There are several reports of freeze on enabling HWP (Hardware PStates)
feature on Skylake-based systems by the Intel P-states driver. The root
cause is identified as the HWP interrupts causing BIOS code to freeze.

HWP interrupts use the thermal LVT which can be handled by Linux
natively, but on the affected Skylake-based systems SMM will respond
to it by default.  This is a problem for several reasons:
 - On the affected systems the SMM thermal LVT handler is broken (it
   will crash when invoked) and a BIOS update is necessary to fix it.
 - With thermal interrupt handled in SMM we lose all of the reporting
   features of the arch/x86/kernel/cpu/mcheck/therm_throt driver.
 - Some thermal drivers like x86-package-temp depend on the thermal
   threshold interrupts signaled via the thermal LVT.
 - The HWP interrupts are useful for debugging and tuning
   performance (if the kernel can handle them).
The native handling of thermal interrupts needs to be enabled
because of that.

This requires some way to tell SMM that the OS can handle thermal
interrupts.  That can be done by using _OSC/_PDC in processor
scope very early during ACPI initialization.

The meaning of _OSC/_PDC bit 12 in processor scope is whether or
not the OS supports native handling of interrupts for Collaborative
Processor Performance Control (CPPC) notifications.  Since on
HWP-capable systems CPPC is a firmware interface to HWP, setting
this bit effectively tells the firmware that the OS will handle
thermal interrupts natively going forward.

For details on _OSC/_PDC refer to:
http://www.intel.com/content/www/us/en/standards/processor-vendor-specific-acpi-specification.html

To implement the _OSC/_PDC handshake as described, introduce a new
function, acpi_early_processor_osc(), that walks the ACPI
namespace looking for ACPI processor objects and invokes _OSC for
them with bit 12 in the capabilities buffer set and terminates the
namespace walk on the first success.

Also modify intel_thermal_interrupt() to clear HWP status bits in
the HWP_STATUS MSR to acknowledge HWP interrupts (which prevents
them from firing continuously).

Signed-off-by: Srinivas Pandruvada 
[ rjw: Subject & changelog, function rename ]
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/cpu/mcheck/therm_throt.c |3 +
 drivers/acpi/acpi_processor.c|   52 +++
 drivers/acpi/bus.c   |3 +
 drivers/acpi/internal.h  |6 +++
 4 files changed, 64 insertions(+)

--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -385,6 +385,9 @@ static void intel_thermal_interrupt(void
 {
__u64 msr_val;
 
+   if (static_cpu_has(X86_FEATURE_HWP))
+   wrmsrl_safe(MSR_HWP_STATUS, 0);
+
rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
 
/* Check for violation of core thermal thresholds*/
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -491,6 +491,58 @@ static void acpi_processor_remove(struct
 }
 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
 
+#ifdef CONFIG_X86
+static bool acpi_hwp_native_thermal_lvt_set;
+static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle,
+ u32 lvl,
+ void *context,
+ void **rv)
+{
+   u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
+   u32 capbuf[2];
+   struct acpi_osc_context osc_context = {
+   .uuid_str = sb_uuid_str,
+   .rev = 1,
+   .cap.length = 8,
+   .cap.pointer = capbuf,
+   };
+
+   if (acpi_hwp_native_thermal_lvt_set)
+   return AE_CTRL_TERMINATE;
+
+   capbuf[0] = 0x;
+   capbuf[1] = 0x1000; /* set bit 12 */
+
+   if (ACPI_SUCCESS(acpi_run_osc(handle, &osc_context))) {
+   if (osc_context.ret.pointer && osc_context.ret.length > 1) {
+   u32 *capbuf_ret = osc_context.ret.pointer;
+
+   if (capbuf_ret[1] & 0x1000) {
+   acpi_handle_info(handle,
+   "_OSC native thermal LVT Acked\n");
+   acpi_hwp_native_thermal_lvt_set = true;
+   }
+   }
+   kfree(osc_context.ret.pointer);
+   }
+
+   return AE_OK;
+}
+
+void __init acpi_early_processor_osc(void)
+{
+   if (boot_cpu_has(X86_FEATURE_HWP)) {
+   acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
+   ACPI_UINT32_MAX,
+   acpi_hwp_native_thermal_lvt_o

[PATCH 4.4 55/67] gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Philipp Zabel 

commit 503fe87bd0a8346ba9d8b7f49115dcd0a4185226 upstream.

If of_node is set before calling platform_device_add, the driver core
will try to use of: modalias matching, which fails because the device
tree nodes don't have a compatible property set. This patch fixes
imx-ipuv3-crtc module autoloading by setting the of_node property only
after the platform modalias is set.

Fixes: 304e6be652e2 ("gpu: ipu-v3: Assign of_node of child platform devices to 
corresponding ports")
Reported-by: Dennis Gilmore 
Signed-off-by: Philipp Zabel 
Tested-By: Dennis Gilmore 
Signed-off-by: Dave Airlie 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/ipu-v3/ipu-common.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct
goto err_register;
}
 
-   pdev->dev.of_node = of_node;
pdev->dev.parent = dev;
 
ret = platform_device_add_data(pdev, ®->pdata,
@@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct
platform_device_put(pdev);
goto err_register;
}
+
+   /*
+* Set of_node only after calling platform_device_add. Otherwise
+* the platform:imx-ipuv3-crtc modalias won't be used.
+*/
+   pdev->dev.of_node = of_node;
}
 
return 0;




[PATCH 4.4 42/67] x86/tsc: Read all ratio bits from MSR_PLATFORM_INFO

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Chen Yu 

commit 886123fb3a8656699dff40afa0573df359abeb18 upstream.

Currently we read the tsc radio: ratio = (MSR_PLATFORM_INFO >> 8) & 0x1f;

Thus we get bit 8-12 of MSR_PLATFORM_INFO, however according to the SDM
(35.5), the ratio bits are bit 8-15.

Ignoring the upper bits can result in an incorrect tsc ratio, which causes the
TSC calibration and the Local APIC timer frequency to be incorrect.

Fix this problem by masking 0xff instead.

[ tglx: Massaged changelog ]

Fixes: 7da7c1561366 "x86, tsc: Add static (MSR) TSC calibration on Intel Atom 
SoCs"
Signed-off-by: Chen Yu 
Cc: "Rafael J. Wysocki" 
Cc: Bin Gao 
Cc: Len Brown 
Link: 
http://lkml.kernel.org/r/1462505619-5516-1-git-send-email-yu.c.c...@intel.com
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/tsc_msr.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/tsc_msr.c
+++ b/arch/x86/kernel/tsc_msr.c
@@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void
 
if (freq_desc_tables[cpu_index].msr_plat) {
rdmsr(MSR_PLATFORM_INFO, lo, hi);
-   ratio = (lo >> 8) & 0x1f;
+   ratio = (lo >> 8) & 0xff;
} else {
rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
ratio = (hi >> 8) & 0x1f;




Re: [PATCH] workqueue: fix rebind bound workers warning

2016-05-09 Thread Wanpeng Li
Sorry to quick ping you Tejun, just hope it can catch the upcoming
merge window. :-)
2016-05-05 9:41 GMT+08:00 Wanpeng Li :
> From: Wanpeng Li 
>
> [ cut here ]
> WARNING: CPU: 0 PID: 16 at kernel/workqueue.c:4559 rebind_workers+0x1c0/0x1d0
> Modules linked in:
> CPU: 0 PID: 16 Comm: cpuhp/0 Not tainted 4.6.0-rc4+ #31
> Hardware name: IBM IBM System x3550 M4 Server -[7914IUW]-/00Y8603, BIOS 
> -[D7E128FUS-1.40]- 07/23/2013
>   881037babb58 8139d885 0010
>     881037babba8
>  8108505d 881037ba 11cf3e7d6e60 0046
> Call Trace:
>  dump_stack+0x89/0xd4
>  __warn+0xfd/0x120
>  warn_slowpath_null+0x1d/0x20
>  rebind_workers+0x1c0/0x1d0
>  workqueue_cpu_up_callback+0xf5/0x1d0
>  notifier_call_chain+0x64/0x90
>  ? trace_hardirqs_on_caller+0xf2/0x220
>  ? notify_prepare+0x80/0x80
>  __raw_notifier_call_chain+0xe/0x10
>  __cpu_notify+0x35/0x50
>  notify_down_prepare+0x5e/0x80
>  ? notify_prepare+0x80/0x80
>  cpuhp_invoke_callback+0x73/0x330
>  ? __schedule+0x33e/0x8a0
>  cpuhp_down_callbacks+0x51/0xc0
>  cpuhp_thread_fun+0xc1/0xf0
>  smpboot_thread_fn+0x159/0x2a0
>  ? smpboot_create_threads+0x80/0x80
>  kthread+0xef/0x110
>  ? wait_for_completion+0xf0/0x120
>  ? schedule_tail+0x35/0xf0
>  ret_from_fork+0x22/0x50
>  ? __init_kthread_worker+0x70/0x70
> ---[ end trace eb12ae47d2382d8f ]---
> notify_down_prepare: attempt to take down CPU 0 failed
>
> This bug can be reproduced by below config w/ nohz_full= all cpus:
>
> CONFIG_BOOTPARAM_HOTPLUG_CPU0=y
> CONFIG_DEBUG_HOTPLUG_CPU0=y
> CONFIG_NO_HZ_FULL=y
>
> The boot CPU handles housekeeping duty(unbound timers, workqueues,
> timekeeping, ...) on behalf of full dynticks CPUs. It must remain
> online when nohz full is enabled. There is a priority set to every
> notifier_blocks:
>
> workqueue_cpu_up > tick_nohz_cpu_down > workqueue_cpu_down
>
> So tick_nohz_cpu_down callback failed when down prepare cpu 0, and
> notifier_blocks behind tick_nohz_cpu_down will not be called any
> more, which leads to workers are actually not unbound. Then hotplug
> state machine will fallback to undo and online cpu 0 again. Workers
> will be rebound unconditionally even if they are not unbound and
> trigger the warning in this progress.
>
> This patch fix it by catching !DISASSOCIATED to avoid rebind bound
> workers.
>
> Cc: Tejun Heo 
> Cc: Lai Jiangshan 
> Suggested-by: Lai Jiangshan 
> Signed-off-by: Wanpeng Li 
> ---
>  kernel/workqueue.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 2232ae3..cc18920 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -4525,6 +4525,12 @@ static void rebind_workers(struct worker_pool *pool)
>   pool->attrs->cpumask) < 0);
>
> spin_lock_irq(&pool->lock);
> +
> +   if (!(pool->flags & POOL_DISASSOCIATED)) {
> +   spin_unlock_irq(&pool->lock);
> +   return;
> +   }
> +
> pool->flags &= ~POOL_DISASSOCIATED;
>
> for_each_pool_worker(worker, pool) {
> --
> 1.9.1
>


[PATCH 4.4 45/67] ARM: cpuidle: Pass on arm_cpuidle_suspend()s return value

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: James Morse 

commit 625fe4f8ffc1b915248558481bb94249f6bd411c upstream.

arm_cpuidle_suspend() may return -EOPNOTSUPP, or any value returned
by the cpu_ops/cpuidle_ops suspend call. arm_enter_idle_state() doesn't
update 'ret' with this value, meaning we always signal success to
cpuidle_enter_state(), causing it to update the usage counters as if we
succeeded.

Fixes: 191de17aa3c1 ("ARM64: cpuidle: Replace cpu_suspend by the common 
ARM/ARM64 function")
Signed-off-by: James Morse 
Acked-by: Lorenzo Pieralisi 
Acked-by: Daniel Lezcano 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/cpuidle/cpuidle-arm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -50,7 +50,7 @@ static int arm_enter_idle_state(struct c
 * call the CPU ops suspend protocol with idle index as a
 * parameter.
 */
-   arm_cpuidle_suspend(idx);
+   ret = arm_cpuidle_suspend(idx);
 
cpu_pm_exit();
}




[PATCH 4.4 44/67] propogate_mnt: Handle the first propogated copy being a slave

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Eric W. Biederman 

commit 5ec0811d30378ae104f250bfc9b3640242d81e3f upstream.

When the first propgated copy was a slave the following oops would result:
> BUG: unable to handle kernel NULL pointer dereference at 0010
> IP: [] propagate_one+0xbe/0x1c0
> PGD bacd4067 PUD bac66067 PMD 0
> Oops:  [#1] SMP
> Modules linked in:
> CPU: 1 PID: 824 Comm: mount Not tainted 4.6.0-rc5userns+ #1523
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
> task: 8800bb0a8000 ti: 8800bac3c000 task.ti: 8800bac3c000
> RIP: 0010:[]  [] propagate_one+0xbe/0x1c0
> RSP: 0018:8800bac3fd38  EFLAGS: 00010283
> RAX:  RBX: 8800bb77ec00 RCX: 0010
> RDX:  RSI: 8800bb58c000 RDI: 8800bb58c480
> RBP: 8800bac3fd48 R08: 0001 R09: 
> R10: 1ca1 R11: 1c9d R12: 
> R13: 8800ba713800 R14: 8800bac3fda0 R15: 8800bb77ec00
> FS:  7f3c0cd9b7e0() GS:8800bfb0() knlGS:
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: 0010 CR3: bb79d000 CR4: 06e0
> Stack:
>  8800bb77ec00  8800bac3fd88 811fbf85
>  8800bac3fd98 8800bb77f080 8800ba713800 8800bb262b40
>    8800bac3fdd8 811f1da0
> Call Trace:
>  [] propagate_mnt+0x105/0x140
>  [] attach_recursive_mnt+0x120/0x1e0
>  [] graft_tree+0x63/0x70
>  [] do_add_mount+0x9b/0x100
>  [] do_mount+0x2aa/0xdf0
>  [] ? strndup_user+0x4e/0x70
>  [] SyS_mount+0x75/0xc0
>  [] do_syscall_64+0x4b/0xa0
>  [] entry_SYSCALL64_slow_path+0x25/0x25
> Code: 00 00 75 ec 48 89 0d 02 22 22 01 8b 89 10 01 00 00 48 89 05 fd 21 22 01 
> 39 8e 10 01 00 00 0f 84 e0 00 00 00 48 8b 80 d8 00 00 00 <48> 8b 50 10 48 89 
> 05 df 21 22 01 48 89 15 d0 21 22 01 8b 53 30
> RIP  [] propagate_one+0xbe/0x1c0
>  RSP 
> CR2: 0010
> ---[ end trace 2725ecd95164f217 ]---

This oops happens with the namespace_sem held and can be triggered by
non-root users.  An all around not pleasant experience.

To avoid this scenario when finding the appropriate source mount to
copy stop the walk up the mnt_master chain when the first source mount
is encountered.

Further rewrite the walk up the last_source mnt_master chain so that
it is clear what is going on.

The reason why the first source mount is special is that it it's
mnt_parent is not a mount in the dest_mnt propagation tree, and as
such termination conditions based up on the dest_mnt mount propgation
tree do not make sense.

To avoid other kinds of confusion last_dest is not changed when
computing last_source.  last_dest is only used once in propagate_one
and that is above the point of the code being modified, so changing
the global variable is meaningless and confusing.

fixes: f2ebb3a921c1ca1e2ddd9242e95a1989a50c4c68 ("smarter propagate_mnt()")
Reported-by: Tycho Andersen 
Reviewed-by: Seth Forshee 
Tested-by: Seth Forshee 
Signed-off-by: "Eric W. Biederman" 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/pnode.c |   25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -198,7 +198,7 @@ static struct mount *next_group(struct m
 
 /* all accesses are serialized by namespace_sem */
 static struct user_namespace *user_ns;
-static struct mount *last_dest, *last_source, *dest_master;
+static struct mount *last_dest, *first_source, *last_source, *dest_master;
 static struct mountpoint *mp;
 static struct hlist_head *list;
 
@@ -221,20 +221,22 @@ static int propagate_one(struct mount *m
type = CL_MAKE_SHARED;
} else {
struct mount *n, *p;
+   bool done;
for (n = m; ; n = p) {
p = n->mnt_master;
-   if (p == dest_master || IS_MNT_MARKED(p)) {
-   while (last_dest->mnt_master != p) {
-   last_source = last_source->mnt_master;
-   last_dest = last_source->mnt_parent;
-   }
-   if (!peers(n, last_dest)) {
-   last_source = last_source->mnt_master;
-   last_dest = last_source->mnt_parent;
-   }
+   if (p == dest_master || IS_MNT_MARKED(p))
break;
-   }
}
+   do {
+   struct mount *parent = last_source->mnt_parent;
+   if (last_source == first_source)
+   break;
+   done = parent->mnt_master == p;
+   if (done && peers(n, parent))
+  

[PATCH 4.4 41/67] MAINTAINERS: Remove asterisk from EFI directory names

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Matt Fleming 

commit e8dfe6d8f6762d515fcd4f30577f7bfcf7659887 upstream.

Mark reported that having asterisks on the end of directory names
confuses get_maintainer.pl when it encounters subdirectories, and that
my name does not appear when run on drivers/firmware/efi/libstub.

Reported-by: Mark Rutland 
Signed-off-by: Matt Fleming 
Cc: Ard Biesheuvel 
Cc: Catalin Marinas 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-...@vger.kernel.org
Link: 
http://lkml.kernel.org/r/1462303781-8686-2-git-send-email-m...@codeblueprint.co.uk
Signed-off-by: Ingo Molnar 
Signed-off-by: Greg Kroah-Hartman 

---
 MAINTAINERS |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4097,8 +4097,8 @@ F:Documentation/efi-stub.txt
 F: arch/ia64/kernel/efi.c
 F: arch/x86/boot/compressed/eboot.[ch]
 F: arch/x86/include/asm/efi.h
-F: arch/x86/platform/efi/*
-F: drivers/firmware/efi/*
+F: arch/x86/platform/efi/
+F: drivers/firmware/efi/
 F: include/linux/efi*.h
 
 EFI VARIABLE FILESYSTEM




[PATCH 4.4 29/67] xen/balloon: Fix crash when ballooning on x86 32 bit PAE

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Ross Lagerwall 

commit dfd74a1edfaba5864276a2859190a8d242d18952 upstream.

Commit 55b3da98a40dbb3776f7454daf0d95dde25c33d2 (xen/balloon: find
non-conflicting regions to place hotplugged memory) caused a
regression in 4.4.

When ballooning on an x86 32 bit PAE system with close to 64 GiB of
memory, the address returned by allocate_resource may be above 64 GiB.
When using CONFIG_SPARSEMEM, this setup is limited to using physical
addresses < 64 GiB.  When adding memory at this address, it runs off
the end of the mem_section array and causes a crash.  Instead, fail
the ballooning request.

Signed-off-by: Ross Lagerwall 
Signed-off-by: David Vrabel 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/xen/balloon.c |   16 
 1 file changed, 16 insertions(+)

--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -152,6 +152,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_w
 static void balloon_process(struct work_struct *work);
 static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
 
+static void release_memory_resource(struct resource *resource);
+
 /* When ballooning out (allocating memory to return to Xen) we don't really
want the kernel to try too hard since that can trigger the oom killer. */
 #define GFP_BALLOON \
@@ -268,6 +270,20 @@ static struct resource *additional_memor
return NULL;
}
 
+#ifdef CONFIG_SPARSEMEM
+   {
+   unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT);
+   unsigned long pfn = res->start >> PAGE_SHIFT;
+
+   if (pfn > limit) {
+   pr_err("New System RAM resource outside addressable RAM 
(%lu > %lu)\n",
+  pfn, limit);
+   release_memory_resource(res);
+   return NULL;
+   }
+   }
+#endif
+
return res;
 }
 




[PATCH 4.4 40/67] writeback: Fix performance regression in wb_over_bg_thresh()

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Howard Cochran 

commit 74d369443325063a5f0260e63971decb950fd8fa upstream.

Commit 947e9762a8dd ("writeback: update wb_over_bg_thresh() to use
wb_domain aware operations") unintentionally changed this function's
meaning from "are there more dirty pages than the background writeback
threshold" to "are there more dirty pages than the writeback threshold".
The background writeback threshold is typically half of the writeback
threshold, so this had the effect of raising the number of dirty pages
required to cause a writeback worker to perform background writeout.

This can cause a very severe performance regression when a BDI uses
BDI_CAP_STRICTLIMIT because balance_dirty_pages() and the writeback worker
can now disagree on whether writeback should be initiated.

For example, in a system having 1GB of RAM, a single spinning disk, and a
"pass-through" FUSE filesystem mounted over the disk, application code
mmapped a 128MB file on the disk and was randomly dirtying pages in that
mapping.

Because FUSE uses strictlimit and has a default max_ratio of only 1%, in
balance_dirty_pages, thresh is ~200, bg_thresh is ~100, and the
dirty_freerun_ceiling is the average of those, ~150. So, it pauses the
dirtying processes when we have 151 dirty pages and wakes up a background
writeback worker. But the worker tests the wrong threshold (200 instead of
100), so it does not initiate writeback and just returns.

Thus, balance_dirty_pages keeps looping, sleeping and then waking up the
worker who will do nothing. It remains stuck in this state until the few
dirty pages that we have finally expire and we write them back for that
reason. Then the whole process repeats, resulting in near-zero throughput
through the FUSE BDI.

The fix is to call the parameterized variant of wb_calc_thresh, so that the
worker will do writeback if the bg_thresh is exceeded which was the
behavior before the referenced commit.

Fixes: 947e9762a8dd ("writeback: update wb_over_bg_thresh() to use wb_domain 
aware operations")
Signed-off-by: Howard Cochran 
Acked-by: Tejun Heo 
Signed-off-by: Miklos Szeredi 
Tested-by Sedat Dilek 
Signed-off-by: Jens Axboe 
Signed-off-by: Greg Kroah-Hartman 

---
 mm/page-writeback.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1899,7 +1899,8 @@ bool wb_over_bg_thresh(struct bdi_writeb
if (gdtc->dirty > gdtc->bg_thresh)
return true;
 
-   if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(gdtc))
+   if (wb_stat(wb, WB_RECLAIMABLE) >
+   wb_calc_thresh(gdtc->wb, gdtc->bg_thresh))
return true;
 
if (mdtc) {
@@ -1913,7 +1914,8 @@ bool wb_over_bg_thresh(struct bdi_writeb
if (mdtc->dirty > mdtc->bg_thresh)
return true;
 
-   if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(mdtc))
+   if (wb_stat(wb, WB_RECLAIMABLE) >
+   wb_calc_thresh(mdtc->wb, mdtc->bg_thresh))
return true;
}
 




[PATCH 4.4 39/67] batman-adv: Reduce refcnt of removed router when updating route

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Sven Eckelmann 

commit d1a65f1741bfd9c69f9e4e2ad447a89b6810427d upstream.

_batadv_update_route rcu_derefences orig_ifinfo->router outside of a
spinlock protected region to print some information messages to the debug
log. But this pointer is not checked again when the new pointer is assigned
in the spinlock protected region. Thus is can happen that the value of
orig_ifinfo->router changed in the meantime and thus the reference counter
of the wrong router gets reduced after the spinlock protected region.

Just rcu_dereferencing the value of orig_ifinfo->router inside the spinlock
protected region (which also set the new pointer) is enough to get the
correct old router object.

Fixes: e1a5382f978b ("batman-adv: Make orig_node->router an rcu protected 
pointer")
Signed-off-by: Sven Eckelmann 
Signed-off-by: Marek Lindner 
Signed-off-by: Antonio Quartulli 
Signed-off-by: Greg Kroah-Hartman 

---
 net/batman-adv/routing.c |9 +
 1 file changed, 9 insertions(+)

--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -104,6 +104,15 @@ static void _batadv_update_route(struct
neigh_node = NULL;
 
spin_lock_bh(&orig_node->neigh_list_lock);
+   /* curr_router used earlier may not be the current orig_ifinfo->router
+* anymore because it was dereferenced outside of the neigh_list_lock
+* protected region. After the new best neighbor has replace the current
+* best neighbor the reference counter needs to decrease. Consequently,
+* the code needs to ensure the curr_router variable contains a pointer
+* to the replaced best neighbor.
+*/
+   curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+
rcu_assign_pointer(orig_ifinfo->router, neigh_node);
spin_unlock_bh(&orig_node->neigh_list_lock);
batadv_orig_ifinfo_free_ref(orig_ifinfo);




Re: [PATCH 1/7] tty: ipwireless, cleanup TIOCGSERIAL

2016-05-09 Thread David Sterba
On Mon, May 09, 2016 at 09:11:53AM +0200, Jiri Slaby wrote:
> In ipwireless_get_serial_info, struct serial_struct is memset to 0 and
> then some members set to 0 explicitly.
> 
> Remove the latter as it is obviously superfluous.
> 
> And remove the retinfo check against NULL. copy_to_user will take care
> of that.
> 
> Part of hub6 cleanup series.
> 
> Signed-off-by: Jiri Slaby 
> Cc: Jiri Kosina 
> Cc: David Sterba 

Acked-by: David Sterba 


[PATCH 4.4 07/67] nbd: ratelimit error msgs after socket close

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Streetman 

commit da6ccaaa79caca4f38b540b651238f87215217a2 upstream.

Make the "Attempted send on closed socket" error messages generated in
nbd_request_handler() ratelimited.

When the nbd socket is shutdown, the nbd_request_handler() function emits
an error message for every request remaining in its queue.  If the queue
is large, this will spam a large amount of messages to the log.  There's
no need for a separate error message for each request, so this patch
ratelimits it.

In the specific case this was found, the system was virtual and the error
messages were logged to the serial port, which overwhelmed it.

Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
Signed-off-by: Dan Streetman 
Signed-off-by: Markus Pargmann 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/block/nbd.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -618,8 +618,8 @@ static void nbd_request_handler(struct r
req, req->cmd_type);
 
if (unlikely(!nbd->sock)) {
-   dev_err(disk_to_dev(nbd->disk),
-   "Attempted send on closed socket\n");
+   dev_err_ratelimited(disk_to_dev(nbd->disk),
+   "Attempted send on closed 
socket\n");
req->errors++;
nbd_end_request(nbd, req);
spin_lock_irq(q->queue_lock);




[PATCH 4.4 05/67] ipvs: drop first packet to redirect conntrack

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Julian Anastasov 

commit f719e3754ee2f7275437e61a6afd520181fdd43b upstream.

Jiri Bohac is reporting for a problem where the attempt
to reschedule existing connection to another real server
needs proper redirect for the conntrack used by the IPVS
connection. For example, when IPVS connection is created
to NAT-ed real server we alter the reply direction of
conntrack. If we later decide to select different real
server we can not alter again the conntrack. And if we
expire the old connection, the new connection is left
without conntrack.

So, the only way to redirect both the IPVS connection and
the Netfilter's conntrack is to drop the SYN packet that
hits existing connection, to wait for the next jiffie
to expire the old connection and its conntrack and to rely
on client's retransmission to create new connection as
usually.

Jiri Bohac provided a fix that drops all SYNs on rescheduling,
I extended his patch to do such drops only for connections
that use conntrack. Here is the original report from Jiri Bohac:

Since commit dc7b3eb900aa ("ipvs: Fix reuse connection if real server
is dead"), new connections to dead servers are redistributed
immediately to new servers.  The old connection is expired using
ip_vs_conn_expire_now() which sets the connection timer to expire
immediately.

However, before the timer callback, ip_vs_conn_expire(), is run
to clean the connection's conntrack entry, the new redistributed
connection may already be established and its conntrack removed
instead.

Fix this by dropping the first packet of the new connection
instead, like we do when the destination server is not available.
The timer will have deleted the old conntrack entry long before
the first packet of the new connection is retransmitted.

Fixes: dc7b3eb900aa ("ipvs: Fix reuse connection if real server is dead")
Signed-off-by: Jiri Bohac 
Signed-off-by: Julian Anastasov 
Signed-off-by: Simon Horman 
Signed-off-by: Greg Kroah-Hartman 

---
 include/net/ip_vs.h |   17 +
 net/netfilter/ipvs/ip_vs_core.c |   37 -
 2 files changed, 45 insertions(+), 9 deletions(-)

--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_connt
 }
 #endif /* CONFIG_IP_VS_NFCT */
 
+/* Really using conntrack? */
+static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp,
+struct sk_buff *skb)
+{
+#ifdef CONFIG_IP_VS_NFCT
+   enum ip_conntrack_info ctinfo;
+   struct nf_conn *ct;
+
+   if (!(cp->flags & IP_VS_CONN_F_NFCT))
+   return false;
+   ct = nf_ct_get(skb, &ctinfo);
+   if (ct && !nf_ct_is_untracked(ct))
+   return true;
+#endif
+   return false;
+}
+
 static inline int
 ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
 {
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1757,15 +1757,34 @@ ip_vs_in(struct netns_ipvs *ipvs, unsign
cp = pp->conn_in_get(ipvs, af, skb, &iph);
 
conn_reuse_mode = sysctl_conn_reuse_mode(ipvs);
-   if (conn_reuse_mode && !iph.fragoffs &&
-   is_new_conn(skb, &iph) && cp &&
-   ((unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest &&
- unlikely(!atomic_read(&cp->dest->weight))) ||
-unlikely(is_new_conn_expected(cp, conn_reuse_mode {
-   if (!atomic_read(&cp->n_control))
-   ip_vs_conn_expire_now(cp);
-   __ip_vs_conn_put(cp);
-   cp = NULL;
+   if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) {
+   bool uses_ct = false, resched = false;
+
+   if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest &&
+   unlikely(!atomic_read(&cp->dest->weight))) {
+   resched = true;
+   uses_ct = ip_vs_conn_uses_conntrack(cp, skb);
+   } else if (is_new_conn_expected(cp, conn_reuse_mode)) {
+   uses_ct = ip_vs_conn_uses_conntrack(cp, skb);
+   if (!atomic_read(&cp->n_control)) {
+   resched = true;
+   } else {
+   /* Do not reschedule controlling connection
+* that uses conntrack while it is still
+* referenced by controlled connection(s).
+*/
+   resched = !uses_ct;
+   }
+   }
+
+   if (resched) {
+   if (!atomic_read(&cp->n_control))
+   ip_vs_conn_expire_now(cp);
+   __ip_vs_conn_put(cp);
+   if (uses_ct)
+   return NF_DROP;
+   cp

[PATCH 4.4 26/67] ARM: EXYNOS: Properly skip unitialized parent clock in power domain on

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Krzysztof Kozlowski 

commit a0a966b83873f33778710a4fc59240244b0734a5 upstream.

We want to skip reparenting a clock on turning on power domain, if we
do not have the parent yet. The parent is obtained when turning the
domain off. However due to a typo, the loop is continued on IS_ERR() of
clock being reparented, not on the IS_ERR() of the parent.

Theoretically this could lead to OOPS on first turn on of a power
domain, if there was no turn off before. Practically that should never
happen because all power domains are turned on by default (reset value,
bootloader does not turn off them usually) so the first action will be
always turn off.

Fixes: 29e5eea06bc1 ("ARM: EXYNOS: Get current parent clock for power domain 
on/off")
Reported-by: Vladimir Zapolskiy 
Signed-off-by: Krzysztof Kozlowski 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/arm/mach-exynos/pm_domains.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -92,7 +92,7 @@ static int exynos_pd_power(struct generi
if (IS_ERR(pd->clk[i]))
break;
 
-   if (IS_ERR(pd->clk[i]))
+   if (IS_ERR(pd->pclk[i]))
continue; /* Skip on first power up */
if (clk_set_parent(pd->clk[i], pd->pclk[i]))
pr_err("%s: error setting parent to clock%d\n",




Re: [PATCH] mm: make fault_around_bytes configurable

2016-05-09 Thread Minchan Kim
Hello,

On Mon, Apr 25, 2016 at 05:21:11PM +0530, Vinayak Menon wrote:
> 
> 
> On 4/22/2016 3:14 PM, Kirill A. Shutemov wrote:
> > On Fri, Apr 22, 2016 at 02:15:08PM +0530, Vinayak Menon wrote:
> >> On 04/22/2016 05:31 AM, Andrew Morton wrote:
> >>> On Mon, 18 Apr 2016 20:47:16 +0530 Vinayak Menon 
> >>>  wrote:
> >>>
>  Mapping pages around fault is found to cause performance degradation
>  in certain use cases. The test performed here is launch of 10 apps
>  one by one, doing something with the app each time, and then repeating
>  the same sequence once more, on an ARM 64-bit Android device with 2GB
>  of RAM. The time taken to launch the apps is found to be better when
>  fault around feature is disabled by setting fault_around_bytes to page
>  size (4096 in this case).
> >>> Well that's one workload, and a somewhat strange one.  What is the
> >>> effect on other workloads (of which there are a lot!).
> >>>
> >> This workload emulates the way a user would use his mobile device, opening
> >> an application, using it for some time, switching to next, and then coming
> >> back to the same application later. Another stat which shows significant
> >> degradation on Android with fault_around is device boot up time. I have not
> >> tried any other workload other than these.
> >>
>  The tests were done on 3.18 kernel. 4 extra vmstat counters were added
>  for debugging. pgpgoutclean accounts the clean pages reclaimed via
>  __delete_from_page_cache. pageref_activate, pageref_activate_vm_exec,
>  and pageref_keep accounts the mapped file pages activated and retained
>  by page_check_references.
> 
>  === Without swap ===
>    3.18 3.18-fault_around_bytes=4096
>  ---
>  workingset_refault691100   664339
>  workingset_activate   210379   179139
>  pgpgin4676096  4492780
>  pgpgout   163967   96711
>  pgpgoutclean  1090664  990659
>  pgalloc_dma   3463111  3328299
>  pgfree3502365  3363866
>  pgactivate568134   238570
>  pgdeactivate  752260   392138
>  pageref_activate  315078   121705
>  pageref_activate_vm_exec  162940   55815
>  pageref_keep  141354   51011
>  pgmajfault2486323633
>  pgrefill_dma  1116370  544042
>  pgscan_kswapd_dma 1735186  1234622
>  pgsteal_kswapd_dma1121769  1005725
>  pgscan_direct_dma 129661090
>  pgsteal_direct_dma6209 967
>  slabs_scanned 1539849  977351
>  pageoutrun1260 1333
>  allocstall47   7
> 
>  === With swap ===
>    3.18 3.18-fault_around_bytes=4096
>  ---
>  workingset_refault597687   878109
>  workingset_activate   167169   254037
>  pgpgin4035424  5157348
>  pgpgout   162151   85231
>  pgpgoutclean  928587   1225029
>  pswpin4603317100
>  pswpout   237952   127686
>  pgalloc_dma   3305034  3542614
>  pgfree3354989  3592132
>  pgactivate626468   355275
>  pgdeactivate  990205   771902
>  pageref_activate  294780   157106
>  pageref_activate_vm_exec  141722   63469
>  pageref_keep  121931   63028
>  pgmajfault6781845643
>  pgrefill_dma  1324023  977192
>  pgscan_kswapd_dma 1825267  1720322
>  pgsteal_kswapd_dma1181882  1365500
>  pgscan_direct_dma 419579622
>  pgsteal_direct_dma251366759
>  slabs_scanned 689575   542705
>  pageoutrun1234 1538
>  allocstall110  26
> 
>  Looks like with fault_around, there is more pressure on reclaim because
>  of the presence of more mapped pages, resulting in more IO activity,
>  more faults, more swapping, and allocstalls.
> >>> A few of those things did get a bit worse?
> >> I think some numbers (like workingset, pgpgin, pgpgoutclean etc) looks
> >> better with fault_around because, increased number of mapped pages is
> >> resulting in less number of file pages being 

[PATCH 4.4 06/67] mfd: intel-lpss: Remove clock tree on error path

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Andy Shevchenko 

commit 84cb36cac581c915ef4e8b70abb73e084325df92 upstream.

We forgot to remove the clock tree if something goes wrong in ->probe(). Add a
call to intel_lpss_unregister_clock() on error path in ->probe() to fix the
potential issue.

Fixes: 4b45efe85263 (mfd: Add support for Intel Sunrisepoint LPSS devices)
Signed-off-by: Andy Shevchenko 
Acked-by: Mika Westerberg 
Signed-off-by: Lee Jones 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/mfd/intel-lpss.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -445,6 +445,7 @@ int intel_lpss_probe(struct device *dev,
 err_remove_ltr:
intel_lpss_debugfs_remove(lpss);
intel_lpss_ltr_hide(lpss);
+   intel_lpss_unregister_clock(lpss);
 
 err_clk_register:
ida_simple_remove(&intel_lpss_devid_ida, lpss->devid);




[PATCH 4.4 09/67] mwifiex: fix corner case association failure

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Amitkumar Karwar 

commit a6139b6271f9f95377fe3486aed6120c9142779b upstream.

This patch corrects the error case in association path by returning
-1. Earlier "media_connected" used to remain on in this error case
causing failure for further association attempts.

Signed-off-by: Amitkumar Karwar 
Fixes: b887664d882ee4 ('mwifiex: channel switch handling for station')
Signed-off-by: Cathy Luo 
Signed-off-by: Kalle Valo 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/wireless/mwifiex/sta_ioctl.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -313,6 +313,7 @@ int mwifiex_bss_start(struct mwifiex_pri
mwifiex_dbg(adapter, ERROR,
"Attempt to reconnect on csa closed 
chan(%d)\n",
bss_desc->channel);
+   ret = -1;
goto done;
}
 




[PATCH 4.4 20/67] mac80211: fix statistics leak if dev_alloc_name() fails

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Johannes Berg 

commit e6436be21e77e3659b4ff7e357ab5a8342d132d2 upstream.

In the case that dev_alloc_name() fails, e.g. because the name was
given by the user and already exists, we need to clean up properly
and free the per-CPU statistics. Fix that.

Fixes: 5a490510ba5f ("mac80211: use per-CPU TX/RX statistics")
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/mac80211/iface.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_lo
 
ret = dev_alloc_name(ndev, ndev->name);
if (ret < 0) {
-   free_netdev(ndev);
+   ieee80211_if_free(ndev);
return ret;
}
 
@@ -1836,7 +1836,7 @@ int ieee80211_if_add(struct ieee80211_lo
 
ret = register_netdevice(ndev);
if (ret) {
-   free_netdev(ndev);
+   ieee80211_if_free(ndev);
return ret;
}
}




[PATCH 4.5 05/88] ipvs: correct initial offset of Call-ID header search in SIP persistence engine

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Marco Angaroni 

commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.

The IPVS SIP persistence engine is not able to parse the SIP header
"Call-ID" when such header is inserted in the first positions of
the SIP message.

When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries
in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn

Problematic SIP messages are SIP responses having "Call-ID" header
positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]

When "Call-ID" header is positioned down (after a few other headers)
it is correctly recognized.

This is due to the data offset used in get_callid function call inside
ip_vs_pe_sip.c file: since dptr already points to the start of the
SIP message, the value of dataoff should be initially 0.
Otherwise the header is searched starting from some bytes after the
first character of the SIP message.

Fixes: 758ff0338722 ("IPVS: sip persistence engine")
Signed-off-by: Marco Angaroni 
Acked-by: Julian Anastasov 
Signed-off-by: Simon Horman 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/ipvs/ip_vs_pe_sip.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_p
dptr = skb->data + dataoff;
datalen = skb->len - dataoff;
 
-   if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
+   if (get_callid(dptr, 0, datalen, &matchoff, &matchlen))
return -EINVAL;
 
/* N.B: pe_data is only set on success,




[PATCH 4.5 03/88] net/mlx5_core: Fix caching ATOMIC endian mode capability

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Leon Romanovsky 

commit 91d9ed8443b88cc50b81cf5ec900172515270f6f upstream.

Add caching of maximum device capability of ATOMIC endian mode.

Fixes: f91e6d8941bf ('net/mlx5_core: Add setting ATOMIC endian mode')
Signed-off-by: Leon Romanovsky 
Reviewed-by: Saeed Mahameed 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/mellanox/mlx5/core/main.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -423,6 +423,10 @@ static int handle_hca_cap_atomic(struct
 HCA_CAP_OPMOD_GET_CUR);
if (err)
return err;
+   err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
+HCA_CAP_OPMOD_GET_MAX);
+   if (err)
+   return err;
} else {
return 0;
}




[PATCH 4.4 24/67] mm, cma: prevent nr_isolated_* counters from going negative

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Hugh Dickins 

commit 14af4a5e9b26ad251f81c174e8a43f3e179434a5 upstream.

/proc/sys/vm/stat_refresh warns nr_isolated_anon and nr_isolated_file go
increasingly negative under compaction: which would add delay when
should be none, or no delay when should delay.  The bug in compaction
was due to a recent mmotm patch, but much older instance of the bug was
also noticed in isolate_migratepages_range() which is used for CMA and
gigantic hugepage allocations.

The bug is caused by putback_movable_pages() in an error path
decrementing the isolated counters without them being previously
incremented by acct_isolated().  Fix isolate_migratepages_range() by
removing the error-path putback, thus reaching acct_isolated() with
migratepages still isolated, and leaving putback to caller like most
other places do.

Fixes: edc2ca612496 ("mm, compaction: move pageblock checks up from 
isolate_migratepages_range()")
[vba...@suse.cz: expanded the changelog]
Signed-off-by: Hugh Dickins 
Signed-off-by: Vlastimil Babka 
Acked-by: Joonsoo Kim 
Cc: Michal Hocko 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Greg Kroah-Hartman 

---
 mm/compaction.c |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -880,16 +880,8 @@ isolate_migratepages_range(struct compac
pfn = isolate_migratepages_block(cc, pfn, block_end_pfn,
ISOLATE_UNEVICTABLE);
 
-   /*
-* In case of fatal failure, release everything that might
-* have been isolated in the previous iteration, and signal
-* the failure back to caller.
-*/
-   if (!pfn) {
-   putback_movable_pages(&cc->migratepages);
-   cc->nr_migratepages = 0;
+   if (!pfn)
break;
-   }
 
if (cc->nr_migratepages == COMPACT_CLUSTER_MAX)
break;




[PATCH 4.5 19/88] clk: rockchip: fix wrong mmc phase shift for rk3228

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Shawn Lin 

commit bb07698fc8d13ec74f4f5bd87b04953777ee6982 upstream.

mmc sample shift is 0 for rk3228 refer to user manaul.
So it's broken if we enable mmc tuning for rk3228.

Fixes: 307a2e9ac ("clk: rockchip: add clock controller for rk3228")
Signed-off-by: Shawn Lin 
Reviewed-by: Xing Zheng 
Signed-off-by: Heiko Stuebner 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/clk/rockchip/clk-rk3228.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/clk/rockchip/clk-rk3228.c
+++ b/drivers/clk/rockchip/clk-rk3228.c
@@ -605,13 +605,13 @@ static struct rockchip_clk_branch rk3228
 
/* PD_MMC */
MMC(SCLK_SDMMC_DRV,"sdmmc_drv","sclk_sdmmc", RK3228_SDMMC_CON0, 
1),
-   MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 
1),
+   MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 
0),
 
MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio",  RK3228_SDIO_CON0,  
1),
-   MMC(SCLK_SDIO_SAMPLE,  "sdio_sample",  "sclk_sdio",  RK3228_SDIO_CON1,  
1),
+   MMC(SCLK_SDIO_SAMPLE,  "sdio_sample",  "sclk_sdio",  RK3228_SDIO_CON1,  
0),
 
MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc",  RK3228_EMMC_CON0,  
1),
-   MMC(SCLK_EMMC_SAMPLE,  "emmc_sample",  "sclk_emmc",  RK3228_EMMC_CON1,  
1),
+   MMC(SCLK_EMMC_SAMPLE,  "emmc_sample",  "sclk_emmc",  RK3228_EMMC_CON1,  
0),
 };
 
 static const char *const rk3228_critical_clocks[] __initconst = {




Re: [PATCH v6 0/9] mfd: max8997: Add regmap support

2016-05-09 Thread Lee Jones
On Fri, 06 May 2016, Krzysztof Kozlowski wrote:
> This is a rebase and extension of old Robert Baldyga's work. [0]
> 
> Robert no longer works in Samsung.
> 
> From the original cover letter:
> "This patchset modifies max8997 driver and associated function drivers to use
> register maps instead of operating directly on i2c bus. This change allowed
> to simplify irq handling, and to move some initializations to individual
> function drivers. Hence now when some functions are not enabled, their i2c
> clients, regmaps and irqs are not registered."
> 
> 
> My changes (since Robert's v5)
> ==
> 1. Rebase on v4.6-rc6.
> 2. Collect more acks.
> 3. Add few fixes:
>a. Haptic fix from Marek,
>b. Extcon and RTC fix from me,
>c. DTS fixes from Marek.
> 
> DTS changes are independent but rest of them (extcon/input/MFD) rely
> on each other.
> 
> One way of merging would be to pick everything (except DTS) through
> one tree. Or use tags.

I'd be happy to take the set, once you have collected all Acks.

> Best regards,
> Krzysztof
> 
> [0] http://lkml.iu.edu/hypermail//linux/kernel/1411.1/03152.html
> 
> 
> Krzysztof Kozlowski (3):
>   extcon: max8997: Fix handling error code of regmap_irq_get_virq()
>   rtc: max8997: Check for ERRNO of regmap_irq_get_virq()
>   extcon: max8997: Fix inconsistent indenting
> 
> Marek Szyprowski (3):
>   input: max8997-haptic: Fix NULL pointer dereference
>   ARM: dts: exynos: Fix regulator name to avoid forbidden character on
> exynos4210-trats
>   ARM: dts: exynos: Add interrupt line to MAX8997 PMIC on
> exynos4210-trats
> 
> Robert Baldyga (3):
>   mfd: max8997: Use regmap to access registers
>   mfd: max8997: handle IRQs using regmap
>   mfd: max8997: Change irq names to upper case
> 
>  arch/arm/boot/dts/exynos4210-trats.dts |   4 +-
>  drivers/extcon/extcon-max8997.c|  72 ---
>  drivers/input/misc/max8997_haptic.c|  40 ++--
>  drivers/leds/leds-max8997.c|  13 +-
>  drivers/mfd/Kconfig|   3 +-
>  drivers/mfd/Makefile   |   2 +-
>  drivers/mfd/max8997-irq.c  | 383 
> -
>  drivers/mfd/max8997.c  | 245 ++---
>  drivers/power/max8997_charger.c|  33 +--
>  drivers/regulator/max8997.c|  87 
>  drivers/rtc/rtc-max8997.c  |  60 +++---
>  include/linux/mfd/max8997-private.h|  82 +--
>  12 files changed, 392 insertions(+), 632 deletions(-)
>  delete mode 100644 drivers/mfd/max8997-irq.c
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[PATCH 4.4 22/67] MD: make bio mergeable

2016-05-09 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Shaohua Li 

commit 9c573de3283af007ea11c17bde1e4568d9417328 upstream.

blk_queue_split marks bio unmergeable, which makes sense for normal bio.
But if dispatching the bio to underlayer disk, the blk_queue_split
checks are invalid, hence it's possible the bio becomes mergeable.

In the reported bug, this bug causes trim against raid0 performance slash
https://bugzilla.kernel.org/show_bug.cgi?id=117051

Reported-and-tested-by: Park Ju Hyung 
Fixes: 6ac45aeb6bca(block: avoid to merge splitted bio)
Cc: Ming Lei 
Cc: Neil Brown 
Reviewed-by: Jens Axboe 
Signed-off-by: Shaohua Li 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/md/md.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -293,6 +293,8 @@ static blk_qc_t md_make_request(struct r
 * go away inside make_request
 */
sectors = bio_sectors(bio);
+   /* bio could be mergeable after passing to underlayer */
+   bio->bi_rw &= ~REQ_NOMERGE;
mddev->pers->make_request(mddev, bio);
 
cpu = part_stat_lock();




[PATCH] zsmalloc: fix zs_can_compact() integer overflow

2016-05-09 Thread Sergey Senozhatsky
zs_can_compact() has two race conditions in its core calculation:

unsigned long obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
zs_stat_get(class, OBJ_USED);

1) classes are not locked, so the numbers of allocated and used
   objects can change by the concurrent ops happening on other CPUs
2) shrinker invokes it from preemptible context

Depending on the circumstances, OBJ_ALLOCATED can become less
than OBJ_USED, which can result in either very high or negative
`total_scan' value calculated in do_shrink_slab().

Take a pool stat snapshot and use it instead of racy zs_stat_get()
calls.

Signed-off-by: Sergey Senozhatsky 
Cc: Minchan Kim 
Cc: [4.3+]
---
 mm/zsmalloc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 107ec06..1bc2a98 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2262,10 +2262,13 @@ static void SetZsPageMovable(struct zs_pool *pool, 
struct zspage *zspage)
 static unsigned long zs_can_compact(struct size_class *class)
 {
unsigned long obj_wasted;
+   unsigned long obj_allocated = zs_stat_get(class, OBJ_ALLOCATED);
+   unsigned long obj_used = zs_stat_get(class, OBJ_USED);
 
-   obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
-   zs_stat_get(class, OBJ_USED);
+   if (obj_allocated <= obj_used)
+   return 0;
 
+   obj_wasted = obj_allocated - obj_used;
obj_wasted /= get_maxobj_per_zspage(class->size,
class->pages_per_zspage);
 
-- 
2.8.2



[PATCH 4.5 02/88] RDMA/iw_cxgb4: Fix bar2 virt addr calculation for T4 chips

2016-05-09 Thread Greg Kroah-Hartman
4.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Hariprasad S 

commit 32cc92c7b5e52357a0a24010bae9eb257fa75d3e upstream.

For T4, kernel mode qps don't use the user doorbell. User mode qps during
flow control db ringing are forced into kernel, where user doorbell is
treated as kernel doorbell and proper bar2 offset in bar2 virtual space is
calculated, which incase of T4 is a bogus address, causing a kernel panic
due to illegal write during doorbell ringing.
In case of T4, kernel mode qp bar2 virtual address should be 0. Added T4
check during bar2 virtual address calculation to return 0. Fixed Bar2
range checks based on bar2 physical address.

The below oops will be fixed

  <1>BUG: unable to handle kernel paging request at 0002aa08
  <1>IP: [] c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4>PGD 1416a8067 PUD 15bf35067 PMD 0
  <4>Oops: 0002 [#1] SMP
  <4>last sysfs file:
  /sys/devices/pci:00/:00:03.0/:02:00.4/infiniband/cxgb4_0/node_guid
  <4>CPU 5
  <4>Modules linked in: rdma_ucm rdma_cm ib_cm ib_sa ib_mad ib_uverbs
  ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE
  iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack
  ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables bridge autofs4
  target_core_iblock target_core_file target_core_pscsi target_core_mod
  configfs bnx2fc cnic uio fcoe libfcoe libfc scsi_transport_fc scsi_tgt 8021q
  garp stp llc cpufreq_ondemand acpi_cpufreq freq_table mperf vhost_net macvtap
  macvlan tun kvm uinput microcode iTCO_wdt iTCO_vendor_support sg joydev
  serio_raw i2c_i801 i2c_core lpc_ich mfd_core e1000e ptp pps_core ioatdma dca
  i7core_edac edac_core shpchp ext3 jbd mbcache sd_mod crc_t10dif pata_acpi
  ata_generic ata_piix iw_cxgb4 iw_cm ib_core ib_addr cxgb4 ipv6 dm_mirror
  dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
  <4>
  Supermicro X8ST3/X8ST3
  <4>RIP: 0010:[]  []
  c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4>RSP: :880155a03db0  EFLAGS: 00010006
  <4>RAX: 001d RBX: 88013ae5fc00 RCX: 880155adb180
  <4>RDX: 0002aa00 RSI: 0001 RDI: 88013ae5fdf8
  <4>RBP: 880155a03e10 R08:  R09: 0001
  <4>R10:  R11:  R12: 
  <4>R13: 001d R14: 880156414ab0 R15: e8c05b88
  <4>FS:  () GS:8800282a() 
knlGS:
  <4>CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
  <4>CR2: 0002aa08 CR3: 00015bd0e000 CR4: 07e0
  <4>DR0:  DR1:  DR2: 
  <4>DR3:  DR6: 0ff0 DR7: 0400
  <4>Process cxgb4 (pid: 394, threadinfo 880155a0, task 
880156414ab0)
  <4>Stack:
  <4> 880156415068 880155adb180 880155a03df0 a00a344b
  <4> 03e8 88015592 0004 88015592
  <4> 88015592d438 a00a3860 880155a03fd8 e8c05b88
  <4>Call Trace:
  <4> [] ? enable_txq_db+0x2b/0x80 [cxgb4]
  <4> [] ? process_db_full+0x0/0xa0 [cxgb4]
  <4> [] process_db_full+0x46/0xa0 [cxgb4]
  <4> [] worker_thread+0x170/0x2a0
  <4> [] ? autoremove_wake_function+0x0/0x40
  <4> [] ? worker_thread+0x0/0x2a0
  <4> [] kthread+0x9e/0xc0
  <4> [] child_rip+0xa/0x20
  <4> [] ? kthread+0x0/0xc0
  <4> [] ? child_rip+0x0/0x20
  <4>Code: e9 ba 00 00 00 66 0f 1f 44 00 00 44 8b 05 29 07 02 00 45 85 c0 0f 85
  71 02 00 00 8b 83 70 01 00 00 45 0f b7 ed c1 e0 0f 44 09 e8 <89> 42 08 0f ae 
f8
  66 c7 83 82 01 00 00 00 00 44 0f b7 ab dc 01
  <1>RIP  [] c4iw_uld_control+0x4e0/0x880 [iw_cxgb4]
  <4> RSP 
  <4>CR2: 0002aa08`

Based on original work by Bharat Potnuri 

Fixes: 74217d4c6a4fb0d8 ("iw_cxgb4: support for bar2 qid densities exceeding 
the page size")

Signed-off-by: Steve Wise 
Signed-off-by: Hariprasad Shenai 
Reviewed-by: Leon Romanovsky 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/infiniband/hw/cxgb4/cq.c |2 +-
 drivers/infiniband/hw/cxgb4/qp.c |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -162,7 +162,7 @@ static int create_cq(struct c4iw_rdev *r
cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS,
  &cq->bar2_qid,
  user ? &cq->bar2_pa : NULL);
-   if (user && !cq->bar2_va) {
+   if (user && !cq->bar2_pa) {
pr_warn(MOD "%s: cqid %u not in BAR2 range.\n",
pci_name(rdev->lldi.pdev), cq->cqid);
ret = -EINVAL;
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -185,6 +185,10 @@ void __iomem *c4iw_bar2_addrs(struct c4i
 
if (pbar2_pa)
*pbar2_pa = (rdev->bar2_pa + bar2_qoffset) 

  1   2   3   4   5   6   7   8   9   10   >