firefly-linux-kernel-4.4.55.git
10 years agoipc: fix compat msgrcv with negative msgtyp
Mateusz Guzik [Tue, 28 Jan 2014 01:07:11 +0000 (17:07 -0800)]
ipc: fix compat msgrcv with negative msgtyp

Compat function takes msgtyp argument as u32 and passes it down to
do_msgrcv which results in casting to long, thus the sign is lost and we
get a big positive number instead.

Cast the argument to signed type before passing it down.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Reported-by: Gabriellla Schmidt <gsc@bruker.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc,msg: document barriers
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:10 +0000 (17:07 -0800)]
ipc,msg: document barriers

Both expunge_all() and pipeline_send() rely on both a nil msg value and
a full barrier to guarantee the correct ordering when waking up a task.

While its counterpart at the receiving end is well documented for the
lockless recv algorithm, we still need to document these specific
smp_mb() calls.

[akpm@linux-foundation.org: fix typo, per Mike]
[akpm@linux-foundation.org: mroe tpyos]
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: delete seq_max field in struct ipc_ids
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:09 +0000 (17:07 -0800)]
ipc: delete seq_max field in struct ipc_ids

This field is only used to reset the ids seq number if it exceeds the
smaller of INT_MAX/SEQ_MULTIPLIER and USHRT_MAX, and can therefore be
moved out of the structure and into its own macro.  Since each
ipc_namespace contains a table of 3 pointers to struct ipc_ids we can
save space in instruction text:

   text    data     bss     dec     hex filename
  56232    2348      24   58604    e4ec ipc/built-in.o
  56216    2348      24   58588    e4dc ipc/built-in.o-after

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Reviewed-by: Jonathan Gonzalez <jgonzalez@linets.cl>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: simplify sysvipc_proc_open() return
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:08 +0000 (17:07 -0800)]
ipc: simplify sysvipc_proc_open() return

Get rid of silly/useless label jumping.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: remove useless return statement
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:07 +0000 (17:07 -0800)]
ipc: remove useless return statement

Only found in ipc_rmid().

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: remove braces for single statements
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:06 +0000 (17:07 -0800)]
ipc: remove braces for single statements

Deal with checkpatch messages:
     WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: standardize code comments
Davidlohr Bueso [Tue, 28 Jan 2014 01:07:05 +0000 (17:07 -0800)]
ipc: standardize code comments

IPC commenting style is all over the place, *specially* in util.c.  This
patch orders things a bit.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: whitespace cleanup
Manfred Spraul [Tue, 28 Jan 2014 01:07:04 +0000 (17:07 -0800)]
ipc: whitespace cleanup

The ipc code does not adhere the typical linux coding style.
This patch fixes lots of simple whitespace errors.

- mostly autogenerated by
  scripts/checkpatch.pl -f --fix \
--types=pointer_location,spacing,space_before_tab
- one manual fixup (keep structure members tab-aligned)
- removal of additional space_before_tab that were not found by --fix

Tested with some of my msg and sem test apps.

Andrew: Could you include it in -mm and move it towards Linus' tree?

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Suggested-by: Li Bin <huawei.libin@huawei.com>
Cc: Joe Perches <joe@perches.com>
Acked-by: Rafael Aquini <aquini@redhat.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: change kern_ipc_perm.deleted type to bool
Rafael Aquini [Tue, 28 Jan 2014 01:07:02 +0000 (17:07 -0800)]
ipc: change kern_ipc_perm.deleted type to bool

struct kern_ipc_perm.deleted is meant to be used as a boolean toggle, and
the changes introduced by this patch are just to make the case explicit.

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Acked-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc: introduce ipc_valid_object() helper to sort out IPC_RMID races
Rafael Aquini [Tue, 28 Jan 2014 01:07:01 +0000 (17:07 -0800)]
ipc: introduce ipc_valid_object() helper to sort out IPC_RMID races

After the locking semantics for the SysV IPC API got improved, a couple
of IPC_RMID race windows were opened because we ended up dropping the
'kern_ipc_perm.deleted' check performed way down in ipc_lock().  The
spotted races got sorted out by re-introducing the old test within the
racy critical sections.

This patch introduces ipc_valid_object() to consolidate the way we cope
with IPC_RMID races by using the same abstraction across the API
implementation.

Signed-off-by: Rafael Aquini <aquini@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Greg Thelen <gthelen@google.com>
Reviewed-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoipc/sem.c: avoid overflow of semop undo (semadj) value
Petr Mladek [Tue, 28 Jan 2014 01:07:00 +0000 (17:07 -0800)]
ipc/sem.c: avoid overflow of semop undo (semadj) value

When trying to understand semop code, I found a small mistake in the check
for semadj (undo) value overflow.  The new undo value is not stored
immediately and next potential checks are done against the old value.

The failing scenario is not much practical.  One semop call has to do more
operations on the same semaphore.  Also semval and semadj must have
different values, so there has to be some operations without SEM_UNDO
flag.  For example:

struct sembuf depositor_op[1];
struct sembuf collector_op[2];

depositor_op[0].sem_num = 0;
depositor_op[0].sem_op = 20000;
depositor_op[0].sem_flg = 0;

collector_op[0].sem_num = 0;
collector_op[0].sem_op = -10000;
collector_op[0].sem_flg = SEM_UNDO;
collector_op[1].sem_num = 0;
collector_op[1].sem_op = -10000;
collector_op[1].sem_flg = SEM_UNDO;

if (semop(semid, depositor_op, 1) == -1)
{ perror("Failed to do 1st deposit"); return 1; }

if (semop(semid, collector_op, 2) == -1)
{ perror("Failed to do 1st collect"); return 1; }

if (semop(semid, depositor_op, 1) == -1)
{ perror("Failed to do 2nd deposit"); return 1; }

if (semop(semid, collector_op, 2) == -1)
{ perror("Failed to do 2nd collect"); return 1; }

return 0;

It passes without error now but the semadj value has overflown in the 2nd
collector operation.

[akpm@linux-foundation.org: restore lessened scope of local `undo']
[davidlohr@hp.com: correct header comment for perform_atomic_semop]
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Davidlohr Bueso <davidlohr@hp.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoinit/main.c: remove unused declaractions of mca_init() and sbus_init()
Kang Hu [Tue, 28 Jan 2014 01:07:00 +0000 (17:07 -0800)]
init/main.c: remove unused declaractions of mca_init() and sbus_init()

mca_init() no longer exists.
sbus_init() is defined in arch/sparc/kernel/sbus.c and is a subsys_initcall.
both are not needed in main.c any more.

Signed-off-by: Kang Hu <hukangustc@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agodynamic_debug: replace obselete simple_strtoul() with kstrtouint()
Andrey Ryabinin [Tue, 28 Jan 2014 01:06:59 +0000 (17:06 -0800)]
dynamic_debug: replace obselete simple_strtoul() with kstrtouint()

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agodynamic_debug: fix ddebug_parse_query()
Andrey Ryabinin [Tue, 28 Jan 2014 01:06:58 +0000 (17:06 -0800)]
dynamic_debug: fix ddebug_parse_query()

This fixes following scenario:

  $ echo 'file dynamic_debug.c line 1-123 +p' > /sys/kernel/debug/dynamic_debug/control
  -bash: echo: write error: Invalid argument
  $ dmesg | grep dynamic_debug
  dynamic_debug:ddebug_parse_query: last-line:123 < 1st-line:1
  dynamic_debug:ddebug_parse_query: query parse failed

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agodynamic_debug: remove wrong error message
Andrey Ryabinin [Tue, 28 Jan 2014 01:06:57 +0000 (17:06 -0800)]
dynamic_debug: remove wrong error message

parse_lineno() returns either negative error code or zero.  We don't
need to print something here because if parse_lineno fails it will print
error message.

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoocfs2: do not log ENOENT in unlink()
Xiaowei.Hu [Tue, 28 Jan 2014 01:06:56 +0000 (17:06 -0800)]
ocfs2: do not log ENOENT in unlink()

Suppress log message like this: (open_delete,8328,0):ocfs2_unlink:951
ERROR: status = -2

Orabug:17445485

Signed-off-by: Xiaowei Hu <xiaowei.hu@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agomm: bring back /sys/kernel/mm
Hugh Dickins [Tue, 28 Jan 2014 01:06:55 +0000 (17:06 -0800)]
mm: bring back /sys/kernel/mm

Commit da29bd36224b ("mm/mm_init.c: make creation of the mm_kobj happen
earlier than device_initcall") changed to pure_initcall(mm_sysfs_init).

That's too early: mm_sysfs_init() depends on core_initcall(ksysfs_init)
to have made the kernel_kobj directory "kernel" in which to create "mm".

Make it postcore_initcall(mm_sysfs_init).  We could use core_initcall(),
and depend upon Makefile link order kernel/ mm/ fs/ ipc/ security/ ...
as core_initcall(debugfs_init) and core_initcall(securityfs_init) do;
but better not.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoarch/unicore32/kernel/early_printk.c:setup_early_printk: missing initialization
Heinrich Schuchardt [Tue, 28 Jan 2014 01:06:54 +0000 (17:06 -0800)]
arch/unicore32/kernel/early_printk.c:setup_early_printk: missing initialization

It is based on uninitialized value keep_early.  This leads to
unpredictable result.

[akpm@linux-foundation.org: simplify code]
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoRevert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"
malc [Tue, 28 Jan 2014 01:06:53 +0000 (17:06 -0800)]
Revert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"

Revert commit ece86e222db4, which was intended as a small performance
improvement.

Despite the claim that the patch doesn't introduce any functional
changes in fact it does.

The "no page" path behaves different now.  Originally, vmalloc_to_page
might return NULL under some conditions, with new implementation it
returns pfn_to_page(0) which is not the same as NULL.

Simple test shows the difference.

test.c

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>

int __init myi(void)
{
struct page *p;
void *v;

v = vmalloc(PAGE_SIZE);
/* trigger the "no page" path in vmalloc_to_page*/
vfree(v);

p = vmalloc_to_page(v);

pr_err("expected val = NULL, returned val = %p", p);

return -EBUSY;
}

void __exit mye(void)
{

}
module_init(myi)
module_exit(mye)

Before interchange:
expected val = NULL, returned val =   (null)

After interchange:
expected val = NULL, returned val = c7ebe000

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Cc: Jianyu Zhan <nasa4836@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agomemblock: don't silently align size in memblock_virt_alloc()
Yinghai Lu [Tue, 28 Jan 2014 01:06:52 +0000 (17:06 -0800)]
memblock: don't silently align size in memblock_virt_alloc()

In original __alloc_memory_core_early() for bootmem wrapper, we do not
align size silently.

We should not do that, as later free with old size will leave some range
not freed.

It's obvious that code is copied from memblock_base_nid(), and that code
is wrong for the same reason.

Also remove that in memblock_alloc_base.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agox86: revert wrong memblock current limit setting
Yinghai Lu [Tue, 28 Jan 2014 01:06:50 +0000 (17:06 -0800)]
x86: revert wrong memblock current limit setting

Dave reported big numa system booting is broken.

It turns out that commit 5b6e529521d3 ("x86: memblock: set current limit
to max low memory address") sets the limit to low wrongly.

max_low_pfn_mapped is different from max_pfn_mapped.
max_low_pfn_mapped is always under 4G.

That will memblock_alloc_nid all go under 4G.

Revert 5b6e529521d3 to fix a no-boot regression which was triggered by
457ff1de2d24 ("lib/swiotlb.c: use memblock apis for early memory
allocations").

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reported-by: Dave Hansen <dave.hansen@intel.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agomemblock, nobootmem: add memblock_virt_alloc_low()
Yinghai Lu [Tue, 28 Jan 2014 01:06:49 +0000 (17:06 -0800)]
memblock, nobootmem: add memblock_virt_alloc_low()

The new memblock_virt APIs are used to replaced old bootmem API.

We need to allocate page below 4G for swiotlb.

That should fix regression on Andrew's system that is using swiotlb.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agonet: Document promote_secondaries
Martin Schwenke [Tue, 28 Jan 2014 04:26:42 +0000 (15:26 +1100)]
net: Document promote_secondaries

From 038a821667f62c496f2bbae27081b1b612122a97 Mon Sep 17 00:00:00 2001
From: Martin Schwenke <martin@meltin.net>
Date: Tue, 28 Jan 2014 15:16:49 +1100
Subject: [PATCH] net: Document promote_secondaries

This option was added a long time ago...

  commit 8f937c6099858eee15fae14009dcbd05177fa91d
  Author: Harald Welte <laforge@gnumonks.org>
  Date:   Sun May 29 20:23:46 2005 -0700

    [IPV4]: Primary and secondary addresses

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: gre: use icmp_hdr() to get inner ip header
Duan Jiong [Tue, 28 Jan 2014 03:49:43 +0000 (11:49 +0800)]
net: gre: use icmp_hdr() to get inner ip header

When dealing with icmp messages, the skb->data points the
ip header that triggered the sending of the icmp message.

In gre_cisco_err(), the parse_gre_header() is called, and the
iptunnel_pull_header() is called to pull the skb at the end of
the parse_gre_header(), so the skb->data doesn't point the
inner ip header.

Unfortunately, the ipgre_err still needs those ip addresses in
inner ip header to look up tunnel by ip_tunnel_lookup().

So just use icmp_hdr() to get inner ip header instead of skb->data.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: Add missing braces to i40e_dcb_need_reconfig()
Dave Jones [Tue, 28 Jan 2014 04:11:09 +0000 (23:11 -0500)]
i40e: Add missing braces to i40e_dcb_need_reconfig()

Indentation mismatch spotted with Coverity.
Introduced in 4e3b35b044ea ("i40e: add DCB and DCBNL support")

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoxen-netfront: fix resource leak in netfront
Annie Li [Tue, 28 Jan 2014 03:35:42 +0000 (11:35 +0800)]
xen-netfront: fix resource leak in netfront

This patch removes grant transfer releasing code from netfront, and uses
gnttab_end_foreign_access to end grant access since
gnttab_end_foreign_access_ref may fail when the grant entry is
currently used for reading or writing.

* clean up grant transfer code kept from old netfront(2.6.18) which grants
pages for access/map and transfer. But grant transfer is deprecated in current
netfront, so remove corresponding release code for transfer.

* fix resource leak, release grant access (through gnttab_end_foreign_access)
and skb for tx/rx path, use get_page to ensure page is released when grant
access is completed successfully.

Xen-blkfront/xen-tpmfront/xen-pcifront also have similar issue, but patches
for them will be created separately.

V6: Correct subject line and commit message.

V5: Remove unecessary change in xennet_end_access.

V4: Revert put_page in gnttab_end_foreign_access, and keep netfront change in
single patch.

V3: Changes as suggestion from David Vrabel, ensure pages are not freed untill
grant acess is ended.

V2: Improve patch comments.

Signed-off-by: Annie Li <annie.li@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agopowerpc: Implement arch_spin_is_locked() using arch_spin_value_unlocked()
Michael Ellerman [Wed, 15 Jan 2014 07:14:29 +0000 (18:14 +1100)]
powerpc: Implement arch_spin_is_locked() using arch_spin_value_unlocked()

At a glance these are just the inverse of each other. The one subtlety
is that arch_spin_value_unlocked() takes the lock by value, rather than
as a pointer, which is important for the lockref code.

On the other hand arch_spin_is_locked() doesn't really care, so
implement it in terms of arch_spin_value_unlocked().

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agopowerpc: Add support for the optimised lockref implementation
Michael Ellerman [Wed, 15 Jan 2014 07:14:28 +0000 (18:14 +1100)]
powerpc: Add support for the optimised lockref implementation

This commit adds the architecture support required to enable the
optimised implementation of lockrefs.

That's as simple as defining arch_spin_value_unlocked() and selecting
the Kconfig option.

We also define cmpxchg64_relaxed(), because the lockref code does not
need the cmpxchg to have barrier semantics.

Using Linus' test case[1] on one system I see a 4x improvement for the
basic enablement, and a further 1.3x for cmpxchg64_relaxed(), for a
total of 5.3x vs the baseline.

On another system I see more like 2x improvement.

[1]: http://marc.info/?l=linux-fsdevel&m=137782380714721&w=4

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
10 years agoleds: s3c24xx: Remove hardware.h inclusion
Sachin Kamat [Fri, 3 Jan 2014 06:30:04 +0000 (22:30 -0800)]
leds: s3c24xx: Remove hardware.h inclusion

The contents of this header file is not referenced in the led driver.
Remove its inclusion. While at it, re-arrange the headers as per the
category.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: replace list_for_each with list_for_each_entry
ZHAO Gang [Sat, 28 Dec 2013 15:00:26 +0000 (07:00 -0800)]
leds: replace list_for_each with list_for_each_entry

Use the more convenient macro.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: kirkwood: Cleanup in header files
Sachin Kamat [Thu, 2 Jan 2014 09:58:45 +0000 (01:58 -0800)]
leds: kirkwood: Cleanup in header files

Commit c02cecb92ed4 ("ARM: orion: move platform_data definitions")
moved the files to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: pwm: Remove a warning on non-DT platforms
Olof Johansson [Thu, 12 Dec 2013 00:11:42 +0000 (16:11 -0800)]
leds: pwm: Remove a warning on non-DT platforms

This removes a warning on non-DT-enabled platforms:

drivers/leds/leds-pwm.c: In function 'led_pwm_create_of':
drivers/leds/leds-pwm.c:88:22: warning: unused variable 'node'

Really caused by the local variable that is assigned to and then never
used. Just do away with the local var, it's not needed.

Technically this code path can never be entered without DT enabled,
since there's an earlier check about number of children in the calling
function, but the compiler can't see that.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: leds-pwm: fix duty time overflow.
Xiubo Li [Wed, 11 Dec 2013 09:19:42 +0000 (01:19 -0800)]
leds: leds-pwm: fix duty time overflow.

Overflow maybe occurs when calculates the duty time. For instance,
the period time is 990000000ns, and the max_brightness is 127, when
setting the brightness to 12, the duty value will be 25906026ns, but
it should be 93543307ns.

Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: leds-mc13783: Remove unneeded mc13xxx_{un}lock
Alexander Shiyan [Sat, 7 Dec 2013 06:22:19 +0000 (22:22 -0800)]
leds: leds-mc13783: Remove unneeded mc13xxx_{un}lock

LED registers are used only in this driver, so no additional
locking is needed. Read-Modify-Write cycle in workqueue is already
protected by regmap.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: leds-mc13783: Remove duplicate field in platform data
Alexander Shiyan [Sat, 7 Dec 2013 06:22:18 +0000 (22:22 -0800)]
leds: leds-mc13783: Remove duplicate field in platform data

LED platform data are overwhelmed by excessive field "max_cur"
which just replicates few bits of "led_control" field.
This patch removes this field and adds a definition for the
current settings in the header.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agodrivers: leds: leds-tca6507: check CONFIG_GPIOLIB whether defined for 'gpio_base'
Chen Gang [Mon, 9 Dec 2013 04:41:37 +0000 (20:41 -0800)]
drivers: leds: leds-tca6507: check CONFIG_GPIOLIB whether defined for 'gpio_base'

Need check CONFIG_GPIOLIB whether defined, just like another area has
done within this file. Or can not pass compiling when CONFIG_GPIOLIB
disabled.

The related error (with allmodconfig for metag):

    CC [M]  drivers/leds/leds-tca6507.o
  drivers/leds/leds-tca6507.c: In function 'tca6507_led_dt_init':
  drivers/leds/leds-tca6507.c:731: error: 'struct tca6507_platform_data' has no member named 'gpio_base'

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: lp5523: Support LED MUX configuration on running a pattern
Milo Kim [Thu, 21 Nov 2013 06:14:34 +0000 (22:14 -0800)]
leds: lp5523: Support LED MUX configuration on running a pattern

There are two ways to run a pattern in LP5523.
One is using legacy sysfs files such as 'enginex_mode','enginex_load' and
'enginex_leds'. ('x' is from 1 to 3).
Among them, 'enginex_leds' are used for selecting specific LED channel MUX.
(MUX means which LEDs are used for running a pattern from LED 1 to 9.)

The other way is using the firmware interface.
In this mode, the default LED MUX strings are used.
In other words, LED MUX is not configurable on the fly.

This patch enables dynamic LED MUX configuration when the firmware is loaded.
By accessing the sysfs file 'enginex_leds', the LED channels can be configured.
To synchronize the operation mode, each engine mode should be set to 'LOAD'.

The documentation is updated as well.

Cc: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoleds: lp5521/5523: Fix multiple engine usage bug
Milo Kim [Thu, 21 Nov 2013 06:13:34 +0000 (22:13 -0800)]
leds: lp5521/5523: Fix multiple engine usage bug

Whenever the engine is loaded by the user-application, the operation mode is
reset first. But it has a problem in case of multiple engine used because
previous engine settings are cleared.
The driver should update not whole 8bits but each engine bit by masking.

On the other hands, whole engines should be reset when the driver is unloaded
and on initializing the LP5523 driver.
So, new functions are used for this handling - lp5521/5523_stop_all_engines().

Cc: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoLEDS: tca6507 - fix up some comments.
NeilBrown [Wed, 13 Nov 2013 05:52:43 +0000 (21:52 -0800)]
LEDS: tca6507 - fix up some comments.

In particular fix the capitalisation of GPIO and LED and
correct TCA6507_MAKE_CPIO, but also rewrite the comment about
platform-data to include reference to devicetree.

Also re-wrap comments to fit 80 columns.

Reported-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoLEDS: tca6507: add device-tree support for GPIO configuration.
NeilBrown [Fri, 1 Nov 2013 02:41:20 +0000 (19:41 -0700)]
LEDS: tca6507: add device-tree support for GPIO configuration.

The 7 lines driven by the TCA6507 can either drive LEDs or act as output-only
GPIOs.

To make this distinction in devicetree we use the "compatible" property.

If the device attached to a line is "compatible" with "gpio", we treat it
like a GPIO.  If it is "compatible" with "led" (or if no "compatible" value
is set) we treat it like an LED.

(cooloney@gmail.com: fix typo in the subject)

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agoLEDS: tca6507 - fix bugs in parsing of device-tree configuration.
NeilBrown [Fri, 1 Nov 2013 02:33:45 +0000 (19:33 -0700)]
LEDS: tca6507 - fix bugs in parsing of device-tree configuration.

1/ The led_info array must be allocated to allow the full number
  of LEDs even if not all are present.  The array maybe be sparsely
  filled but it is indexed by device address so we must at least
  allocate as many slots as the highest address used.  It is easiest
  just to allocate all 7.

2/ range check the 'reg' value properly.

3/ led.flags must be initialised to zero, else all leds could
   be treated as GPIOs (depending on what happens to be on the stack).

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
10 years agonet: 6lowpan: fixup for code movement
Stephen Rothwell [Tue, 7 Jan 2014 01:52:43 +0000 (12:52 +1100)]
net: 6lowpan: fixup for code movement

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agohyperv: Add support for physically discontinuous receive buffer
Haiyang Zhang [Mon, 27 Jan 2014 23:03:42 +0000 (15:03 -0800)]
hyperv: Add support for physically discontinuous receive buffer

This will allow us to use bigger receive buffer, and prevent allocation failure
due to fragmented memory.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosky2: initialize napi before registering device
Stanislaw Gruszka [Sat, 25 Jan 2014 10:34:54 +0000 (11:34 +0100)]
sky2: initialize napi before registering device

There is race condition when call netif_napi_add() after
register_netdevice(), as ->open() can be called without napi initialized
and trigger BUG_ON() on napi_enable(), like on below messages:

[    9.699863] sky2: driver version 1.30
[    9.699960] sky2 0000:02:00.0: Yukon-2 EC Ultra chip revision 2
[    9.700020] sky2 0000:02:00.0: irq 45 for MSI/MSI-X
[    9.700498] ------------[ cut here ]------------
[    9.703391] kernel BUG at include/linux/netdevice.h:501!
[    9.703391] invalid opcode: 0000 [#1] PREEMPT SMP
<snip>
[    9.830018] Call Trace:
[    9.830018]  [<fa996169>] sky2_open+0x309/0x360 [sky2]
[    9.830018]  [<c1007210>] ? via_no_dac+0x40/0x40
[    9.830018]  [<c1007210>] ? via_no_dac+0x40/0x40
[    9.830018]  [<c135ed4b>] __dev_open+0x9b/0x120
[    9.830018]  [<c1431cbe>] ? _raw_spin_unlock_bh+0x1e/0x20
[    9.830018]  [<c135efd9>] __dev_change_flags+0x89/0x150
[    9.830018]  [<c135f148>] dev_change_flags+0x18/0x50
[    9.830018]  [<c13bb8e0>] devinet_ioctl+0x5d0/0x6e0
[    9.830018]  [<c13bcced>] inet_ioctl+0x6d/0xa0

To fix the problem patch changes the order of initialization.

Bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=67151

Reported-and-tested-by: ebrahim.azarisooreh@gmail.com
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: Fix memory leak if TPROXY used with TCP early demux
Holger Eitzenberger [Mon, 27 Jan 2014 09:33:18 +0000 (10:33 +0100)]
net: Fix memory leak if TPROXY used with TCP early demux

I see a memory leak when using a transparent HTTP proxy using TPROXY
together with TCP early demux and Kernel v3.8.13.15 (Ubuntu stable):

unreferenced object 0xffff88008cba4a40 (size 1696):
  comm "softirq", pid 0, jiffies 4294944115 (age 8907.520s)
  hex dump (first 32 bytes):
    0a e0 20 6a 40 04 1b 37 92 be 32 e2 e8 b4 00 00  .. j@..7..2.....
    02 00 07 01 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff810b710a>] kmem_cache_alloc+0xad/0xb9
    [<ffffffff81270185>] sk_prot_alloc+0x29/0xc5
    [<ffffffff812702cf>] sk_clone_lock+0x14/0x283
    [<ffffffff812aaf3a>] inet_csk_clone_lock+0xf/0x7b
    [<ffffffff8129a893>] netlink_broadcast+0x14/0x16
    [<ffffffff812c1573>] tcp_create_openreq_child+0x1b/0x4c3
    [<ffffffff812c033e>] tcp_v4_syn_recv_sock+0x38/0x25d
    [<ffffffff812c13e4>] tcp_check_req+0x25c/0x3d0
    [<ffffffff812bf87a>] tcp_v4_do_rcv+0x287/0x40e
    [<ffffffff812a08a7>] ip_route_input_noref+0x843/0xa55
    [<ffffffff812bfeca>] tcp_v4_rcv+0x4c9/0x725
    [<ffffffff812a26f4>] ip_local_deliver_finish+0xe9/0x154
    [<ffffffff8127a927>] __netif_receive_skb+0x4b2/0x514
    [<ffffffff8127aa77>] process_backlog+0xee/0x1c5
    [<ffffffff8127c949>] net_rx_action+0xa7/0x200
    [<ffffffff81209d86>] add_interrupt_randomness+0x39/0x157

But there are many more, resulting in the machine going OOM after some
days.

From looking at the TPROXY code, and with help from Florian, I see
that the memory leak is introduced in tcp_v4_early_demux():

  void tcp_v4_early_demux(struct sk_buff *skb)
  {
    /* ... */

    iph = ip_hdr(skb);
    th = tcp_hdr(skb);

    if (th->doff < sizeof(struct tcphdr) / 4)
        return;

    sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
                       iph->saddr, th->source,
                       iph->daddr, ntohs(th->dest),
                       skb->skb_iif);
    if (sk) {
        skb->sk = sk;

where the socket is assigned unconditionally to skb->sk, also bumping
the refcnt on it.  This is problematic, because in our case the skb
has already a socket assigned in the TPROXY target.  This then results
in the leak I see.

The very same issue seems to be with IPv6, but haven't tested.

Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agolibceph: support CEPH_FEATURE_OSD_CACHEPOOL feature
Ilya Dryomov [Mon, 27 Jan 2014 15:40:20 +0000 (17:40 +0200)]
libceph: support CEPH_FEATURE_OSD_CACHEPOOL feature

Announce our (limited, see previous commit) support for CACHEPOOL
feature.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: follow redirect replies from osds
Ilya Dryomov [Mon, 27 Jan 2014 15:40:20 +0000 (17:40 +0200)]
libceph: follow redirect replies from osds

Follow redirect replies from osds, for details see ceph.git commit
fbbe3ad1220799b7bb00ea30fce581c5eadaf034.

v1 (current) version of redirect reply consists of oloc and oid, which
expands to pool, key, nspace, hash and oid.  However, server-side code
that would populate anything other than pool doesn't exist yet, and
hence this commit adds support for pool redirects only.  To make sure
that future server-side updates don't break us, we decode all fields
and, if any of key, nspace, hash or oid have a non-default value, error
out with "corrupt osd_op_reply ..." message.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: rename ceph_osd_request::r_{oloc,oid} to r_base_{oloc,oid}
Ilya Dryomov [Mon, 27 Jan 2014 15:40:20 +0000 (17:40 +0200)]
libceph: rename ceph_osd_request::r_{oloc,oid} to r_base_{oloc,oid}

Rename ceph_osd_request::r_{oloc,oid} to r_base_{oloc,oid} before
introducing r_target_{oloc,oid} needed for redirects.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: follow {read,write}_tier fields on osd request submission
Ilya Dryomov [Mon, 27 Jan 2014 15:40:19 +0000 (17:40 +0200)]
libceph: follow {read,write}_tier fields on osd request submission

Overwrite ceph_osd_request::r_oloc.pool with read_tier for read ops and
write_tier for write and read+write ops (aka basic tiering support).
{read,write}_tier are part of pg_pool_t since v9.  This commit bumps
our pg_pool_t decode compat version from v7 to v9, all new fields
except for {read,write}_tier are ignored.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: add ceph_pg_pool_by_id()
Ilya Dryomov [Mon, 27 Jan 2014 15:40:19 +0000 (17:40 +0200)]
libceph: add ceph_pg_pool_by_id()

"Lookup pool info by ID" function is hidden in osdmap.c.  Expose it to
the rest of libceph.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: CEPH_OSD_FLAG_* enum update
Ilya Dryomov [Mon, 27 Jan 2014 15:40:19 +0000 (17:40 +0200)]
libceph: CEPH_OSD_FLAG_* enum update

Update CEPH_OSD_FLAG_* enum.  (We need CEPH_OSD_FLAG_IGNORE_OVERLAY to
support tiering).

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: replace ceph_calc_ceph_pg() with ceph_oloc_oid_to_pg()
Ilya Dryomov [Mon, 27 Jan 2014 15:40:19 +0000 (17:40 +0200)]
libceph: replace ceph_calc_ceph_pg() with ceph_oloc_oid_to_pg()

Switch ceph_calc_ceph_pg() to new oloc and oid abstractions and rename
it to ceph_oloc_oid_to_pg() to make its purpose more clear.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: introduce and start using oid abstraction
Ilya Dryomov [Mon, 27 Jan 2014 15:40:18 +0000 (17:40 +0200)]
libceph: introduce and start using oid abstraction

In preparation for tiering support, which would require having two
(base and target) object names for each osd request and also copying
those names around, introduce struct ceph_object_id (oid) and a couple
helpers to facilitate those copies and encapsulate the fact that object
name is not necessarily a NUL-terminated string.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: rename MAX_OBJ_NAME_SIZE to CEPH_MAX_OID_NAME_LEN
Ilya Dryomov [Mon, 27 Jan 2014 15:40:18 +0000 (17:40 +0200)]
libceph: rename MAX_OBJ_NAME_SIZE to CEPH_MAX_OID_NAME_LEN

In preparation for adding oid abstraction, rename MAX_OBJ_NAME_SIZE to
CEPH_MAX_OID_NAME_LEN.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: move ceph_file_layout helpers to ceph_fs.h
Ilya Dryomov [Mon, 27 Jan 2014 15:40:18 +0000 (17:40 +0200)]
libceph: move ceph_file_layout helpers to ceph_fs.h

Move ceph_file_layout helper macros and inline functions to ceph_fs.h.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agolibceph: start using oloc abstraction
Ilya Dryomov [Mon, 27 Jan 2014 15:40:18 +0000 (17:40 +0200)]
libceph: start using oloc abstraction

Instead of relying on pool fields in ceph_file_layout (for mapping) and
ceph_pg (for enconding), start using ceph_object_locator (oloc)
abstraction.  Note that userspace oloc currently consists of pool, key,
nspace and hash fields, while this one contains only a pool.  This is
OK, because at this point we only send (i.e. encode) olocs and never
have to receive (i.e. decode) them.

This makes keeping a copy of ceph_file_layout in every osd request
unnecessary, so ceph_osd_request::r_file_layout field is nuked.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
10 years agoclk: sort Makefile
Mike Turquette [Mon, 27 Jan 2014 21:04:49 +0000 (13:04 -0800)]
clk: sort Makefile

Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agoMerge branch 'bonding'
David S. Miller [Mon, 27 Jan 2014 21:12:50 +0000 (13:12 -0800)]
Merge branch 'bonding'

Veaceslav Falico says:

====================
bonding: fix locking in bond_ab_arp_prob

After the latest patches, on every call of bond_ab_arp_probe() without an
active slave I see the following warning:

[    7.912314] RTNL: assertion failed at net/core/dev.c (4494)
...
[    7.922495]  [<ffffffff817acc6f>] dump_stack+0x51/0x72
[    7.923714]  [<ffffffff8168795e>] netdev_master_upper_dev_get+0x6e/0x70
[    7.924940]  [<ffffffff816a2a66>] rtnl_link_fill+0x116/0x260
[    7.926143]  [<ffffffff817acc6f>] ? dump_stack+0x51/0x72
[    7.927333]  [<ffffffff816a350c>] rtnl_fill_ifinfo+0x95c/0xb90
[    7.928529]  [<ffffffff8167af2b>] ? __kmalloc_reserve+0x3b/0xa0
[    7.929681]  [<ffffffff8167bfcf>] ? __alloc_skb+0x9f/0x1e0
[    7.930827]  [<ffffffff816a3b64>] rtmsg_ifinfo+0x84/0x100
[    7.931960]  [<ffffffffa00bca07>] bond_ab_arp_probe+0x1a7/0x370 [bonding]
[    7.933133]  [<ffffffffa00bcd78>] bond_activebackup_arp_mon+0x1a8/0x2f0 [bonding]
...

It happens because in bond_ab_arp_probe() we change the flags of a slave
without holding the RTNL lock.

To fix this - remove the useless curr_active_lock, RCUify it and lock RTNL
while changing the slave's flags. Also, remove bond_ab_arp_probe() from
under any locks in bond_ab_arp_mon().
====================

Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobonding: restructure locking of bond_ab_arp_probe()
Veaceslav Falico [Mon, 27 Jan 2014 13:37:32 +0000 (14:37 +0100)]
bonding: restructure locking of bond_ab_arp_probe()

Currently we're calling it from under RCU context, however we're using some
functions that require rtnl to be held.

Fix this by restructuring the locking - don't call it under any locks,
aquire rcu_read_lock() if we're sending _only_ (i.e. we have the active
slave present), and use rtnl locking otherwise - if we need to modify
(in)active flags of a slave.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobonding: RCUify bond_ab_arp_probe
Veaceslav Falico [Mon, 27 Jan 2014 13:37:31 +0000 (14:37 +0100)]
bonding: RCUify bond_ab_arp_probe

Currently bond_ab_arp_probe() is always called under rcu_read_lock(),
however to work with curr_active_slave we're still holding the
curr_slave_lock.

To remove that curr_slave_lock - rcu_dereference the bond's
curr_active_slave and use it further - so that we're sure the slave won't
go away, and we don't care if it will change in the meanwhile.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoAF_PACKET: Add documentation for queue mapping fanout mode
Neil Horman [Mon, 27 Jan 2014 16:43:04 +0000 (11:43 -0500)]
AF_PACKET: Add documentation for queue mapping fanout mode

Recently I added a new AF_PACKET fanout operation mode in commit
2d36097, but I forgot to document it.  Add PACKET_FANOUT_QM as an available mode
in the af_packet documentation.  Applies to net-next.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobnx2x: More Shutdown revisions
Yuval Mintz [Mon, 27 Jan 2014 15:11:58 +0000 (17:11 +0200)]
bnx2x: More Shutdown revisions

Submission d9aee59 "bnx2x: Don't release PCI bars on shutdown" separated
the PCI remove and shutdown flows, but pci_disable_device() is still
being called on both.
As a result, a dev_WARN_ONCE will be hit during shutdown for every bnx2x
VF probed on a hypervisor (as its shutdown callback will be called and later
pci_disable_sriov() will call its remove callback).

This calls the pci_disable_device() only on the remove flow.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: ipv4: Use PTR_ERR_OR_ZERO
Sachin Kamat [Mon, 27 Jan 2014 06:43:57 +0000 (12:13 +0530)]
net: ipv4: Use PTR_ERR_OR_ZERO

PTR_RET is deprecated. Use PTR_ERR_OR_ZERO instead. While at it
also include missing err.h header.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoclk: sunxi: fix overflow when setting up divided factors
Emilio López [Sat, 25 Jan 2014 01:32:41 +0000 (22:32 -0300)]
clk: sunxi: fix overflow when setting up divided factors

Currently, we are allocating space for two pointers, when we actually
may need to store three of them (two divisors plus the original clock).
Fix this, and change sizeof(type) to sizeof(*var) to keep checkpatch.pl
happy.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Emilio López <emilio@elopez.com.ar>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agoclk: Export more clk-provider functions
Stephen Boyd [Sat, 18 Jan 2014 03:47:17 +0000 (19:47 -0800)]
clk: Export more clk-provider functions

Allow drivers to be compiled as modules by exporting more clock
provider functions.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agodt-bindings: qcom: Fix warning with duplicate dt define
Stephen Boyd [Sat, 18 Jan 2014 01:05:19 +0000 (17:05 -0800)]
dt-bindings: qcom: Fix warning with duplicate dt define

arch/arm/boot/dts/include/dt-bindings/clock/qcom,mmcc-msm8974.h:60:0:
warning: "RBCPR_CLK_SRC" redefined

Rename this to MMSS_RBCPR_CLK_SRC to avoid conflicts with the
RBCPR clock in the gcc header.

Reported-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agoclk: si5351: remove variant from platform_data
Sebastian Hesselbarth [Sat, 25 Jan 2014 20:48:31 +0000 (21:48 +0100)]
clk: si5351: remove variant from platform_data

Commit 9807362bfe1748d9bb48eecb9261f1b1aaafea1c
  "clk: si5351: declare all device IDs for module loading"
removed the common i2c_device_id and introduced new ones for each variant
of the clock generator. Instead of exploiting that information in the driver,
it still depends on platform_data passing the chips .variant.

This removes the now redundant .variant from the platform_data and puts it in
i2c_device_id's .driver_data instead.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agoMerge tag 'trace-fixes-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Mon, 27 Jan 2014 16:22:30 +0000 (08:22 -0800)]
Merge tag 'trace-fixes-3.14' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "The first two patches fix the debugfs README file to reflect better
  the new features added to 3.14.

  The third patch is a minor bugfix to the trace_puts() functions that
  will crash the system if a developer adds one before the tracing
  system is setup.  It also affects trace_printk() if it has no
  arguments, as the code will convert it to a trace_puts() as well.

  Note, this bug will not affect unmodified kernels, as trace_printk()
  and trace_puts() should only be used by developers for testing"

* tag 'trace-fixes-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Check if tracing is enabled in trace_puts()
  tracing: Fix formatting of trace README file
  tracing/README: Add event file usage to tracing mini-HOWTO

10 years agoMerge tag 'stable/for-linus-3.14-rc0-tag' of git://git.kernel.org/pub/scm/linux/kerne...
Linus Torvalds [Mon, 27 Jan 2014 16:17:09 +0000 (08:17 -0800)]
Merge tag 'stable/for-linus-3.14-rc0-tag' of git://git./linux/kernel/git/konrad/swiotlb

Pull swiotlb bug-fixes from Konrad Rzeszutek Wilk:
 - Don't DoS with 'swiotlb is full' message.
 - Documentation update.

* tag 'stable/for-linus-3.14-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
  swiotlb: Don't DoS us with 'swiotlb buffer is full' (v2)
  swiotlb: update format

10 years agoMerge tag 'pwm/for-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
Linus Torvalds [Mon, 27 Jan 2014 16:15:51 +0000 (08:15 -0800)]
Merge tag 'pwm/for-3.14-rc1' of git://git./linux/kernel/git/thierry.reding/linux-pwm

Pull pwm changes from Thierry Reding:
 "The patches for this release cycle include various enhancements
  (device tree support, better compile coverage, ...) for existing
  drivers.  There is a new driver for Atmel SoCs.

  Various drivers as well as the sysfs support received minor fixes and
  cleanups"

* tag 'pwm/for-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
  pwm: tiecap: Remove duplicate put_sync call
  pwm: tiehrpwm: use dev_err() instead of pr_err()
  pwm: pxa: remove unnecessary space before tabs
  pwm: ep93xx: split module author names
  pwm: use seq_puts() instead of seq_printf()
  pwm: atmel-pwm: Do not unprepare clock after successful registration
  of: Add Atmel PWM controller device tree binding
  pwm: atmel-pwm: Add Atmel PWM controller driver
  backlight: pwm_bl: Remove error message upon devm_kzalloc() failure
  pwm: pca9685: depends on I2C rather than REGMAP_I2C
  pwm: renesas-tpu: Enable driver compilation with COMPILE_TEST
  pwm: jz4740: Use devm_clk_get()
  pwm: jz4740: Pass device to clk_get()
  pwm: sysfs: Convert to use ATTRIBUTE_GROUPS macro
  pwm: pxa: Add device tree support

10 years agoMerge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
Linus Torvalds [Mon, 27 Jan 2014 16:14:08 +0000 (08:14 -0800)]
Merge tag 'firewire-updates' of git://git./linux/kernel/git/ieee1394/linux1394

Pull firewire updates from Stefan Richter:
 "IEEE 1394 (FireWire) subsystem changes:

   - make remote debugging over 1394 a runtime option instead of a
     buildtime option
   - extend remote debug access past the 4 GB barrier on respectively
     capable hardware
   - documentation update"

* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
  firewire: Enable remote DMA above 4 GB
  firewire: ohci: Turn remote DMA support into a module parameter
  Documentation/: update FireWire debugging documentation

10 years agoMerge tag 'cris-for-3.14' of git://jni.nu/cris
Linus Torvalds [Mon, 27 Jan 2014 16:12:20 +0000 (08:12 -0800)]
Merge tag 'cris-for-3.14' of git://jni.nu/cris

Pull cris changes from Jesper Nilsson:
 "Mostly removal of deprecated or old code, but also a long promised
  update of the CRIS syscalls"

* tag 'cris-for-3.14' of git://jni.nu/cris:
  Drop code for CRISv10 CPU simulator
  Cleanup whitespace, remove old author tag
  CRIS: Add missing syscalls
  cris: sync_serial: remove interruptible_sleep_on
  cris: remove deprecated IRQF_DISABLED

10 years agoARM: imx: initial SolidRun Cubox-i support
Russell King [Thu, 16 Jan 2014 16:12:38 +0000 (16:12 +0000)]
ARM: imx: initial SolidRun Cubox-i support

Add support for the SolidRun Cubox-i devices.  This commit adds similar
basic support as the HummingBoard.  Further devices will be supported
in future patches.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agoARM: imx: initial SolidRun HummingBoard support
Russell King [Fri, 27 Sep 2013 19:07:26 +0000 (20:07 +0100)]
ARM: imx: initial SolidRun HummingBoard support

Add support for the SolidRun HummingBoard.  This commit adds support for
the following interfaces on this board:

- Consumer Ir receiver
- S/PDIF output
- Both USB interfaces
- Gigabit Ethernet using AR8035
- UART port

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
10 years agomicroblaze: Add missing v8.50.a version
Michal Simek [Fri, 22 Nov 2013 08:01:10 +0000 (09:01 +0100)]
microblaze: Add missing v8.50.a version

Add PVR value for MB 8.50.a.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Fix missing bracket in printk
Michal Simek [Tue, 19 Nov 2013 13:27:33 +0000 (14:27 +0100)]
microblaze: Fix missing bracket in printk

The error was introduced by the patch
"microblaze: Fix coding style issues"
(sha1: 6bd55f0bbaebb79b39e147aa864401fd0c94db82).

Error message:
arch/microblaze/kernel/setup.c: In function 'machine_early_init':
arch/microblaze/kernel/setup.c:177:3: error: 'pr_cont'
  undeclared (first use in this function)
arch/microblaze/kernel/setup.c:177:3: note: each undeclared
  identifier is reported only once for each function it appears in
arch/microblaze/kernel/setup.c:177:10: error: expected ';'
  before string constant
arch/microblaze/kernel/setup.c:177:33: error: expected statement
  before ')' token

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Fix compilation error for BS=0
Michal Simek [Tue, 19 Nov 2013 15:20:34 +0000 (16:20 +0100)]
microblaze: Fix compilation error for BS=0

This bug was introduced by:
"microblaze: Do not used hardcoded value in exception handler"
(sha1: 9f78d3b5ab97a22a7e836312c495804ee4bca4ab)

System without barrel shifter are pretty rare that's why
this bug has been fixed so late.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Disable stack protection from bootloader
Michal Simek [Fri, 23 Aug 2013 05:16:50 +0000 (07:16 +0200)]
microblaze: Disable stack protection from bootloader

Microblaze without MMU can use stack protection in bootloader
and kernel should clear this setting ASAP.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Define read/write{b,w,l}_relaxed MMIO
Michal Simek [Wed, 20 Nov 2013 12:59:40 +0000 (13:59 +0100)]
microblaze: Define read/write{b,w,l}_relaxed MMIO

More and more ARM specific drivers is using MMIO
readX/writeX_relaxed IO functions and Microblaze can
shared some drivers with ARM too.

This patch adds relaxed IO accessor macros
to prevent compilation failures.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: timer: Do not initialized system timer twice
Michal Simek [Mon, 27 Jan 2014 09:41:59 +0000 (10:41 +0100)]
microblaze: timer: Do not initialized system timer twice

Only one system timer can be setup.
Do not initialize more system timers.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: timer: Use generic sched_clock implementation
Michal Simek [Fri, 20 Dec 2013 09:16:40 +0000 (10:16 +0100)]
microblaze: timer: Use generic sched_clock implementation

Remove sched_clock from the driver and use sched_clock_register
function.
Inspired-by:
"arch_timer: Move to generic sched_clock framework"
(sha1: 65cd4f6c99c1170bd0114dbd71b978012ea44d28)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Add NOTES section to linker script
Michal Simek [Mon, 27 Jan 2014 09:50:42 +0000 (10:50 +0100)]
microblaze: Add NOTES section to linker script

Do not keep NOTES section align in proper location.

'readelf' shows that 'NOTE' is placed in wrong location
which is out of virtual and physical load addresses.

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 1] .note.gnu.build-i NOTE            00000000 001000 000024 00   A  0   0  4
  [ 2] .text             PROGBITS        c0000000 002000 284570 00  AX  0   0 16
  [ 3] __fdt_blob        PROGBITS        c0284570 286570 008000 00   A  0   0  1

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00000000 0x00000000 0x00024 0x00024 R   0x1000
  LOAD           0x002000 0xc0000000 0x08000000 0x315428 0x316000 RWE 0x1000

This patch move 'NOTE' section to the correct location.

Checked with:
"ARM: 6740/1: Place correctly notes section in the linker script"
(sha1: dc810efb0ca5702c9d96782b99282d4b4383e877)
and
"[S390] incorrect note program header"
(sha1: 7a2512b744e72377c3fa5976f06a3f343e155d1f)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agomicroblaze: Add support for CCF
Michal Simek [Wed, 18 Dec 2013 16:18:48 +0000 (17:18 +0100)]
microblaze: Add support for CCF

Add support for CCF for Microblaze.

Old binding:
system_timer: system-timer@41c00000 {
clock-frequency = <75000000>;
...
}

New binding:
system_timer: system-timer@41c00000 {
clocks = <&clk_bus>;
...
}

Both should be supported for a while

Microblaze clock binding:
clocks {
#address-cells = <1>;
#size-cells = <0>;
clk_bus: bus {
#clock-cells = <0>;
clock-frequency = <75000000>;
clock-output-names = "bus";
compatible = "fixed-clock";
reg = <1>;
} ;
clk_cpu: cpu {
#clock-cells = <0>;
clock-frequency = <75000000>;
clock-output-names = "cpu";
compatible = "fixed-clock";
reg = <0>;
} ;
} ;

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
10 years agonet: stmmac: Log MAC address only once
Hans de Goede [Sun, 26 Jan 2014 14:50:44 +0000 (15:50 +0100)]
net: stmmac: Log MAC address only once

Logging the MAC address on every if-up, is not really useful, and annoying when
there is no cable inserted and NetworkManager tries the ifup every 50 seconds.

Also change the log level from warning to info, as that is what it is.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: Silence PTP init errors on hw without PTP
Hans de Goede [Sun, 26 Jan 2014 14:50:43 +0000 (15:50 +0100)]
net: stmmac: Silence PTP init errors on hw without PTP

Logging a PTP error on hw which simply does not support PTP is not very
useful. Moreover this message gets logged on every if-up, and if there is
no cable inserted NetworkManager will re-try the ifup every 50 seconds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet/apne: Remove unused variable ei_local
Geert Uytterhoeven [Sun, 26 Jan 2014 10:44:23 +0000 (11:44 +0100)]
net/apne: Remove unused variable ei_local

drivers/net/ethernet/8390/apne.c: In function ‘apne_probe1’:
drivers/net/ethernet/8390/apne.c:215: warning: unused variable ‘ei_local’

Introduced by commit c45f812f0280c13f1b7992be5e0de512312a9e8f ("8390 :
Replace ei_debug with msg_enable/NETIF_MSG_* feature"), which added the
variable without using it.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: add and use skb_gso_transport_seglen()
Florian Westphal [Sun, 26 Jan 2014 09:58:16 +0000 (10:58 +0100)]
net: add and use skb_gso_transport_seglen()

This moves part of Eric Dumazets skb_gso_seglen helper from tbf sched to
skbuff core so it may be reused by upcoming ip forwarding path patch.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Linus Torvalds [Sun, 26 Jan 2014 19:06:16 +0000 (11:06 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/rw/uml

Pull UML changes from Richard Weinberger:
 "This time only various cleanups and housekeeping patches"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  um: hostfs: make functions static
  um: Include generic barrier.h
  um: Removed unused attributes from thread_struct

10 years agoMerge tag 'mmc-updates-for-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Jan 2014 19:00:41 +0000 (11:00 -0800)]
Merge tag 'mmc-updates-for-3.14-rc1' of git://git./linux/kernel/git/cjb/mmc

Pull MMC updates from Chris Ball:
 "MMC highlights for 3.14:

  Core:
   - Avoid get_cd() on cards marked nonremovable

  Drivers:
   - arasan: New driver for controllers found in e.g. Xilinx Zynq SoC
   - dwmmc: Support Hisilicon K3 SoC controllers
   - esdhc-imx: Support for HS200 mode, DDR modes on MX6, runtime PM
   - sdhci-pci: Support O2Micro/BayHubTech controllers used in laptops
     like Lenovo ThinkPad W540, Dell Latitude E5440, Dell Latitude E6540
   - tegra: Support Tegra124 SoCs"

* tag 'mmc-updates-for-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (55 commits)
  mmc: sdhci-pci: Fix possibility of chip->fixes being null
  mmc: sdhci-pci: Fix BYT sd card getting stuck in runtime suspend
  mmc: sdhci: Allow for long command timeouts
  mmc: sdio: add a quirk for broken SDIO_CCCR_INTx polling
  mmc: sdhci: fix lockdep error in tuning routine
  mmc: dw_mmc: k3: remove clk_table
  mmc: dw_mmc: fix dw_mci_get_cd
  mmc: dw_mmc: fix sparse non static symbol warning
  mmc: sdhci-esdhc-imx: fix warning during module remove function
  mmc: sdhci-esdhc-imx: fix access hardirq-unsafe lock in atomic context
  mmc: core: sd: implement proper support for sd3.0 au sizes
  mmc: atmel-mci: add vmmc-supply support
  mmc: sdhci-pci: add broken HS200 quirk for Intel Merrifield
  mmc: sdhci: add quirk for broken HS200 support
  mmc: arasan: Add driver for Arasan SDHCI
  mmc: dw_mmc: add dw_mmc-k3 for k3 platform
  mmc: dw_mmc: use slot-gpio to handle cd pin
  mmc: sdhci-pci: add support of O2Micro/BayHubTech SD hosts
  mmc: sdhci-pci: break out definitions to header file
  mmc: tmio: fixup compile error
  ...

Conflicts:
MAINTAINERS

10 years agoMerge tag 'for-3.14-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 26 Jan 2014 18:55:41 +0000 (10:55 -0800)]
Merge tag 'for-3.14-merge-window' of git://git./linux/kernel/git/ericvh/v9fs

Pull 9p changes from Eric Van Hensbergen:
 "Included are a new cache model for support of mmap, and several
  cleanups across the filesystem and networking portions of the code"

* tag 'for-3.14-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: update documentation
  9P: introduction of a new cache=mmap model.
  net/9p: remove virtio default hack and set appropriate bits instead
  9p: remove useless 'name' variable and assignment
  9p: fix return value in case in v9fs_fid_xattr_set()
  9p: remove useless variable and assignment
  9p: remove useless assignment
  9p: remove unused 'super_block' struct pointer
  9p: remove never used return variable
  9p: remove unused 'p9_fid' struct pointer
  9p: remove unused 'p9_client' struct pointer

10 years ago__dentry_path() fixes
Al Viro [Sun, 26 Jan 2014 17:37:55 +0000 (12:37 -0500)]
__dentry_path() fixes

* we need to save the starting point for restarts
* reject pathologically short buffers outright

Spotted-by: Denys Vlasenko <dvlasenk@redhat.com>
Spotted-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agovfs: Remove second variable named error in __dentry_path
Eric W. Biederman [Mon, 20 Jan 2014 23:43:25 +0000 (15:43 -0800)]
vfs: Remove second variable named error in __dentry_path

In commit  232d2d60aa5469bb097f55728f65146bd49c1d25
Author: Waiman Long <Waiman.Long@hp.com>
Date:   Mon Sep 9 12:18:13 2013 -0400

    dcache: Translating dentry into pathname without taking rename_lock

The __dentry_path locking was changed and the variable error was
intended to be moved outside of the loop.  Unfortunately the inner
declaration of error was not removed. Resulting in a version of
__dentry_path that will never return an error.

Remove the problematic inner declaration of error and allow
__dentry_path to return errors once again.

Cc: stable@vger.kernel.org
Cc: Waiman Long <Waiman.Long@hp.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agovfs: Is mounted should be testing mnt_ns for NULL or error.
Eric W. Biederman [Mon, 20 Jan 2014 23:26:15 +0000 (15:26 -0800)]
vfs: Is mounted should be testing mnt_ns for NULL or error.

A bug was introduced with the is_mounted helper function in
commit f7a99c5b7c8bd3d3f533c8b38274e33f3da9096e
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sat Jun 9 00:59:08 2012 -0400

    get rid of ->mnt_longterm

    it's enough to set ->mnt_ns of internal vfsmounts to something
    distinct from all struct mnt_namespace out there; then we can
    just use the check for ->mnt_ns != NULL in the fast path of
    mntput_no_expire()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
The intent was to test if the real_mount(vfsmount)->mnt_ns was
NULL_OR_ERR but the code is actually testing real_mount(vfsmount)
and always returning true.

The result is d_absolute_path returning paths it should be hiding.

Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agoFix race when checking i_size on direct i/o read
Steven Whitehouse [Fri, 24 Jan 2014 14:42:22 +0000 (14:42 +0000)]
Fix race when checking i_size on direct i/o read

So far I've had one ACK for this, and no other comments. So I think it
is probably time to send this via some suitable tree. I'm guessing that
the vfs tree would be the most appropriate route, but not sure that
there is one at the moment (don't see anything recent at kernel.org)
so in that case I think -mm is the "back up plan". Al, please let me
know if you will take this?

Steve.

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

Following on from the "Re: [PATCH v3] vfs: fix a bug when we do some dio
reads with append dio writes" thread on linux-fsdevel, this patch is my
current version of the fix proposed as option (b) in that thread.

Removing the i_size test from the direct i/o read path at vfs level
means that filesystems now have to deal with requests which are beyond
i_size themselves. These I've divided into three sets:

 a) Those with "no op" ->direct_IO (9p, cifs, ceph)
These are obviously not going to be an issue

 b) Those with "home brew" ->direct_IO (nfs, fuse)
I've been told that NFS should not have any problem with the larger
i_size, however I've added an extra test to FUSE to duplicate the
original behaviour just to be on the safe side.

 c) Those using __blockdev_direct_IO()
These call through to ->get_block() which should deal with the EOF
condition correctly. I've verified that with GFS2 and I believe that
Zheng has verified it for ext4. I've also run the test on XFS and it
passes both before and after this change.

The part of the patch in filemap.c looks a lot larger than it really is
- there are only two lines of real change. The rest is just indentation
of the contained code.

There remains a test of i_size though, which was added for btrfs. It
doesn't cause the other filesystems a problem as the test is performed
after ->direct_IO has been called. It is possible that there is a race
that does matter to btrfs, however this patch doesn't change that, so
its still an overall improvement.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Reported-by: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
Acked-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agohfsplus: remove can_set_xattr
Christoph Hellwig [Fri, 20 Dec 2013 13:16:56 +0000 (05:16 -0800)]
hfsplus: remove can_set_xattr

When using the per-superblock xattr handlers permission checking is
done by the generic code.  hfsplus just needs to check for the magic
osx attribute not to leak into protected namespaces.

Also given that the code was obviously copied from JFS the proper
attribution was missing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agonfsd: use get_acl and ->set_acl
Christoph Hellwig [Fri, 20 Dec 2013 13:16:55 +0000 (05:16 -0800)]
nfsd: use get_acl and ->set_acl

Remove the boilerplate code to marshall and unmarhall ACL objects into
xattrs and operate on the posix_acl objects directly.  Also move all
the ACL handling code into nfs?acl.c where it belongs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agofs: remove generic_acl
Christoph Hellwig [Fri, 20 Dec 2013 13:16:54 +0000 (05:16 -0800)]
fs: remove generic_acl

And instead convert tmpfs to use the new generic ACL code, with two stub
methods provided for in-memory filesystems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agonfs: use generic posix ACL infrastructure for v3 Posix ACLs
Christoph Hellwig [Fri, 20 Dec 2013 13:16:53 +0000 (05:16 -0800)]
nfs: use generic posix ACL infrastructure for v3 Posix ACLs

This causes a small behaviour change in that we don't bother to set
ACLs on file creation if the mode bit can express the access permissions
fully, and thus behaving identical to local filesystems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
10 years agoaf_rxrpc: Handle frames delivered from another VM
Tim Smith [Sun, 26 Jan 2014 11:39:31 +0000 (11:39 +0000)]
af_rxrpc: Handle frames delivered from another VM

On input, CHECKSUM_PARTIAL should be treated the same way as
CHECKSUM_UNNECESSARY. See include/linux/skbuff.h

Signed-off-by: Tim Smith <tim@electronghost.co.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
10 years agoaf_rxrpc: Avoid setting up double-free on checksum error
Tim Smith [Sun, 26 Jan 2014 11:39:28 +0000 (11:39 +0000)]
af_rxrpc: Avoid setting up double-free on checksum error

skb_kill_datagram() does not dequeue the skb when MSG_PEEK is unset.
This leaves a free'd skb on the queue, resulting a double-free later.

Without this, the following oops can occur:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff8154fcf7>] skb_dequeue+0x47/0x70
PGD 0
Oops: 0002 [#1] SMP
Modules linked in: af_rxrpc ...
CPU: 0 PID: 1191 Comm: listen Not tainted 3.12.0+ #4
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
task: ffff8801183536b0 ti: ffff880035c92000 task.ti: ffff880035c92000
RIP: 0010:[<ffffffff8154fcf7>] skb_dequeue+0x47/0x70
RSP: 0018:ffff880035c93db8  EFLAGS: 00010097
RAX: 0000000000000246 RBX: ffff8800d2754b00 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000202 RDI: ffff8800d254c084
RBP: ffff880035c93dd0 R08: ffff880035c93cf0 R09: ffff8800d968f270
R10: 0000000000000000 R11: 0000000000000293 R12: ffff8800d254c070
R13: ffff8800d254c084 R14: ffff8800cd861240 R15: ffff880119b39720
FS:  00007f37a969d740(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 00000000d4413000 CR4: 00000000000006f0
Stack:
 ffff8800d254c000 ffff8800d254c070 ffff8800d254c2c0 ffff880035c93df8
 ffffffffa041a5b8 ffff8800cd844c80 ffffffffa04385a0 ffff8800cd844cb0
 ffff880035c93e18 ffffffff81546cef ffff8800d45fea00 0000000000000008
Call Trace:
 [<ffffffffa041a5b8>] rxrpc_release+0x128/0x2e0 [af_rxrpc]
 [<ffffffff81546cef>] sock_release+0x1f/0x80
 [<ffffffff81546d62>] sock_close+0x12/0x20
 [<ffffffff811aaba1>] __fput+0xe1/0x230
 [<ffffffff811aad3e>] ____fput+0xe/0x10
 [<ffffffff810862cc>] task_work_run+0xbc/0xe0
 [<ffffffff8106a3be>] do_exit+0x2be/0xa10
 [<ffffffff8116dc47>] ? do_munmap+0x297/0x3b0
 [<ffffffff8106ab8f>] do_group_exit+0x3f/0xa0
 [<ffffffff8106ac04>] SyS_exit_group+0x14/0x20
 [<ffffffff8166b069>] system_call_fastpath+0x16/0x1b

Signed-off-by: Tim Smith <tim@electronghost.co.uk>
Signed-off-by: David Howells <dhowells@redhat.com>