]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
10 years agomm-drop-actor-argument-of-do_generic_file_read-fix
Andrew Morton [Tue, 5 Nov 2013 06:06:30 +0000 (17:06 +1100)]
mm-drop-actor-argument-of-do_generic_file_read-fix

fix mm-drop-actor-argument-of-do_generic_file_read for linux-next changes

Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agomm: drop actor argument of do_generic_file_read()
Kirill A. Shutemov [Tue, 5 Nov 2013 06:06:30 +0000 (17:06 +1100)]
mm: drop actor argument of do_generic_file_read()

There's only one caller of do_generic_file_read() and the only actor is
file_read_actor().  No reason to have a callback parameter.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agonet/netfilter/ipset/ip_set_hash_netportnet.c: fix build with older gccs
Andrew Morton [Tue, 5 Nov 2013 06:06:29 +0000 (17:06 +1100)]
net/netfilter/ipset/ip_set_hash_netportnet.c: fix build with older gccs

net/netfilter/ipset/ip_set_hash_netportnet.c: In function 'hash_netportnet4_kadt':
net/netfilter/ipset/ip_set_hash_netportnet.c:151: error: unknown field 'cidr' specified in initializer
net/netfilter/ipset/ip_set_hash_netportnet.c:151: warning: missing braces around initializer
net/netfilter/ipset/ip_set_hash_netportnet.c:151: warning: (near initialization for 'e.<anonymous>')

etc

gcc-4.4.4 doesn't like that anonymous union initializer and I couldnt'
find a way of tricking it into doing the right thing, so open-code it.

Cc: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agonet/netfilter/ipset/ip_set_hash_netnet.c: fix build with older gcc
Andrew Morton [Tue, 5 Nov 2013 06:06:29 +0000 (17:06 +1100)]
net/netfilter/ipset/ip_set_hash_netnet.c: fix build with older gcc

net/netfilter/ipset/ip_set_hash_netnet.c: In function 'hash_netnet4_kadt':
net/netfilter/ipset/ip_set_hash_netnet.c:141: error: unknown field 'cidr' specified in initializer
net/netfilter/ipset/ip_set_hash_netnet.c:141: warning: missing braces around initializer
net/netfilter/ipset/ip_set_hash_netnet.c:141: warning: (near initialization for 'e.<anonymous>')

etc.

gcc-4.4.4 doesn't like that anonymous union initializer and I couldnt'
find a way of tricking it into doing the right thing, so open-code it.

Cc: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoMerge branch 'akpm-current/current'
Stephen Rothwell [Tue, 5 Nov 2013 06:29:26 +0000 (17:29 +1100)]
Merge branch 'akpm-current/current'

Conflicts:
arch/x86/mm/init.c
drivers/net/wireless/rt2x00/rt2800pci.c
fs/bio-integrity.c
mm/bounce.c

10 years agoscripts/bloat-o-meter: use .startswith rather than fragile slicing
Josh Triplett [Tue, 5 Nov 2013 05:57:53 +0000 (16:57 +1100)]
scripts/bloat-o-meter: use .startswith rather than fragile slicing

str.startswith has existed since at least Python 2.0, in 2000; use it
rather than a fragile comparison against an initial slice of a string,
which requires hard-coding the length of the string to compare against.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoscripts/bloat-o-meter: ignore changes in the size of linux_banner
Josh Triplett [Tue, 5 Nov 2013 05:57:52 +0000 (16:57 +1100)]
scripts/bloat-o-meter: ignore changes in the size of linux_banner

linux_banner can change size due to changes in the compiler, build number,
or the user@host the system was compiled on; ignore size changes in
linux_banner entirely.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoipc-msg-fix-message-length-check-for-negative-values-fix
Andrew Morton [Tue, 5 Nov 2013 05:57:52 +0000 (16:57 +1100)]
ipc-msg-fix-message-length-check-for-negative-values-fix

fix i386 min() warnings

ipc/msgutil.c: In function 'alloc_msg':
ipc/msgutil.c:54: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c:66: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c: In function 'load_msg':
ipc/msgutil.c:94: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c:101: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c: In function 'copy_msg':
ipc/msgutil.c:127: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c:135: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c: In function 'store_msg':
ipc/msgutil.c:155: warning: comparison of distinct pointer types lacks a cast
ipc/msgutil.c:162: warning: comparison of distinct pointer types lacks a cast

Cc: Brad Spengler <spender@grsecurity.net>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Mathias Krause <minipli@googlemail.com>
Cc: Pax Team <pageexec@freemail.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoipc, msg: fix message length check for negative values
Mathias Krause [Tue, 5 Nov 2013 05:57:51 +0000 (16:57 +1100)]
ipc, msg: fix message length check for negative values

On 64 bit systems the test for negative message sizes is bogus as the
size, which may be positive when evaluated as a long, will get truncated
to an int when passed to load_msg().  So a long might very well contain a
positive value but when truncated to an int it would become negative.

That in combination with a small negative value of msg_ctlmax (which will
be promoted to an unsigned type for the comparison against msgsz, making
it a big positive value and therefore make it pass the check) will lead to
two problems: 1/ The kmalloc() call in alloc_msg() will allocate a too
small buffer as the addition of alen is effectively a subtraction.  2/ The
copy_from_user() call in load_msg() will first overflow the buffer with
userland data and then, when the userland access generates an access
violation, the fixup handler copy_user_handle_tail() will try to fill the
remainder with zeros -- roughly 4GB.  That almost instantly results in a
system crash or reset.

,-[ Reproducer (needs to be run as root) ]--
| #include <sys/stat.h>
| #include <sys/msg.h>
| #include <unistd.h>
| #include <fcntl.h>
|
| int main(void) {
|     long msg = 1;
|     int fd;
|
|     fd = open("/proc/sys/kernel/msgmax", O_WRONLY);
|     write(fd, "-1", 2);
|     close(fd);
|
|     msgsnd(0, &msg, 0xfffffff0, IPC_NOWAIT);
|
|     return 0;
| }
'---

Fix the issue by preventing msgsz from getting truncated by consistently
using size_t for the message length.  This way the size checks in
do_msgsnd() could still be passed with a negative value for msg_ctlmax but
we would fail on the buffer allocation in that case and error out.

Also change the type of m_ts from int to size_t to avoid similar nastiness
in other code paths -- it is used in similar constructs, i.e.  signed vs.
unsigned checks.  It should never become negative under normal
circumstances, though.

Setting msg_ctlmax to a negative value is an odd configuration and should
be prevented.  As that might break existing userland, it will be handled
in a separate commit so it could easily be reverted and reworked without
reintroducing the above described bug.

Hardening mechanisms for user copy operations would have catched that bug
early -- e.g.  checking slab object sizes on user copy operations as the
usercopy feature of the PaX patch does.  Or, for that matter, detect the
long vs.  int sign change due to truncation, as the size overflow plugin
of the very same patch does.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Pax Team <pageexec@freemail.hu>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: Brad Spengler <spender@grsecurity.net>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org> [ v2.3.27+ -- yes, that old ;) ]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoipc/util.c: remove unnecessary work pending test
Xie XiuQi [Tue, 5 Nov 2013 05:57:51 +0000 (16:57 +1100)]
ipc/util.c: remove unnecessary work pending test

Remove unnecessary work pending test before calling schedule_work().  It
has been tested in queue_work_on() already.  No functional changed.

Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodevpts: plug the memory leak in kill_sb
Ilija Hadzic [Tue, 5 Nov 2013 05:57:50 +0000 (16:57 +1100)]
devpts: plug the memory leak in kill_sb

When devpts is unmounted, there may be a no-longer-used IDR tree hanging
off the superblock we are about to kill.  This needs to be cleaned up
before destroying the SB.

The leak is usually not a big deal because unmounting devpts is typically
done when shutting down the whole machine.  However, shutting down an LXC
container instead of a physical machine exposes the problem (the garbage
is detectable with kmemleak).

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokfifo-api-type-safety-checkpatch-fixes
Andrew Morton [Tue, 5 Nov 2013 05:57:50 +0000 (16:57 +1100)]
kfifo-api-type-safety-checkpatch-fixes

ERROR: code indent should use tabs where possible
#201: FILE: include/linux/kfifo.h:504:
+ ^Itypeof(__tmp->ptr_const) __buf = (buf); \$

WARNING: please, no space before tabs
#201: FILE: include/linux/kfifo.h:504:
+ ^Itypeof(__tmp->ptr_const) __buf = (buf); \$

WARNING: please, no spaces at the start of a line
#201: FILE: include/linux/kfifo.h:504:
+ ^Itypeof(__tmp->ptr_const) __buf = (buf); \$

total: 1 errors, 2 warnings, 221 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
      scripts/cleanfile

./patches/kfifo-api-type-safety.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokfifo API type safety
Stefani Seibold [Tue, 5 Nov 2013 05:57:49 +0000 (16:57 +1100)]
kfifo API type safety

This patch enhances the type safety for the kfifo API.  It is now safe to
put const data into a non const FIFO and the API will now generate a
compiler warning when reading from the fifo where the destination address
is pointing to a const variable.

As a side effect the kfifo_put() does now expect the value of an element
instead a pointer to the element.  This was suggested Russell King.  It
make the handling of the kfifo_put easier since there is no need to create
a helper variable for getting the address of a pointer or to pass integers
of different sizes.

IMHO the API break is okay, since there are currently only six users of
kfifo_put().

The code is also cleaner by kicking out the "if (0)" expressions.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokfifo: kfifo_copy_{to,from}_user: fix copied bytes calculation
Lars-Peter Clausen [Tue, 5 Nov 2013 05:57:48 +0000 (16:57 +1100)]
kfifo: kfifo_copy_{to,from}_user: fix copied bytes calculation

'copied' and 'len' are in bytes, while 'ret' is in elements, so we need to
multiply 'ret' with the size of one element to get the correct result.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years ago./Makefile: export initial ramdisk compression config option
P J P [Tue, 5 Nov 2013 05:57:48 +0000 (16:57 +1100)]
./Makefile: export initial ramdisk compression config option

Make menuconfig allows one to choose compression format of an initial
ramdisk image.  But this choice does not result in duly compressed ramdisk
image.  Because - $ make install - does not pass on the selected
compression choice to the dracut(8) tool, which creates the initramfs
file.  dracut(8) generates the image with the default compression, ie.
gzip(1).

This patch exports the selected compression option to a sub-shell
environment, so that it could be used by dracut(8) tool to generate
appropriately compressed initramfs images.

There isn't a straightforward way to pass on options to dracut(8) via
positional parameters.  Because it is indirectly invoked at the end of a $
make install sequence.

 # make install
   -> arch/$arch/boot/Makefile
    -> arch/$arch/boot/install.sh
     -> /sbing/installkernel ...
      -> /sbin/new-kernel-pkg ...
       -> /sbin/dracut ...

Signed-off-by: P J P <ppandit@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinit/Kconfig: add option to disable kernel compression
Christian Ruppert [Tue, 5 Nov 2013 05:57:47 +0000 (16:57 +1100)]
init/Kconfig: add option to disable kernel compression

Some ARC users say they can boot faster with without kernel compression.
This probably depends on things like the FLASH chip they use etc.

Until now, kernel compression can only be disabled by removing "select
HAVE_<compression>" lines from the architecture Kconfig.  So add the
Kconfig logic to permit disabling of kernel compression.

Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers: w1: make w1_slave::flags long to avoid memory corruption
Michal Nazarewicz [Tue, 5 Nov 2013 05:57:47 +0000 (16:57 +1100)]
drivers: w1: make w1_slave::flags long to avoid memory corruption

On architectures where long is more then 32 bits, modifying a 32-bit field
with set_bit (and other atomic bit operations) may cause bytes following
the field to by modified.

Because the endianness of the bits within a field is the native endianness
of the CPU[1], on big-endian machines, bit number zero is in the last byte
of the field.

Therefore, `set_bit(0, ptr)' on a 64-bit big-endian machine is roughly
equivalent to `((char *)ptr)[7] |= 1', and since w1 driver uses a 32-bit
field for holding the flags, this causes bytes beyond the field to be
modified.

[1] From Documentation/atomic_ops.txt:

    Native atomic bit operations are defined to operate on objects
    aligned to the size of an "unsigned long" C data type, and are
    least of that size.  The endianness of the bits within each
    "unsigned long" are the native endianness of the cpu.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/w1/masters/ds1wm.cuse dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:46 +0000 (16:57 +1100)]
drivers/w1/masters/ds1wm.cuse dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/memstick/core/mspro_block.c: fix attributes array allocation
Michal Nazarewicz [Tue, 5 Nov 2013 05:57:46 +0000 (16:57 +1100)]
drivers/memstick/core/mspro_block.c: fix attributes array allocation

attrs field of attribute_group structure is a pointer to a pointer (as in
an array of pointers) rather than pointer to attribute struct (as in an
array of structures), so when allocating size of the pointer sholud be
used instead of the structure it is pointing to.

While at it, also change the call to use kcalloc rather than kzalloc.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agopps : add non blocking option to PPS_FETCH ioctl.
Paul Chavent [Tue, 5 Nov 2013 05:57:45 +0000 (16:57 +1100)]
pps : add non blocking option to PPS_FETCH ioctl.

The PPS_FETCH ioctl is blocking still the reception of a PPS event.  But,
in some case, one may immediately need the last event date.  This patch
allow to get the result of PPS_FETCH if the device has the O_NONBLOCK flag
set.

Signed-off-by: Paul Chavent <paul.chavent@onera.fr>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Cc: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:45 +0000 (16:57 +1100)]
drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.  Hence
of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/panic.c: reduce 1 byte usage for print tainted buffer
Chen Gang [Tue, 5 Nov 2013 05:57:44 +0000 (16:57 +1100)]
kernel/panic.c: reduce 1 byte usage for print tainted buffer

sizeof("Tainted: ") already counts '\0', and after first sprintf(), 's'
will start from the current string end (its' value is '\0').

So need not add additional 1 byte for maximized usage of 'buf' in
print_tainted().

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov: reuse kbasename helper
Andy Shevchenko [Tue, 5 Nov 2013 05:57:43 +0000 (16:57 +1100)]
gcov: reuse kbasename helper

To get name of the file from a pathname let's use kbasename() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/gcov/fs.c: use pr_warn()
Andrew Morton [Tue, 5 Nov 2013 05:57:43 +0000 (16:57 +1100)]
kernel/gcov/fs.c: use pr_warn()

pr_warning() is deprecated in favor of pr_warn()

Cc: Andy Gospodarek <agospoda@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Frantisek Hrbata <fhrbata@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/module.c: use pr_foo()
Andrew Morton [Tue, 5 Nov 2013 05:57:42 +0000 (16:57 +1100)]
kernel/module.c: use pr_foo()

kernel/module.c uses a mix of printk(KERN_foo and pr_foo().  Convert it
all to pr_foo and make the offered cleanups.

Not sure what to do about the printk(KERN_DEFAULT).  We don't have a
pr_default().

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Joe Perches <joe@perches.com>
Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov: compile specific gcov implementation based on gcc version
Frantisek Hrbata [Tue, 5 Nov 2013 05:57:42 +0000 (16:57 +1100)]
gcov: compile specific gcov implementation based on gcc version

Compile the correct gcov implementation file for the specific gcc version.

Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Gospodarek <agospoda@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov-add-support-for-gcc-47-gcov-format-fix-3
Peter Oberparleiter [Tue, 5 Nov 2013 05:57:41 +0000 (16:57 +1100)]
gcov-add-support-for-gcc-47-gcov-format-fix-3

gcc_4_7.c needs vmalloc.h

Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov-add-support-for-gcc-47-gcov-format-checkpatch-fixes
Andrew Morton [Tue, 5 Nov 2013 05:57:41 +0000 (16:57 +1100)]
gcov-add-support-for-gcc-47-gcov-format-checkpatch-fixes

ERROR: that open brace { should be on the previous line
#227: FILE: kernel/gcov/gcc_4_7.c:179:
+ for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++)
+ {

ERROR: that open brace { should be on the previous line
#269: FILE: kernel/gcov/gcc_4_7.c:221:
+ for (fi_idx = 0; fi_idx < src->n_functions; fi_idx++)
+ {

total: 2 errors, 0 warnings, 574 lines checked

./patches/gcov-add-support-for-gcc-47-gcov-format.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov-add-support-for-gcc-47-gcov-format-fix-fix
Andrew Morton [Tue, 5 Nov 2013 05:57:40 +0000 (16:57 +1100)]
gcov-add-support-for-gcc-47-gcov-format-fix-fix

checkpatch whined about the argument order

Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov-add-support-for-gcc-47-gcov-format-fix
Andrew Morton [Tue, 5 Nov 2013 05:57:40 +0000 (16:57 +1100)]
gcov-add-support-for-gcc-47-gcov-format-fix

use kmemdup() and kcalloc()

Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov: add support for gcc 4.7 gcov format
Frantisek Hrbata [Tue, 5 Nov 2013 05:57:39 +0000 (16:57 +1100)]
gcov: add support for gcc 4.7 gcov format

The gcov in-memory format changed in gcc 4.7.  The biggest change, which
requires this special implementation, is that gcov_info no longer contains
array of counters for each counter type for all functions and gcov_fn_info
is not used for mapping of function's counters to these arrays(offset).
Now each gcov_fn_info contans it's counters, which makes things a little
bit easier.

This is heavily based on the previous gcc_3_4.c implementation and patches
provided by Peter Oberparleiter.  Specially the buffer gcda implementation
for iterator.

Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Reviewed-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Gospodarek <agospoda@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agogcov: move gcov structs definitions to a gcc version specific file
Frantisek Hrbata [Tue, 5 Nov 2013 05:57:39 +0000 (16:57 +1100)]
gcov: move gcov structs definitions to a gcc version specific file

Since also the gcov structures(gcov_info, gcov_fn_info, gcov_ctr_info) can
change between gcc releases, as shown in gcc 4.7, they cannot be defined
in a common header and need to be moved to a specific gcc implemention
file.  This also requires to make the gcov_info structure opaque for the
common code and to introduce simple helpers for accessing data inside
gcov_info.

Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Gospodarek <agospoda@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener()
Chen Gang [Tue, 5 Nov 2013 05:57:38 +0000 (16:57 +1100)]
kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener()

For registering in add_del_listener(), when kmalloc_node() fails, need
return -ENOMEM instead of success code, and cmd_attr_register_cpumask()
wants to know about it.

After modification, give a simple common test "build -> boot up ->
kernel/controllers/cgroup/getdelays by LTP tools".

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_sta...
Chen Gang [Tue, 5 Nov 2013 05:57:37 +0000 (16:57 +1100)]
kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end()

When failure occurs between nla_nest_start() and nla_nest_end(), we should
call nla_nest_cancel() to clean up related things.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/sysctl_binary.c: use scnprintf() instead of snprintf()
Chen Gang [Tue, 5 Nov 2013 05:57:37 +0000 (16:57 +1100)]
kernel/sysctl_binary.c: use scnprintf() instead of snprintf()

snprintf() will return the 'ideal' length which may be larger than real
buffer length, if we only want to use real length, need use scnprintf()
instead of.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/sysctl.c: check return value after call proc_put_char() in __do_proc_doulongve...
Chen Gang [Tue, 5 Nov 2013 05:57:36 +0000 (16:57 +1100)]
kernel/sysctl.c: check return value after call proc_put_char() in __do_proc_doulongvec_minmax()

Need to check the return value of proc_put_char(), as was done in
__do_proc_doulongvec_minmax().

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()
Chen Gang [Tue, 5 Nov 2013 05:57:36 +0000 (16:57 +1100)]
kernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()

vsnprintf() may let 'r' larger than sizeof(buf), in this case, if 'r' is
also less than "vmcoreinfo_max_size - vmcoreinfo_size" (left size of
destination buffer), next memcpy() will read the unexpected addresses.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoexec/ptrace: fix get_dumpable() incorrect tests
Kees Cook [Tue, 5 Nov 2013 05:57:35 +0000 (16:57 +1100)]
exec/ptrace: fix get_dumpable() incorrect tests

The get_dumpable() return value is not boolean.  Most users of the
function actually want to be testing for non-SUID_DUMP_USER(1) rather than
SUID_DUMP_DISABLE(0).  The SUID_DUMP_ROOT(2) is also considered a
protected state.  Almost all places did this correctly, excepting the two
places fixed in this patch.

Wrong logic:
    if (dumpable == SUID_DUMP_DISABLE) { /* be protective */ }
        or
    if (dumpable == 0) { /* be protective */ }
        or
    if (!dumpable) { /* be protective */ }

Correct logic:
    if (dumpable != SUID_DUMP_USER) { /* be protective */ }
        or
    if (dumpable != 1) { /* be protective */ }

Without this patch, if the system had set the sysctl fs/suid_dumpable=2, a
user was able to ptrace attach to processes that had dropped privileges to
that user.  (This may have been partially mitigated if Yama was enabled.)

The macros have been moved into the file that declares get/set_dumpable(),
which means things like the ia64 code can see them too.

CVE-2013-2929

Reported-by: Vasily Kulikov <segoon@openwall.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoprocfs: clean up proc_reg_get_unmapped_area for 80-column limit
HATAYAMA Daisuke [Tue, 5 Nov 2013 05:57:35 +0000 (16:57 +1100)]
procfs: clean up proc_reg_get_unmapped_area for 80-column limit

Clean up proc_reg_get_unmapped_area due to its 80-column limit
violation.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Tested-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoDocumentation/ABI: document the non-ABI status of Kconfig and symbols
Josh Triplett [Tue, 5 Nov 2013 05:57:34 +0000 (16:57 +1100)]
Documentation/ABI: document the non-ABI status of Kconfig and symbols

Discussion at Kernel Summit made it clear that the presence or absence of
specific Kconfig symbols are not considered ABI, and that no userspace (or
bootloader, etc) should rely on them.

In addition, kernel-internal symbols are well established as non-ABI, per
Documentation/stable_api_nonsense.txt.

Document both of these in Documentation/ABI/README, in a new section for
notable bits of non-ABI.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Cc: Rob Landley <rob@landley.net>
Cc: Tao Ma <boyu.mt@taobao.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Richard Weinberger <richard.weinberger@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agokernel-doc: improve "no structured comments found" error
Johannes Berg [Tue, 5 Nov 2013 05:57:33 +0000 (16:57 +1100)]
kernel-doc: improve "no structured comments found" error

When using '!Ffile function' in a docbook template, and the function no
longer exists, you get a "no structured comments found" error from the
kernel-doc processing script.  It's useful to know which functions it was
looking for, so print them out in this case.  Also do the same for '!Pfile
doc-section'

The same error also happens when using '!Efile' when some exported
functions aren't documented (in the same file.) There's a very large
number of such functions though, so don't print the message in this case
-- right now it would give ~850 messages.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Cc: Rob Landley <rob@landley.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoDocumentation/trace/tracepoints.txt: add links to TRACE_EVENT documentation
Stefan Raspl [Tue, 5 Nov 2013 05:57:33 +0000 (16:57 +1100)]
Documentation/trace/tracepoints.txt: add links to TRACE_EVENT documentation

Existing tracepoint documentation doesn't mention the popular TRACE_EVENT
macro.  Since an excellent series of articles on proper usage already
exists, respective links are added to the existing documentation.

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Cc: Rob Landley <rob@landley.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Zoltan Kiss <zoltan.kiss@citrix.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agofat: permit to return phy block number by fibmap in fallocated region
Namjae Jeon [Tue, 5 Nov 2013 05:57:32 +0000 (16:57 +1100)]
fat: permit to return phy block number by fibmap in fallocated region

Make the fibmap call the return the proper physical block number for any
offset request in the fallocated range.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agofat: fallback to buffered write in case of fallocatded region on direct IO
Namjae Jeon [Tue, 5 Nov 2013 05:57:32 +0000 (16:57 +1100)]
fat: fallback to buffered write in case of fallocatded region on direct IO

For normal cases of direct IO write, trying to seek to location greater
than file size, makes it fall back to buffered write to fill that region.
Similarly, in case for write in Fallocated region, make it fall to
buffered write.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agofat: zero out seek range on _fat_get_block
Namjae Jeon [Tue, 5 Nov 2013 05:57:31 +0000 (16:57 +1100)]
fat: zero out seek range on _fat_get_block

For normal buffered write operations, normally if we try to write to an
offset > than file size, it does a cont_expand_zero till that offset.
Now, in case of fallocated regions, since the blocks are already
allocated.  So, make it zero out that buffers for those blocks till the
seek'ed offset.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agofat: add fat_fallocate operation
Namjae Jeon [Tue, 5 Nov 2013 05:57:31 +0000 (16:57 +1100)]
fat: add fat_fallocate operation

Implement preallocation via the fallocate syscall on VFAT partitions.
This patch is based on an earlier patch of the same name which had some
issues detailed below and did not get accepted.  Refer
https://lkml.org/lkml/2007/12/22/130.

a) The preallocated space was not persistent when the
   FALLOC_FL_KEEP_SIZE flag was set.  It will deallocate cluster at evict
   time.

b) There was no need to zero out the clusters when the flag was set
   Instead of doing an expanding truncate, just allocate clusters and add
   them to the fat chain.  This reduces preallocation time.

Compatibility with windows: There are no issues when FALLOC_FL_KEEP_SIZE
is not set because it just does an expanding truncate.  Thus reading from
the preallocated area on windows returns null until data is written to it.

When a file with preallocated area using the FALLOC_FL_KEEP_SIZE was
written to on windows, the windows driver freed-up the preallocated
clusters and allocated new clusters for the new data.  The freed up
clusters gets reflected in the free space available for the partition
which can be seen from the Volume properties.

The windows chkdsk tool also does not report any errors on a disk
containing files with preallocated space.

And there is also no issue using linux fat fsck.  because discard
preallocated clusters at repair time.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agofat: add i_disksize to represent uninitialized size
Namjae Jeon [Tue, 5 Nov 2013 05:57:30 +0000 (16:57 +1100)]
fat: add i_disksize to represent uninitialized size

Add i_disksize to represent uninitialized allocated size.  And mmu_private
represent initialized allocated size.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoDocumentation/filesystems/vfat.txt: fix directory entry example
Luis Ortega Perez de Villar [Tue, 5 Nov 2013 05:57:30 +0000 (16:57 +1100)]
Documentation/filesystems/vfat.txt: fix directory entry example

Slots can store up to 13 characters for the file name but one of the
examples has one character too many.

Signed-off-by: Luis Ortega Perez de Villar <luiorpe1@upv.es>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agohfsplus-implement-attributes-file-creation-functionality-v2
Vyacheslav Dubeyko [Tue, 5 Nov 2013 05:57:29 +0000 (16:57 +1100)]
hfsplus-implement-attributes-file-creation-functionality-v2

* SETOFFSET macro was removed (Andrew Morton).
* Record offsets logic was reworked in hfsplus_init_header_node() (Al Viro).
* AttributesFile's header node's bitmap is initialized by memset() (Al Viro).
* Logic of checking attributes tree state before AttributesFile
  creation was reworked for HFSPLUS_CREATING_ATTR_TREE case (Andrew Morton).
* Setting error code was added after read_mapping_page()
  call in hfsplus_create_attributes_file() method (Andrew Morton).

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agohfsplus: implement attributes file creation functionality
Vyacheslav Dubeyko [Tue, 5 Nov 2013 05:57:28 +0000 (16:57 +1100)]
hfsplus: implement attributes file creation functionality

Implement functionality of creation AttributesFile metadata file on HFS+
volume in the case of absence of it.

It makes trying to open AttributesFile's B-tree during mount of HFS+
volume.  If HFS+ volume hasn't AttributesFile then a pointer on
AttributesFile's B-tree keeps as NULL.  Thereby, when it is discovered
absence of AttributesFile on HFS+ volume in the begin of xattr creation
operation then AttributesFile will be created.

The creation of AttributesFile will have success in the case of
availability (2 * clump) free blocks on HFS+ volume.  Otherwise, creation
operation is ended with error (-ENOSPC).

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agohfsplus-implement-attributes-files-header-node-initialization-code-v2
Vyacheslav Dubeyko [Tue, 5 Nov 2013 05:57:28 +0000 (16:57 +1100)]
hfsplus-implement-attributes-files-header-node-initialization-code-v2

* SETOFFSET macro was removed (Andrew Morton).
* Record offsets logic was reworked in hfsplus_init_header_node() (Al Viro).
* AttributesFile's header node's bitmap is initialized by memset() (Al Viro).
* Logic of checking attributes tree state before AttributesFile
  creation was reworked for HFSPLUS_CREATING_ATTR_TREE case (Andrew Morton).
* Setting error code was added after read_mapping_page()
  call in hfsplus_create_attributes_file() method (Andrew Morton).

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agohfsplus: implement attributes file's header node initialization code
Vyacheslav Dubeyko [Tue, 5 Nov 2013 05:57:27 +0000 (16:57 +1100)]
hfsplus: implement attributes file's header node initialization code

Implement functionality of AttributesFile's header node initialization.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agohfsplus: add metadata file's clump size calculation functionality
Vyacheslav Dubeyko [Tue, 5 Nov 2013 05:57:27 +0000 (16:57 +1100)]
hfsplus: add metadata file's clump size calculation functionality

There are situation when HFS+ volume had been created without
AttributesFile.  Such situation can take place because of using old
mkfs.hfs utility or creation HFS+ volume without taking in mind necessity
to use xattrs.  For example, Mac OS X 10.4 (Tiger) doesn't create
AttributesFile during mkfs phase.  Also it is a very frequent situation
for the case of users that created HFS+ volumes under Linux.  As a result,
xattrs and POSIX ACLs on HFS+ volume are unavailable for such users.

This patchset implements functionality of AttributesFile creation on HFS+
volume in the case of this metadata file absence during operation of xattr
creation.

This patch:

Add functionality of metadata file's clump size calculation.  Operation of
AttributesFile creation needs in clump size setting.  This value will be
used when AttributesFile will be extended.

This code is adopted from code of newfs_hfs utility of diskdev_cmds packet
http://opensource.apple.com/tarballs/diskdev_cmds/.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agortc: s5m-rtc: add real-time clock driver for s5m8767
Sangbeom Kim [Tue, 5 Nov 2013 05:57:26 +0000 (16:57 +1100)]
rtc: s5m-rtc: add real-time clock driver for s5m8767

Add real-time clock driver for s5m8767.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Todd Broch <tbroch@chromium.org>
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.org> [mfd parts]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-tps65910.c: remove unnecessary include
Manish Badarkhe [Tue, 5 Nov 2013 05:57:26 +0000 (16:57 +1100)]
drivers/rtc/rtc-tps65910.c: remove unnecessary include

Currently, driver includes 'pm_runtime.h' which is not used anywhere in
code hence remove this unnecessory inclusion.

Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-pl030.c: use devm_kzalloc() instead of kmalloc()
Sangjung Woo [Tue, 5 Nov 2013 05:57:25 +0000 (16:57 +1100)]
drivers/rtc/rtc-pl030.c: use devm_kzalloc() instead of kmalloc()

In order to be free automatically and make the cleanup paths more simple,
use devm_kzalloc() instead of kmalloc().

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Cc: Joe Perches <joe@perches.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-puv3.c: use dev_dbg() instead of pr_debug()
Sangjung Woo [Tue, 5 Nov 2013 05:57:25 +0000 (16:57 +1100)]
drivers/rtc/rtc-puv3.c: use dev_dbg() instead of pr_debug()

Because dev_*() are used along with pr_debug() function in this code, the
debug message is not tidy.  This patch converts from pr_debug() to
dev_dbg() since dev_*() are encouraged to use in device driver code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-pl03x.c: remove unnecessary amba_set_drvdata()
Michal Simek [Tue, 5 Nov 2013 05:57:24 +0000 (16:57 +1100)]
drivers/rtc/rtc-pl03x.c: remove unnecessary amba_set_drvdata()

Driver core clears the driver data to NULL after device_release or on
probe failure, so just remove it from here.

The relevant driver core change was 0998d063100128 ("device-core: Ensure
drvdata = NULL when no driver is bound").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ds1307.c: change variable type to bool
Peter Senna Tschudin [Tue, 5 Nov 2013 05:57:24 +0000 (16:57 +1100)]
drivers/rtc/rtc-ds1307.c: change variable type to bool

The variable want_irq is only assigned the values true and false.
Change its type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-stmp3xxx.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:23 +0000 (16:57 +1100)]
drivers/rtc/rtc-stmp3xxx.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-snvs.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:22 +0000 (16:57 +1100)]
drivers/rtc/rtc-snvs.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-sirfsoc.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:22 +0000 (16:57 +1100)]
drivers/rtc/rtc-sirfsoc.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-omap.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:21 +0000 (16:57 +1100)]
drivers/rtc/rtc-omap.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-vt8500.c: remove redundant of_match_ptr
Sachin Kamat [Tue, 5 Nov 2013 05:57:21 +0000 (16:57 +1100)]
drivers/rtc/rtc-vt8500.c: remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-v3020.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:20 +0000 (16:57 +1100)]
drivers/rtc/rtc-v3020.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-sh.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:20 +0000 (16:57 +1100)]
drivers/rtc/rtc-sh.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-rs5c348.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:19 +0000 (16:57 +1100)]
drivers/rtc/rtc-rs5c348.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-pcf2123.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:19 +0000 (16:57 +1100)]
drivers/rtc/rtc-pcf2123.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-m48t86.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:18 +0000 (16:57 +1100)]
drivers/rtc/rtc-m48t86.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-m48t59.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:18 +0000 (16:57 +1100)]
drivers/rtc/rtc-m48t59.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ep93xx.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:17 +0000 (16:57 +1100)]
drivers/rtc/rtc-ep93xx.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ds2404.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:16 +0000 (16:57 +1100)]
drivers/rtc/rtc-ds2404.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ds1307.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:16 +0000 (16:57 +1100)]
drivers/rtc/rtc-ds1307.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ds1305.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:15 +0000 (16:57 +1100)]
drivers/rtc/rtc-ds1305.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-da9055.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:15 +0000 (16:57 +1100)]
drivers/rtc/rtc-da9055.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-cmos.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:14 +0000 (16:57 +1100)]
drivers/rtc/rtc-cmos.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-88pm860x.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:14 +0000 (16:57 +1100)]
drivers/rtc/rtc-88pm860x.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-88pm80x.c: use dev_get_platdata()
Jingoo Han [Tue, 5 Nov 2013 05:57:13 +0000 (16:57 +1100)]
drivers/rtc/rtc-88pm80x.c: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to make
the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-sirfsoc.c: remove unneeded casts of void*
Jingoo Han [Tue, 5 Nov 2013 05:57:13 +0000 (16:57 +1100)]
drivers/rtc/rtc-sirfsoc.c: remove unneeded casts of void*

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-vr41xx.c: fix checkpatch warnings
Sachin Kamat [Tue, 5 Nov 2013 05:57:12 +0000 (16:57 +1100)]
drivers/rtc/rtc-vr41xx.c: fix checkpatch warnings

Fixes the following warnings:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Yoichi Yuasa <yuasa@linux-mips.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-mrst.c: remove redundant dev_set_drvdata
Sachin Kamat [Tue, 5 Nov 2013 05:57:11 +0000 (16:57 +1100)]
drivers/rtc/rtc-mrst.c: remove redundant dev_set_drvdata

Driver core sets the driver data to NULL upon device_release or on probe
failure.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-cmos.c: remove redundant dev_set_drvdata
Sachin Kamat [Tue, 5 Nov 2013 05:57:11 +0000 (16:57 +1100)]
drivers/rtc/rtc-cmos.c: remove redundant dev_set_drvdata

Driver core sets the driver data to NULL upon device_release or on probe
failure.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-sirfsoc.c: use devm_rtc_device_register
Sachin Kamat [Tue, 5 Nov 2013 05:57:10 +0000 (16:57 +1100)]
drivers/rtc/rtc-sirfsoc.c: use devm_rtc_device_register

devm_rtc_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Xianglong Du <Xianglong.Du@csr.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-isl1208.c: use devm_* APIs
Sachin Kamat [Tue, 5 Nov 2013 05:57:10 +0000 (16:57 +1100)]
drivers/rtc/rtc-isl1208.c: use devm_* APIs

devm_* APIs are device managed and make code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Herbert Valerio Riedel <hvr@gnu.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-at91rm9200.c: use devm_* APIs
Sachin Kamat [Tue, 5 Nov 2013 05:57:09 +0000 (16:57 +1100)]
drivers/rtc/rtc-at91rm9200.c: use devm_* APIs

devm_* APIs are device managed and make code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-vt8500.c: fix return value
Sachin Kamat [Tue, 5 Nov 2013 05:57:09 +0000 (16:57 +1100)]
drivers/rtc/rtc-vt8500.c: fix return value

Propagate the return value from platform_get_irq() instead of hardcoding.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-max6900.c: remove redundant checks
Sachin Kamat [Tue, 5 Nov 2013 05:57:08 +0000 (16:57 +1100)]
drivers/rtc/rtc-max6900.c: remove redundant checks

i2c_smbus_write_byte_data() returns negative errno on failure or 0 on
success.  Return the value obtained from it directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-isl1208.c: remove redundant checks
Sachin Kamat [Tue, 5 Nov 2013 05:57:08 +0000 (16:57 +1100)]
drivers/rtc/rtc-isl1208.c: remove redundant checks

i2c_smbus_read_byte_data() returns negative errno on failure.  Return the
value obtained from it directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Herbert Valerio Riedel <hvr@gnu.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/rtc/rtc-ds1307.c: release irq on error
Sachin Kamat [Tue, 5 Nov 2013 05:57:07 +0000 (16:57 +1100)]
drivers/rtc/rtc-ds1307.c: release irq on error

'client->irq' was not released on error. Fix it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoautofs4: translate pids to the right namespace for the daemon
Miklos Szeredi [Tue, 5 Nov 2013 05:57:07 +0000 (16:57 +1100)]
autofs4: translate pids to the right namespace for the daemon

The PID and the TGID of the process triggering the mount are sent to the
daemon.  Currently the global pid values are sent (ones valid in the
initial pid namespace) but this is wrong if the autofs daemon itself is
not running in the initial pid namespace.

So send the pid values that are valid in the namespace of the autofs daemon.

The namespace to use is taken from the oz_pgrp pid pointer, which was set
at mount time to the mounting process' pid namespace.

If the pid translation fails (the triggering process is in an unrelated
pid namespace) then the automount fails with ENOENT.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoautofs4: allow autofs to work outside the initial PID namespace
Sukadev Bhattiprolu [Tue, 5 Nov 2013 05:57:06 +0000 (16:57 +1100)]
autofs4: allow autofs to work outside the initial PID namespace

Enable autofs4 to work in a "container".  oz_pgrp is converted from pid_t
to struct pid and this is stored at mount time based on the "pgrp=" option
or if the option is missing then the current pgrp.

The "pgrp=" option is interpreted in the PID namespace of the current
process.  This option is flawed in that it doesn't carry the namespace
information, so it should be deprecated.  AFAICS the autofs daemon always
sends the current pgrp, which is the default anyway.

The oz_pgrp is also set from the AUTOFS_DEV_IOCTL_SETPIPEFD_CMD ioctl.
This ioctl sets oz_pgrp to the current pgrp.  It is not allowed to change
the pid namespace.

oz_pgrp is used mainly to determine whether the process traversing the
autofs mount tree is the autofs daemon itself or not.  This function now
compares the pid pointers instead of the pid_t values.

One other use of oz_pgrp is in autofs4_show_options.  There is shows the
virtual pid number (i.e.  the one that is valid inside the PID namespace
of the calling process)

For debugging printk convert oz_pgrp to the value in the initial pid
namespace.

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agodrivers/message/i2o/driver.c: add missing destroy_workqueue() on error in i2o_driver_...
Wei Yongjun [Tue, 5 Nov 2013 05:57:05 +0000 (16:57 +1100)]
drivers/message/i2o/driver.c: add missing destroy_workqueue() on error in i2o_driver_register()

Add the missing destroy_workqueue() before return from
i2o_driver_register() in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinitramfs-read-config_rd_-variables-for-initramfs-compression-fix-2
P J P [Tue, 5 Nov 2013 05:57:05 +0000 (16:57 +1100)]
initramfs-read-config_rd_-variables-for-initramfs-compression-fix-2

Signed-off-by: P J P <prasad@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinitramfs-read-config_rd_-variables-for-initramfs-compression-fix
P J P [Tue, 5 Nov 2013 05:57:04 +0000 (16:57 +1100)]
initramfs-read-config_rd_-variables-for-initramfs-compression-fix

I've patched 'gen_initramfs_list.sh' script to check if a selected
compression command is accessible or not; And fall-back to the default
gzip(1) format when it is not.  usr/Makefile also defaults to '.gz' format
when all are enabled.

Signed-off-by: P J P <prasad@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinitramfs: read CONFIG_RD_ variables for initramfs compression
P J P [Tue, 5 Nov 2013 05:57:04 +0000 (16:57 +1100)]
initramfs: read CONFIG_RD_ variables for initramfs compression

When expert configuration option(CONFIG_EXPERT) is enabled, menuconfig
offers a choice of compression algorithm to compress initial ramfs image;
This choice is stored into CONFIG_RD_* variables.  But usr/Makefile uses
earlier INITRAMFS_COMPRESSION_* macros to build initial ramfs file.  Since
none of them is defined, resulting 'initramfs_data.cpio' file remains
un-compressed.

This patch updates the Makefile to use CONFIG_RD_* variables and adds
support for LZ4 compression algorithm.  Also updates the
'gen_initramfs_list.sh' script to check whether a selected compression
command is accessible or not.  And fall-back to default gzip(1)
compression when it is not.

Signed-off-by: P J P <prasad@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinit: make init failures more explicit
Michael Opdenacker [Tue, 5 Nov 2013 05:57:03 +0000 (16:57 +1100)]
init: make init failures more explicit

This patch proposes to make init failures more explicit.

Before this, the "No init found" message didn't help much.  It could
sometimes be misleading and actually mean "No *working* init found".

This message could hide many different issues:
- no init program candidates found at all
- some init program candidates exist but can't be executed
  (missing execute permissions, failed to load shared libraries,
  executable compiled for an unknown architecture...)

This patch notifies the kernel user when a candidate init program is found
but can't be executed.  In each failure situation, the error code is
displayed, to quickly find the root cause.  "No init found" is also
replaced by "No working init found", which is more correct.

This will help embedded Linux developers (especially the newcomers),
regularly making and debugging new root filesystems.

Credits to Geert Uytterhoeven and Janne Karhunen for their improvement
suggestions.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Janne Karhunen <Janne.Karhunen@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinit-do_mounts_rdc-fix-null-pointer-dereference-while-loading-initramfs-fix
Andrew Morton [Tue, 5 Nov 2013 05:57:03 +0000 (16:57 +1100)]
init-do_mounts_rdc-fix-null-pointer-dereference-while-loading-initramfs-fix

mention that the problem is with the ramdisk, don't print known-to-be-NULL value

Cc: P J P <prasad@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinit/do_mounts_rd.c: fix NULL pointer dereference while loading initramfs
P J P [Tue, 5 Nov 2013 05:57:02 +0000 (16:57 +1100)]
init/do_mounts_rd.c: fix NULL pointer dereference while loading initramfs

Make menuconfig allows one to choose compression format of an initial
ramdisk image.  But this choice does not result in duly compressed initial
ramdisk image.  Because - $ make install - does not pass on the selected
compression choice to the dracut(8) tool, which creates the initramfs
file.  dracut(8) generates the image with the default compression, ie.
gzip(1).

If a user chose any other compression instead of gzip(1), it leads to a
crash due to NULL pointer dereference in crd_load(), caused by a NULL
function pointer returned by the 'decompress_method()' routine.  Because
the initramfs image is gzip(1) compressed, whereas the kernel knows only
to decompress the chosen format and not gzip(1).

This patch replaces the crash by an explicit panic() call with an
appropriate error message. This shall prevent the kernel from
eventually panicking in: init/do_mounts.c: mount_block_root() with
  -> panic("VFS: Unable to mount root fs on %s", b);

Signed-off-by: P J P <prasad@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agoinit.h: document the existence of __initconst
Geert Uytterhoeven [Tue, 5 Nov 2013 05:57:02 +0000 (16:57 +1100)]
init.h: document the existence of __initconst

Initdata can be const since more than 5 years, using the __initconst
keyword.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
10 years agobinfmt_elf.c: use get_random_int() to fix entropy depleting
Jeff Liu [Tue, 5 Nov 2013 05:57:01 +0000 (16:57 +1100)]
binfmt_elf.c: use get_random_int() to fix entropy depleting

Entropy is quickly depleted under normal operations like ls(1), cat(1),
etc...  between 2.6.30 to current mainline, for instance:

$ cat /proc/sys/kernel/random/entropy_avail
3428
$ cat /proc/sys/kernel/random/entropy_avail
2911
$cat /proc/sys/kernel/random/entropy_avail
2620

We observed this problem has been occurring since 2.6.30 with
fs/binfmt_elf.c: create_elf_tables()->get_random_bytes(), introduced by
f06295b44c296c8f ("ELF: implement AT_RANDOM for glibc PRNG seeding").

/*
 * Generate 16 random bytes for userspace PRNG seeding.
 */
get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));

The patch introduces a wrapper around get_random_int() which has lower
overhead than calling get_random_bytes() directly.

With this patch applied:
$ cat /proc/sys/kernel/random/entropy_avail
2731
$ cat /proc/sys/kernel/random/entropy_avail
2802
$ cat /proc/sys/kernel/random/entropy_avail
2878

Analyzed by John Sobecki.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <aedilger@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnn@arndb.de>
Cc: John Sobecki <john.sobecki@oracle.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>