]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
11 years agoipc: cleanup do_msgrcv() around MSG_COPY feature
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:59 +0000 (14:18 +1100)]
ipc: cleanup do_msgrcv() around MSG_COPY feature

MSG_COPY feature was developed for Checkpoint/Restart In User space project
and thus wrapped in CONFIG_CHECKPOINT_RESTORE macro. But code look a bit ugly.
So this patch is an attempt to cleanup do_msgrcv() a bit and make it looks
better.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: remove redundant MSG_COPY check
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:58 +0000 (14:18 +1100)]
ipc: remove redundant MSG_COPY check

Small cleanup patch.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: introduce message queue copy feature
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:58 +0000 (14:18 +1100)]
ipc: introduce message queue copy feature

This patch is required for checkpoint/restore in userspace.

c/r requires some way to get all pending IPC messages without deleting
them from the queue (checkpoint can fail and in this case tasks will be
resumed, so queue have to be valid).

To achive this, new operation flag MSG_COPY for sys_msgrcv() system call
was introduced.  If this flag was specified, then mtype is interpreted as
number of the message to copy.

If MSG_COPY is set, then kernel will allocate dummy message with passed
size, and then use new copy_msg() helper function to copy desired message
(instead of unlinking it from the queue).

Notes:

1) Return -ENOSYS if MSG_COPY is specified, but
   CONFIG_CHECKPOINT_RESTORE is not set.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc-message-queue-receive-cleanup-checkpatch-fixes
Andrew Morton [Thu, 29 Nov 2012 03:18:58 +0000 (14:18 +1100)]
ipc-message-queue-receive-cleanup-checkpatch-fixes

WARNING: line over 80 characters
#33: FILE: include/linux/msg.h:39:
+       long (*msg_fill)(void __user *, struct msg_msg *, size_t ));

ERROR: space prohibited before that close parenthesis ')'
#33: FILE: include/linux/msg.h:39:
+       long (*msg_fill)(void __user *, struct msg_msg *, size_t ));

WARNING: line over 80 characters
#94: FILE: ipc/compat.c:368:
+ return do_msgrcv(first, uptr, second, msgtyp, third, compat_do_msg_fill);

ERROR: space prohibited before that close parenthesis ')'
#142: FILE: ipc/msg.c:774:
+        long (*msg_handler)(void __user *, struct msg_msg *, size_t ))

total: 2 errors, 2 warnings, 165 lines checked

./patches/ipc-message-queue-receive-cleanup.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: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: message queue receive cleanup
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:58 +0000 (14:18 +1100)]
ipc: message queue receive cleanup

Move all message related manipulation into one function msg_fill().
Actually, two functions because of the compat one.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoDocumentation: update sysctl/kernel.txt
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:57 +0000 (14:18 +1100)]
Documentation: update sysctl/kernel.txt

Add documentation about new "msg_next_id", "sem_next_id" and "shm_next_id"
sysctls.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: wrap new sysctls for CRIU inside CONFIG_CHECKPOINT_RESTORE
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:57 +0000 (14:18 +1100)]
ipc: wrap new sysctls for CRIU inside CONFIG_CHECKPOINT_RESTORE

Wrap "msg_next_id", "sem_next_id" and "shm_next_id" inside
CONFIG_CHECKPOINT_RESTORE macro.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc-add-sysctl-to-specify-desired-next-object-id-checkpatch-fixes
Andrew Morton [Thu, 29 Nov 2012 03:18:57 +0000 (14:18 +1100)]
ipc-add-sysctl-to-specify-desired-next-object-id-checkpatch-fixes

ERROR: space required before the open parenthesis '('
#123: FILE: ipc/util.c:285:
+ if(ids->seq > ids->seq_max)

total: 1 errors, 0 warnings, 94 lines checked

./patches/ipc-add-sysctl-to-specify-desired-next-object-id.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: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: add sysctl to specify desired next object id
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:56 +0000 (14:18 +1100)]
ipc: add sysctl to specify desired next object id

Add 3 new variables and sysctls to tune them (by one "next_id" variable
for messages, semaphores and shared memory respectively).  This variable
can be used to set desired id for next allocated IPC object.  By default
it's equal to -1 and old behaviour is preserved.  If this variable is
non-negative, then desired idr will be extracted from it and used as a
start value to search for free IDR slot.

Notes:

1) this patch doesn't guarantee that the new object will have desired
   id.  So it's up to user space how to handle new object with wrong id.

2) After a sucessful id allocation attempt, "next_id" will be set back
   to -1 (if it was non-negative).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoipc: remove forced assignment of selected message
Stanislav Kinsbursky [Thu, 29 Nov 2012 03:18:56 +0000 (14:18 +1100)]
ipc: remove forced assignment of selected message

This is a cleanup patch. The assignment is redundant.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoexec: use -ELOOP for max recursion depth
Kees Cook [Thu, 29 Nov 2012 03:18:56 +0000 (14:18 +1100)]
exec: use -ELOOP for max recursion depth

To avoid an explosion of request_module calls on a chain of abusive
scripts, fail maximum recursion with -ELOOP instead of -ENOEXEC. As soon
as maximum recursion depth is hit, the error will fail all the way back
up the chain, aborting immediately.

This also has the side-effect of stopping the user's shell from attempting
to reexecute the top-level file as a shell script. As seen in the
dash source:

        if (cmd != path_bshell && errno == ENOEXEC) {
                *argv-- = cmd;
                *argv = cmd = path_bshell;
                goto repeat;
        }

The above logic was designed for running scripts automatically that lacked
the "#!" header, not to re-try failed recursion. On a legitimate -ENOEXEC,
things continue to behave as the shell expects.

Additionally, when tracking recursion, the binfmt handlers should not be
involved. The recursion being tracked is the depth of calls through
search_binary_handler(), so that function should be exclusively responsible
for tracking the depth.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: halfdog <me@halfdog.net>
Cc: P J P <ppandit@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoexec: do not leave bprm->interp on stack
Kees Cook [Thu, 29 Nov 2012 03:18:55 +0000 (14:18 +1100)]
exec: do not leave bprm->interp on stack

If a series of scripts are executed, each triggering module loading via
unprintable bytes in the script header, kernel stack contents can leak
into the command line.

Normally execution of binfmt_script and binfmt_misc happens recursively.
However, when modules are enabled, and unprintable bytes exist in the
bprm->buf, execution will restart after attempting to load matching binfmt
modules.  Unfortunately, the logic in binfmt_script and binfmt_misc does
not expect to get restarted.  They leave bprm->interp pointing to their
local stack.  This means on restart bprm->interp is left pointing into
unused stack memory which can then be copied into the userspace argv
areas.

After additional study, it seems that both recursion and restart remains
the desirable way to handle exec with scripts, misc, and modules.  As
such, we need to protect the changes to interp.

This changes the logic to require allocation for any changes to the
bprm->interp.  To avoid adding a new kmalloc to every exec, the default
value is left as-is.  Only when passing through binfmt_script or
binfmt_misc does an allocation take place.

For a proof of concept, see DoTest.sh from:
http://www.halfdog.net/Security/2012/LinuxKernelBinfmtScriptStackDataDisclosure/

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: halfdog <me@halfdog.net>
Cc: P J P <ppandit@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agofork: unshare: remove dead code
Alan Cox [Thu, 29 Nov 2012 03:18:55 +0000 (14:18 +1100)]
fork: unshare: remove dead code

If new_nsproxy is set we will always call switch_task_namespaces and then
set new_nsproxy back to NULL so the reassignment and fall through check
are redundant

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoproc: pid/status: show all supplementary groups
Artem Bityutskiy [Thu, 29 Nov 2012 03:18:55 +0000 (14:18 +1100)]
proc: pid/status: show all supplementary groups

We display a list of supplementary group for each process in
/proc/<pid>/status.  However, we show only the first 32 groups, not all of
them.

Although this is rare, but sometimes processes do have more than 32
supplementary groups, and this kernel limitation breaks user-space apps
that rely on the group list in /proc/<pid>/status.

Number 32 comes from the internal NGROUPS_SMALL macro which defines the
length for the internal kernel "small" groups buffer.  There is no
apparent reason to limit to this value.

This patch removes the 32 groups printing limit.

The Linux kernel limits the amount of supplementary groups by NGROUPS_MAX,
which is currently set to 65536.  And this is the maximum count of groups
we may possibly print.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years ago/proc/pid/status: add "Seccomp" field
Kees Cook [Thu, 29 Nov 2012 03:18:54 +0000 (14:18 +1100)]
/proc/pid/status: add "Seccomp" field

It is currently impossible to examine the state of seccomp for a given
process.  While attaching with gdb and attempting "call
prctl(PR_GET_SECCOMP,...)" will work with some situations, it is not
reliable.  If the process is in seccomp mode 1, this query will kill the
process (prctl not allowed), if the process is in mode 2 with prctl not
allowed, it will similarly be killed, and in weird cases, if prctl is
filtered to return errno 0, it can look like seccomp is disabled.

When reviewing the state of running processes, there should be a way to
externally examine the seccomp mode.  ("Did this build of Chrome end up
using seccomp?" "Did my distro ship ssh with seccomp enabled?")

This adds the "Seccomp" line to /proc/$pid/status.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: James Morris <jmorris@namei.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoprocfs-add-vmflags-field-in-smaps-output-v4-fix
Andrew Morton [Thu, 29 Nov 2012 03:18:54 +0000 (14:18 +1100)]
procfs-add-vmflags-field-in-smaps-output-v4-fix

remove unneeded brakes per sfr, avoid using bloaty for_each_set_bit()

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoprocfs: add VmFlags field in smaps output
Cyrill Gorcunov [Thu, 29 Nov 2012 03:18:54 +0000 (14:18 +1100)]
procfs: add VmFlags field in smaps output

During c/r sessions we've found that there is no way at the moment to
fetch some VMA associated flags, such as mlock() and madvise().

This leads us to a problem -- we don't know if we should call for mlock()
and/or madvise() after restore on the vma area we're bringing back to
life.

This patch intorduces a new field into "smaps" output called VmFlags,
where all set flags associated with the particular VMA is shown as two
letter mnemonics.

[ Strictly speaking for c/r we only need mlock/madvise bits but it has been
  said that providing just a few flags looks somehow inconsistent.  So all
  flags are here now. ]

This feature is made available on CONFIG_CHECKPOINT_RESTORE=n kernels, as
other applications may start to use these fields.

The data is encoded in a somewhat awkward two letters mnemonic form, to
encourage userspace to be prepared for fields being added or removed in
the future.

[a.p.zijlstra@chello.nl: props to use for_each_set_bit]
[sfr@canb.auug.org.au: props to use array instead of struct]
[akpm@linux-foundation.org: overall redesign and simplification]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoproc: don't show nonexistent capabilities
Andrew Vagin [Thu, 29 Nov 2012 03:18:53 +0000 (14:18 +1100)]
proc: don't show nonexistent capabilities

Without this patch it is really hard to interpret a bounding set, if
CAP_LAST_CAP is unknown for a current kernel.

Non-existant capabilities can not be deleted from a bounding set with help
of prctl.

E.g.: Here are two examples without/with this patch.
CapBnd: ffffffe0fdecffff
CapBnd: 00000000fdecffff

I suggest to hide non-existent capabilities. Here is two reasons.
* It's logically and easier for using.
* It helps to checkpoint-restore capabilities of tasks, because tasks
can be restored on another kernel, where CAP_LAST_CAP is bigger.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Cc: Andrew G. Morgan <morgan@kernel.org>
Reviewed-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoptrace: introduce PTRACE_O_EXITKILL
Oleg Nesterov [Thu, 29 Nov 2012 03:18:53 +0000 (14:18 +1100)]
ptrace: introduce PTRACE_O_EXITKILL

Ptrace jailers want to be sure that the tracee can never escape
from the control. However if the tracer dies unexpectedly the
tracee continues to run in potentially unsafe mode.

Add the new ptrace option PTRACE_O_EXITKILL. If the tracer exits
it sends SIGKILL to every tracee which has this bit set.

Note that the new option is not equal to the last-option << 1.  Because
currently all options have an event, and the new one starts the eventless
group.  It uses the random 20 bit, so we have the room for 12 more events,
but we can also add the new eventless options below this one.

Suggested by Amnon Shiloh.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Tested-by: Amnon Shiloh <u3557@miso.sublimeip.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Chris Evans <scarybeasts@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agosimple_strto*: annotate function as obsolete
Eldad Zack [Thu, 29 Nov 2012 03:18:53 +0000 (14:18 +1100)]
simple_strto*: annotate function as obsolete

Update the documentation for simple_strto* to reflect that it has been
obsoleted and advise the usage of kstrto*.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Cc: J. Bruce Fields <bfields@fieldses.org>
Cc: Joe Perches <joe@perches.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agokstrto*: add documentation
Eldad Zack [Thu, 29 Nov 2012 03:18:52 +0000 (14:18 +1100)]
kstrto*: add documentation

As Bruce Fields pointed out, kstrto* is currently lacking kerneldoc
comments.  This patch adds kerneldoc comments to common variants of
kstrto*: kstrto(u)l, kstrto(u)ll and kstrto(u)int.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Cc: J. Bruce Fields <bfields@fieldses.org>
Cc: Joe Perches <joe@perches.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoDocumentation: fix Documentation/security/00-INDEX
Jarkko Sakkinen [Thu, 29 Nov 2012 03:18:52 +0000 (14:18 +1100)]
Documentation: fix Documentation/security/00-INDEX

keys-ecryptfs.txt was missing from 00-INDEX.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoDocumentation/DMA-API-HOWTO.txt: minor grammar corrections
Shuah Khan [Thu, 29 Nov 2012 03:18:52 +0000 (14:18 +1100)]
Documentation/DMA-API-HOWTO.txt: minor grammar corrections

Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agofs/fat: strip "cp" prefix from codepage in display
Dave Reisner [Thu, 29 Nov 2012 03:18:52 +0000 (14:18 +1100)]
fs/fat: strip "cp" prefix from codepage in display

Option parsing code expects an unsigned integer for the codepage option,
but prefixes and stores this option with "cp" before passing to
load_nls().  This makes the displayed option in /proc an invalid one.
Strip the prefix when printing so that the displayed option is valid for
reuse.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agofat: ix mount option parsing
Jan Kara [Thu, 29 Nov 2012 03:18:51 +0000 (14:18 +1100)]
fat: ix mount option parsing

parse_options() is supposed to return value < 0 on error however we
returned 0 (success) in a lot of cases.  This actually was not a problem
in practice because match_token() used by parse_options() is clever and
catches most of the problems for us.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agofat: provide option for setting timezone offset
Jan Kara [Thu, 29 Nov 2012 03:18:51 +0000 (14:18 +1100)]
fat: provide option for setting timezone offset

So far FAT either offsets time stamps by sys_tz.minuteswest or leaves them
as they are (when tz=UTC mount option is used).  However in some cases it
is useful if one can specify time stamp offset on his own (e.g.  when time
zone of the camera connected is different from time zone of the computer,
or when HW clock is in UTC and thus sys_tz.minuteswest == 0).

So provide a mount option time_offset= which allows user to specify offset
in minutes that should be applied to time stamps on the filesystem.

akpm: this code would work incorrectly when used via `mount -o remount',
because cached inodes would not be updated.  But fatfs's fat_remount() is
basically a no-op anyway.

Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agofat: notify when discard is not supported
Namjae Jeon [Thu, 29 Nov 2012 03:18:51 +0000 (14:18 +1100)]
fat: notify when discard is not supported

Change fatfs so that a warning is emitted when an attempt is made to mount
a filesystem with the unsupported `discard' option.

ext4 aready does this: http://patchwork.ozlabs.org/patch/192668/

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Amit Sahrawat <amit.sahrawat83@gmail.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: rework processing errors in hfsplus_free_extents()
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:50 +0000 (14:18 +1100)]
hfsplus: rework processing errors in hfsplus_free_extents()

Currently, it doesn't process error codes from the hfsplus_block_free()
call in hfsplus_free_extents() method.  Add some error code processing.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: add support of manipulation by attributes file
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:50 +0000 (14:18 +1100)]
hfsplus: add support of manipulation by attributes file

Add support of manipulation by attributes file.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus-rework-functionality-of-getting-setting-and-deleting-of-extended-attributes-fix
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:50 +0000 (14:18 +1100)]
hfsplus-rework-functionality-of-getting-setting-and-deleting-of-extended-attributes-fix

Fix warning in [next:akpm 357/436] fs/hfsplus/xattr.c:363:23: sparse: cast to restricted __be32.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: rework functionality of getting, setting and deleting of extended attributes
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:49 +0000 (14:18 +1100)]
hfsplus: rework functionality of getting, setting and deleting of extended attributes

Rework functionality of getting, setting and deleting of extended attributes.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: add functionality of manipulating by records in attributes tree
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:49 +0000 (14:18 +1100)]
hfsplus: add functionality of manipulating by records in attributes tree

Add functionality of manipulating by records in attributes tree.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: add on-disk layout declarations related to attributes tree
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:49 +0000 (14:18 +1100)]
hfsplus: add on-disk layout declarations related to attributes tree

Add all necessary on-disk layout declarations related to attributes file.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus-add-osx-prefix-for-handling-namespace-of-mac-os-x-extended-attributes-checkpa...
Andrew Morton [Thu, 29 Nov 2012 03:18:48 +0000 (14:18 +1100)]
hfsplus-add-osx-prefix-for-handling-namespace-of-mac-os-x-extended-attributes-checkpatch-fixes

Cc: Al Viro <viro@zeniv.linux.org.uk>
WARNING: space prohibited between function name and open parenthesis '('
#66: FILE: include/uapi/linux/xattr.h:21:
+#define XATTR_MAC_OSX_PREFIX_LEN (sizeof (XATTR_MAC_OSX_PREFIX) - 1)

total: 0 errors, 1 warnings, 9 lines checked

./patches/hfsplus-add-osx-prefix-for-handling-namespace-of-mac-os-x-extended-attributes.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: Vyacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: add osx.* prefix for handling namespace of Mac OS X extended attributes
Vyacheslav Dubeyko [Thu, 29 Nov 2012 03:18:48 +0000 (14:18 +1100)]
hfsplus: add osx.* prefix for handling namespace of Mac OS X extended attributes

hfsplus: reworked support of extended attributes.

Current mainline implementation of hfsplus file system driver treats as
extended attributes only two fields (fdType and fdCreator) of user_info
field in file description record (struct hfsplus_cat_file).  It is
possible to get or set only these two fields as extended attributes.  But
HFS+ treats as com.apple.FinderInfo extended attribute an union of
user_info and finder_info fields as for file (struct hfsplus_cat_file) as
for folder (struct hfsplus_cat_folder).  Moreover, current mainline
implementation of hfsplus file system driver doesn't support special
metadata file - attributes tree.

Mac OS X 10.4 and later support extended attributes by making use of the
HFS+ filesystem Attributes file B*-tree feature which allows for named
forks.  Mac OS X supports only inline extended attributes, limiting their
size to 3802 bytes.  Any regular file may have a list of extended
attributes.  HFS+ supports an arbitrary number of named forks.  Each
attribute is denoted by a name and the associated data.  The name is a
null-terminated Unicode string.  It is possible to list, to get, to set,
and to remove extended attributes from files or directories.

It exists some peculiarity during getting of extended attributes list by
means of getfattr utility.  The getfattr utility expects prefix "user."
before any extended attribute's name.  So, it ignores any names that don't
contained such prefix.  Such behavior of getfattr utility results in
unexpected empty output of extended attributes list even in the case when
file (or folder) contains extended attributes.  It needs to use empty
string as regular expression pattern for names matching (getfattr
--match="").

For support of extended attributes in HFS+:
1. It was added necessary on-disk layout declarations related to Attributes
   tree into hfsplus_raw.h file.
2. It was added attributes.c file with implementation of functionality of
   manipulation by records in Attributes tree.
3. It was reworked hfsplus_listxattr, hfsplus_getxattr, hfsplus_setxattr
   functions in ioctl.c. Moreover, it was added hfsplus_removexattr method.

This patch:

Add osx.* prefix for handling namespace of Mac OS X extended attributes.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agohfsplus: avoid crash on failed block map free
Alan Cox [Thu, 29 Nov 2012 03:18:48 +0000 (14:18 +1100)]
hfsplus: avoid crash on failed block map free

If the read fails we kmap an error code.  This doesn't end well.  Instead
print a critical error and pray.  This mirrors the rest of the fs
behaviour with critical error cases.

Acked-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-dev.c: remove unused code from rtc-dev.c
Sachin Kamat [Thu, 29 Nov 2012 03:18:47 +0000 (14:18 +1100)]
drivers/rtc/rtc-dev.c: remove unused code from rtc-dev.c

This code is under #if 0 and not used.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-s3c.c: convert to use devm_* API
Tushar Behera [Thu, 29 Nov 2012 03:18:47 +0000 (14:18 +1100)]
drivers/rtc/rtc-s3c.c: convert to use devm_* API

rtc-s3c driver is modified to use devm_request_and_ioremap() (combining
request_mem_region and ioremap), devm_clk_get() and devm_request_irq()
APIs.  Since this removes the necessity of freeing the related resources
the return path is also simplified.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-s3c.c: remove unnecessary err_nores label
Tushar Behera [Thu, 29 Nov 2012 03:18:47 +0000 (14:18 +1100)]
drivers/rtc/rtc-s3c.c: remove unnecessary err_nores label

err_nores label redirects to a simple return statement.  Move the return
statement to caller location and remove the label.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc-add-nxp-pcf8523-support-v2
Thierry Reding [Thu, 29 Nov 2012 03:18:47 +0000 (14:18 +1100)]
rtc-add-nxp-pcf8523-support-v2

Changes in v2:
- return an error if the OS flag cannot be cleared
- add comment as to why we clear the OS flag
- restart RTC if setting the time fails

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: add NXP PCF8523 support
Thierry Reding [Thu, 29 Nov 2012 03:18:46 +0000 (14:18 +1100)]
rtc: add NXP PCF8523 support

Add an RTC driver for PCF8523 chips by NXP Semiconductors.  No support is
currently provided for the alarm and interrupt functions.  Only the time
and date functionality is implemented.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: rtc-davinci: use devm_kzalloc()
Devendra Naga [Thu, 29 Nov 2012 03:18:46 +0000 (14:18 +1100)]
rtc: rtc-davinci: use devm_kzalloc()

Use devm_kzalloc() and remove the error path free and the unload free as
devm functions take care of freeing resources.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: rtc-davinci: return correct error code if rtc_device_register() fails
Devendra Naga [Thu, 29 Nov 2012 03:18:46 +0000 (14:18 +1100)]
rtc: rtc-davinci: return correct error code if rtc_device_register() fails

rtc_device_register() returns a pointer containing error code in case
of error.  Use that in the error return.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-tps65910.c: rename irq to match device
Sivaram Nair [Thu, 29 Nov 2012 03:18:45 +0000 (14:18 +1100)]
drivers/rtc/rtc-tps65910.c: rename irq to match device

A cosmetic change to rename the irq name to match the device name.

Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: rtc-spear: Provide flag for no support of UIE mode
Deepak Sikri [Thu, 29 Nov 2012 03:18:45 +0000 (14:18 +1100)]
rtc: rtc-spear: Provide flag for no support of UIE mode

The applications can set the RTC hardware to trigger interrupts in one
of three modes:
    * AIE: Alarm interrupt
    * UIE: Update interrupt (ie: once per second)
    * PIE: Periodic interrupt (sub-second irqs)

The above defined 3 modes are to be supported in the RTC HW in form of
interrupts. The SPEAr RTC hardware does not support the later two modes.

There have been refinements in the RTC core in mainline related to
use of timer queue infrastructure to manage events in RTC. Please refer
the below mentioned patch for details:
* RTC: Rework RTC code to use timerqueue for events
* SHA ID: 6610e0893b8bc6f59b14fed7f089c5997f035f88

There have been provisions added to support hardware that do not have
support the UIE mode. Please refer the following patch.
* rtc: Provide flag for rtc devices that don't support UIE
* SHA ID: 4a649903f91232d02284d53724b0a45728111767

The patch makes use of the provision defined in the above patch to
update the hardware status of UIE mode.

Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: rtc-spear: Add clk_{un}prepare() support
Deepak Sikri [Thu, 29 Nov 2012 03:18:45 +0000 (14:18 +1100)]
rtc: rtc-spear: Add clk_{un}prepare() support

clk_{un}prepare is mandatory for platforms using common clock framework.
Because for SPEAr we don't do anything in clk_{un}prepare() calls, just
call them once in probe/remove.

Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc-rtc-spear-use-devm_-routines-fix
Viresh Kumar [Thu, 29 Nov 2012 03:18:44 +0000 (14:18 +1100)]
rtc-rtc-spear-use-devm_-routines-fix

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: rtc-spear: use devm_*() routines
Viresh Kumar [Thu, 29 Nov 2012 03:18:44 +0000 (14:18 +1100)]
rtc: rtc-spear: use devm_*() routines

Free the rtc-spear driver from tension of freeing resources :) devm_*
derivatives of multiple routines are used while allocating resources,
which would be freed automatically by kernel.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc-avoid-calling-platform_device_put-twice-in-test_init-fix
Andrew Morton [Thu, 29 Nov 2012 03:18:44 +0000 (14:18 +1100)]
rtc-avoid-calling-platform_device_put-twice-in-test_init-fix

improve label naming

Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-test.c: avoid calling platform_device_put() twice
Wei Yongjun [Thu, 29 Nov 2012 03:18:43 +0000 (14:18 +1100)]
drivers/rtc/rtc-test.c: avoid calling platform_device_put() twice

In case of error, test_init() needs to call platform_device_del() instead
of platform_device_unregister().  Otherwise, we may call
platform_device_put() twice.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-vt8500.c: convert to use devm_kzalloc
Devendra Naga [Thu, 29 Nov 2012 03:18:43 +0000 (14:18 +1100)]
drivers/rtc/rtc-vt8500.c: convert to use devm_kzalloc

Replace the kzalloc() and kfree() calls with devm_kzalloc().

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexey Charkov <alchark@gmail.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-imxdi.c: add devicetree support
Roland Stigge [Thu, 29 Nov 2012 03:18:43 +0000 (14:18 +1100)]
drivers/rtc/rtc-imxdi.c: add devicetree support

Add device tree support to the rtc-imxdi driver.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/rtc/rtc-imxdi: support for i.MX53
Roland Stigge [Thu, 29 Nov 2012 03:18:42 +0000 (14:18 +1100)]
drivers/rtc/rtc-imxdi: support for i.MX53

Enable support for i.MX53 in addition to i.MX25 by enabling the driver on
ARCH_MXC generally.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: omap: add runtime pm support
Vaibhav Hiremath [Thu, 29 Nov 2012 03:18:42 +0000 (14:18 +1100)]
rtc: omap: add runtime pm support

OMAP1 RTC driver is used in multiple devices like, OMAPL138 and AM33XX.
Driver currently doesn't handle any clocks, which may be right for OMAP1
architecture but in case of AM33XX, the clock/module needs to be enabled
in order to access the registers.

So convert this driver to runtime pm, which internally handles rest.

[afzal@ti.com: handle error path]
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Afzal Mohammed <afzal@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: omap: depend on am33xx
Afzal Mohammed [Thu, 29 Nov 2012 03:18:42 +0000 (14:18 +1100)]
rtc: omap: depend on am33xx

rtc-omap driver can be reused for AM33xx RTC.  Provide dependency in
Kconfig.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: omap: dt support
Afzal Mohammed [Thu, 29 Nov 2012 03:18:42 +0000 (14:18 +1100)]
rtc: omap: dt support

Enhance rtc-omap driver with DT capability

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoARM: davinci: remove rtc kicker release
Afzal Mohammed [Thu, 29 Nov 2012 03:18:41 +0000 (14:18 +1100)]
ARM: davinci: remove rtc kicker release

rtc-omap driver is now capable of handling kicker mechanism, hence remove
kicker handling at platform level, instead provide proper device name so
that driver can handle kicker mechanism by itself

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agortc: omap: kicker mechanism support
Afzal Mohammed [Thu, 29 Nov 2012 03:18:41 +0000 (14:18 +1100)]
rtc: omap: kicker mechanism support

OMAP RTC IP can have kicker feature.  This prevents spurious writes to
register.  To write to registers kicker lock has to be released.
Procedure to do it as follows,

1. write to kick0 register, 0x83e70b13
2. write to kick1 register, 0x95a4f1e0

Writing value other than 0x83e70b13 to kick0 enables write locking, more
details about kicker mechanism can be found in section 20.3.3.5.3 of
AM335X TRM @www.ti.com/am335x

Here id table information is added and is used to distinguish those that
require kicker handling and the ones that doesn't need it.  There are more
features in the newer IP's compared to legacy ones other than kicker,
which driver currently doesn't handle, supporting additional features
would be easier with the addition of id table.

Older IP (of OMAP1) doesn't have revision register as per TRM, so revision
register can't be relied always to find features, hence id table is being
used.

While at it, replace __raw_writeb/__raw_readb with writeb/readb; this
driver is used on ARMv7 (AM335X SoC)

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobinfmt_elf.c: use get_random_int() to fix entropy depleting
Jeff Liu [Thu, 29 Nov 2012 03:18:41 +0000 (14:18 +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>
11 years agobinfmt_elf-fix-corner-case-kfree-of-uninitialized-data-checkpatch-fixes
Andrew Morton [Thu, 29 Nov 2012 03:18:40 +0000 (14:18 +1100)]
binfmt_elf-fix-corner-case-kfree-of-uninitialized-data-checkpatch-fixes

WARNING: line over 80 characters
#24: FILE: fs/binfmt_elf.c:1604:
+ info->psinfo.data = NULL; /* So we don't free this wrongly */

ERROR: code indent should use tabs where possible
#26: FILE: fs/binfmt_elf.c:1606:
+        }$

WARNING: please, no spaces at the start of a line
#26: FILE: fs/binfmt_elf.c:1606:
+        }$

total: 1 errors, 2 warnings, 11 lines checked

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

./patches/binfmt_elf-fix-corner-case-kfree-of-uninitialized-data.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: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobinfmt_elf: fix corner case kfree of uninitialized data
Alan Cox [Thu, 29 Nov 2012 03:18:40 +0000 (14:18 +1100)]
binfmt_elf: fix corner case kfree of uninitialized data

If elf_core_dump() is called and fill_note_info() fails in the kmalloc()
then it returns 0 but has not yet initialised all the needed fields.  As a
result we do a kfree(randomness) after correctly skipping the thread data.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoepoll: support for disabling items, and a self-test app
Paton J. Lewis [Thu, 29 Nov 2012 03:18:40 +0000 (14:18 +1100)]
epoll: support for disabling items, and a self-test app

It is not currently possible to reliably delete epoll items when using the
same epoll set from multiple threads.  After calling epoll_ctl with
EPOLL_CTL_DEL, another thread might still be executing code related to an
event for that epoll item (in response to epoll_wait).  Therefore the
deleting thread does not know when it is safe to delete resources
pertaining to the associated epoll item because another thread might be
using those resources.

The deleting thread could wait an arbitrary amount of time after calling
epoll_ctl with EPOLL_CTL_DEL and before deleting the item, but this is
inefficient and could result in the destruction of resources before
another thread is done handling an event returned by epoll_wait.

This patch enhances epoll_ctl to support EPOLL_CTL_DISABLE, which disables
an epoll item.  If epoll_ctl returns -EBUSY in this case, then another
thread may handling a return from epoll_wait for this item.  Otherwise if
epoll_ctl returns 0, then it is safe to delete the epoll item.  This
allows multiple threads to use a mutex to determine when it is safe to
delete an epoll item and its associated resources, which allows epoll
items to be deleted both efficiently and without error in a multi-threaded
environment.  Note that EPOLL_CTL_DISABLE is only useful in conjunction
with EPOLLONESHOT, and using EPOLL_CTL_DISABLE on an epoll item without
EPOLLONESHOT returns -EINVAL.

This patch also adds a new test_epoll self-test program to both
demonstrate the need for this feature and test it.

Signed-off-by: Paton J. Lewis <palewis@adobe.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Paul Holland <pholland@adobe.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: Add --strict messages for blank lines around braces
Joe Perches [Thu, 29 Nov 2012 03:18:39 +0000 (14:18 +1100)]
checkpatch: Add --strict messages for blank lines around braces

Blank lines around braces are not unnecessary.  Emit a message on the use
of these blank lines only when using --strict.

int foo(int bar)
{

something or other....

}

is generally written in the kernel as:

int foo(int bar)
{
something or other...
}

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: extend line continuation test
Joe Perches [Thu, 29 Nov 2012 03:18:39 +0000 (14:18 +1100)]
checkpatch: extend line continuation test

Preprocessor directives and asm statements should be allowed to have a
line continuation.

Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: allow control over line length warning, default remains 80
Joe Perches [Thu, 29 Nov 2012 03:18:39 +0000 (14:18 +1100)]
checkpatch: allow control over line length warning, default remains 80

Some projects might want a longer line length so allow a command line
--max-line-length=n control over the long line warnings.  The default line
length is 80.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Constantine Shulyupin <const@makelinux.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: consolidate if (foo) bar(foo) checks and add debugfs_remove
Andy Whitcroft [Thu, 29 Nov 2012 03:18:38 +0000 (14:18 +1100)]
checkpatch: consolidate if (foo) bar(foo) checks and add debugfs_remove

Consolidate the if (foo) bar(foo) detectors into a single check.  Add
debugfs_remove and family.

Based on a patch by Constantine Shulyupin.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Constantine Shulyupin <const@MakeLinux.com>.
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: remove reference to feature-removal-schedule.txt
Tao Ma [Thu, 29 Nov 2012 03:18:38 +0000 (14:18 +1100)]
checkpatch: remove reference to feature-removal-schedule.txt

In 9c0ece069, Linus removes feature-removal-schedule.txt from
Documentation, but there is still some reference to this file.  So remove
them.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Acked-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: warn about using CONFIG_EXPERIMENTAL
Kees Cook [Thu, 29 Nov 2012 03:18:38 +0000 (14:18 +1100)]
checkpatch: warn about using CONFIG_EXPERIMENTAL

This config item has not carried much meaning for a while now and is
almost always enabled by default.  As agreed during the Linux kernel
summit, it is being removed.  This will discourage future addition of
CONFIG_EXPERIMENTAL while it is being phased out.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocheckpatch: warn on unnecessary line continuations
Joe Perches [Thu, 29 Nov 2012 03:18:37 +0000 (14:18 +1100)]
checkpatch: warn on unnecessary line continuations

When the previous line is not a line continuation and the current line has
a line continuation but is not a #define, emit a warning.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Constantine Shulyupin <const@makelinux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers-firmware-dmi_scanc-fetch-dmi-version-from-smbios-if-it-exists-checkpatch...
Andrew Morton [Thu, 29 Nov 2012 03:18:37 +0000 (14:18 +1100)]
drivers-firmware-dmi_scanc-fetch-dmi-version-from-smbios-if-it-exists-checkpatch-fixes

WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
#56: FILE: drivers/firmware/dmi_scan.c:426:
+ printk(KERN_INFO "SMBIOS %d.%d present.\n",

WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
#61: FILE: drivers/firmware/dmi_scan.c:431:
+ printk(KERN_INFO "Legacy DMI %d.%d present.\n",

WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
#85: FILE: drivers/firmware/dmi_scan.c:455:
+ printk(KERN_DEBUG "SMBIOS version fixup(2.%d->2.%d)\n",

WARNING: Prefer pr_debug(... to printk(KERN_DEBUG, ...
#90: FILE: drivers/firmware/dmi_scan.c:460:
+ printk(KERN_DEBUG "SMBIOS version fixup(2.%d->2.%d)\n",

total: 0 errors, 4 warnings, 104 lines checked

./patches/drivers-firmware-dmi_scanc-fetch-dmi-version-from-smbios-if-it-exists.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: Feng Jin <joe.jin@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists
Zhenzhong Duan [Thu, 29 Nov 2012 03:18:37 +0000 (14:18 +1100)]
drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists

The right dmi version is in SMBIOS if it's zero in DMI region

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Feng Jin <joe.jin@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers-firmware-dmi_scanc-check-dmi-version-when-get-system-uuid-fix
Andrew Morton [Thu, 29 Nov 2012 03:18:37 +0000 (14:18 +1100)]
drivers-firmware-dmi_scanc-check-dmi-version-when-get-system-uuid-fix

tweak code comment

Cc: Feng Jin <joe.jin@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/firmware/dmi_scan.c: check dmi version when get system uuid
Zhenzhong Duan [Thu, 29 Nov 2012 03:18:36 +0000 (14:18 +1100)]
drivers/firmware/dmi_scan.c: check dmi version when get system uuid

As of version 2.6 of the SMBIOS specification, the first 3
fields of the UUID are supposed to be little-endian encoded.

Also a minor fix to match variable meaning and mute checkpatch.pl

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Feng Jin <joe.jin@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agocompat: generic compat_sys_sched_rr_get_interval() implementation
Catalin Marinas [Thu, 29 Nov 2012 03:18:36 +0000 (14:18 +1100)]
compat: generic compat_sys_sched_rr_get_interval() implementation

This function is used by sparc, powerpc tile and arm64 for compat support.
 The patch adds a generic implementation with a wrapper for PowerPC to do
the u32->int sign extension.

The reason for a single patch covering powerpc, tile, sparc and arm64 is
to keep it bisectable, otherwise kernel building may fail with mismatched
function declarations.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [for tile]
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agopercpu_rw_semaphore: introduce CONFIG_PERCPU_RWSEM
Oleg Nesterov [Thu, 29 Nov 2012 03:18:36 +0000 (14:18 +1100)]
percpu_rw_semaphore: introduce CONFIG_PERCPU_RWSEM

Currently only block_dev and uprobes use percpu_rw_semaphore,
add the config option selected by BLOCK || UPROBES.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agopercpu_rw_semaphore: add lockdep annotations
Oleg Nesterov [Thu, 29 Nov 2012 03:18:35 +0000 (14:18 +1100)]
percpu_rw_semaphore: add lockdep annotations

Add lockdep annotations.  Not only this can help to find the potential
problems, we do not want the false warnings if, say, the task takes two
different percpu_rw_semaphore's for reading.  IOW, at least ->rw_sem
should not use a single class.

This patch exposes this internal lock to lockdep so that it represents the
whole percpu_rw_semaphore.  This way we do not need to add another "fake"
->lockdep_map and lock_class_key.  More importantly, this also makes the
output from lockdep much more understandable if it finds the problem.

In short, with this patch from lockdep pov percpu_down_read() and
percpu_up_read() acquire/release ->rw_sem for reading, this matches the
actual semantics.  This abuses __up_read() but I hope this is fine and in
fact I'd like to have down_read_no_lockdep() as well,
percpu_down_read_recursive_readers() will need it.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agopercpu_rw_semaphore: kill ->writer_mutex, add ->write_ctr
Oleg Nesterov [Thu, 29 Nov 2012 03:18:35 +0000 (14:18 +1100)]
percpu_rw_semaphore: kill ->writer_mutex, add ->write_ctr

percpu_rw_semaphore->writer_mutex was only added to simplify the initial
rewrite, the only thing it protects is clear_fast_ctr() which otherwise
could be called by multiple writers.  ->rw_sem is enough to serialize the
writers.

Kill this mutex and add "atomic_t write_ctr" instead.  The writers
increment/decrement this counter, the readers check it is zero instead of
mutex_is_locked().

Move atomic_add(clear_fast_ctr(), slow_read_ctr) under down_write() to
avoid the race with other writers.  This is a bit sub-optimal, only the
first writer needs this and we do not need to exclude the readers at this
stage.  But this is simple, we do not want another internal lock until we
add more features.

And this speeds up the write-contended case.  Before this patch the racing
writers sleep in synchronize_sched() sequentially, with this patch
multiple synchronize_sched's can "overlap" with each other.  Note: we can
do more optimizations, this is only the first step.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agopercpu_rw_semaphore-reimplement-to-not-block-the-readers-unnecessari-lyfix
Oleg Nesterov [Thu, 29 Nov 2012 03:18:35 +0000 (14:18 +1100)]
percpu_rw_semaphore-reimplement-to-not-block-the-readers-unnecessari-lyfix

More include's and more comments, no changes in code.

To remind, once/if I am sure you agree with this patch I'll send 2 additional
and simple patches:

1. lockdep annotations

2. CONFIG_PERCPU_RWSEM

It seems that we can do much more improvements to a) speedup the writers and
b) make percpu_rw_semaphore more useful, but not right now.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agopercpu_rw_semaphore: reimplement to not block the readers unnecessarily
Oleg Nesterov [Thu, 29 Nov 2012 03:18:34 +0000 (14:18 +1100)]
percpu_rw_semaphore: reimplement to not block the readers unnecessarily

Currently the writer does msleep() plus synchronize_sched() 3 times to
acquire/release the semaphore, and during this time the readers are
blocked completely.  Even if the "write" section was not actually started
or if it was already finished.

With this patch down_write/up_write does synchronize_sched() twice and
down_read/up_read are still possible during this time, just they use the
slow path.

percpu_down_write() first forces the readers to use rw_semaphore and
increment the "slow" counter to take the lock for reading, then it
takes that rw_semaphore for writing and blocks the readers.

Also.  With this patch the code relies on the documented behaviour of
synchronize_sched(), it doesn't try to pair synchronize_sched() with
barrier.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agosscanf: don't ignore field widths for numeric conversions
Jan Beulich [Thu, 29 Nov 2012 03:18:34 +0000 (14:18 +1100)]
sscanf: don't ignore field widths for numeric conversions

This is another step towards better standard conformance.  Rather than
adding a local buffer to store the specified portion of the string (with
the need to enforce an arbitrary maximum supported width to limit the
buffer size), do a maximum width conversion and then drop as much of it as
is necessary to meet the caller's request.

Also fail on negative field widths.

Uses the deprecated simple_strto*() functions because kstrtoXX() fail on
non-zero terminated strings.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/of/fdt.c: re-use kernel's kbasename()
Andy Shevchenko [Thu, 29 Nov 2012 03:18:34 +0000 (14:18 +1100)]
drivers/of/fdt.c: re-use kernel's kbasename()

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agotrace: use kbasename()
Andy Shevchenko [Thu, 29 Nov 2012 03:18:33 +0000 (14:18 +1100)]
trace: use kbasename()

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoproc_devtree: remove duplicated include from proc_devtree.c
Wei Yongjun [Thu, 29 Nov 2012 03:18:33 +0000 (14:18 +1100)]
proc_devtree: remove duplicated include from proc_devtree.c

Remove duplicated include.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agoprocfs: use kbasename()
Andy Shevchenko [Thu, 29 Nov 2012 03:18:33 +0000 (14:18 +1100)]
procfs: use kbasename()

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agomm: use kbasename()
Andy Shevchenko [Thu, 29 Nov 2012 03:18:32 +0000 (14:18 +1100)]
mm: use kbasename()

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agolib: dynamic_debug: use kbasename()
Andy Shevchenko [Thu, 29 Nov 2012 03:18:32 +0000 (14:18 +1100)]
lib: dynamic_debug: use kbasename()

Remove the custom implementation of the functionality similar to kbasename().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jason Baron <jbaron@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agostring: introduce helper to get base file name from given path
Andy Shevchenko [Thu, 29 Nov 2012 03:18:32 +0000 (14:18 +1100)]
string: introduce helper to get base file name from given path

There are several places in the kernel that use functionality like
basename(3) with the exception: in case of '/foo/bar/' we expect to get an
empty string.  Let's do it common helper for them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/lms283gf05.c: use GPIOF_INIT flags when using devm_gpio_reque...
Jingoo Han [Thu, 29 Nov 2012 03:18:31 +0000 (14:18 +1100)]
drivers/video/backlight/lms283gf05.c: use GPIOF_INIT flags when using devm_gpio_request_one()

GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:
 GPIOF_DIR_OUT   (0 << 0)
 GPIOF_DIR_IN    (1 << 0)
So, when !pdata->reset_inverted is 1, the gpio pin can be set as
input, instead of output.

To prevent this problem, GPIOF_INIT flag should be used when using
devm_gpio_request_one().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/lcd.c: return ENXIO when ops functions cannot be called
Jingoo Han [Thu, 29 Nov 2012 03:18:31 +0000 (14:18 +1100)]
drivers/video/backlight/lcd.c: return ENXIO when ops functions cannot be called

Previously, when ops functions cannot be called, lcd_show_contrast() and
lcd_store_contrast() returned 0, instead of ENXIO.

Thus, in this case, a local variable 'rc' for return value should be
initialized as ENXIO, after kstrtoul() is called.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobacklight-88pm860x_bl-remove-an-unnecessary-line-continuation-fix
Andrew Morton [Thu, 29 Nov 2012 03:18:31 +0000 (14:18 +1100)]
backlight-88pm860x_bl-remove-an-unnecessary-line-continuation-fix

remove newline

Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobacklight: 88pm860x_bl: remove an unnecessary line continuation
Jingoo Han [Thu, 29 Nov 2012 03:18:31 +0000 (14:18 +1100)]
backlight: 88pm860x_bl: remove an unnecessary line continuation

Remove an unnecessary line continuation in pm860x_backlight_probe().
Also, a checkpatch warning is fixed as below:

WARNING: Avoid unnecessary line continuations

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/pandora_bl.c: change TWL4030_MODULE_PWM0 to TWL_MODULE_PWM
Peter Ujfalusi [Thu, 29 Nov 2012 03:18:30 +0000 (14:18 +1100)]
drivers/video/backlight/pandora_bl.c: change TWL4030_MODULE_PWM0 to TWL_MODULE_PWM

TWL_MODULE_PWM is defined as:
#define TWL_MODULE_PWM TWL4030_MODULE_PWM0

Use the common module ID define here which will facilitate the upcoming
twl-core cleanup.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobacklight-add-of_find_backlight_by_node-function-fix-2
Thierry Reding [Thu, 29 Nov 2012 03:18:30 +0000 (14:18 +1100)]
backlight-add-of_find_backlight_by_node-function-fix-2

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobacklight-add-of_find_backlight_by_node-function-fix
Andrew Morton [Thu, 29 Nov 2012 03:18:30 +0000 (14:18 +1100)]
backlight-add-of_find_backlight_by_node-function-fix

Don't use IS_ENABLED(CONFIG_OF)

Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agobacklight: add of_find_backlight_by_node()
Thierry Reding [Thu, 29 Nov 2012 03:18:29 +0000 (14:18 +1100)]
backlight: add of_find_backlight_by_node()

This function finds the struct backlight_device for a given device tree
node.  A dummy function is provided so that it safely compiles out if OF
support is disabled.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/ili9320.c: add missing __devexit macros for remove
Jingoo Han [Thu, 29 Nov 2012 03:18:29 +0000 (14:18 +1100)]
drivers/video/backlight/ili9320.c: add missing __devexit macros for remove

The __devexit macros is added to remove function.  The macros moves the
remove function to devexit sections.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/hp680_bl.c: add missing __devexit macros for remove
Jingoo Han [Thu, 29 Nov 2012 03:18:29 +0000 (14:18 +1100)]
drivers/video/backlight/hp680_bl.c: add missing __devexit macros for remove

The __devexit macros is added to remove function.  The macro moves the
remove function to devexit section.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/ep93xx_bl.c: fix section mismatch
Jingoo Han [Thu, 29 Nov 2012 03:18:28 +0000 (14:18 +1100)]
drivers/video/backlight/ep93xx_bl.c: fix section mismatch

Fix section mismatch warning as below:

WARNING: drivers/video/backlight/built-in.o(.data+0x110): Section mismatch in reference from the variable ep93xxbl_driver to the
function .init.text:ep93xxbl_probe()
The variable ep93xxbl_driver references
the function __init ep93xxbl_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/lm3639_bl.c: fix up world writable sysfs file
Axel Lin [Thu, 29 Nov 2012 03:18:28 +0000 (14:18 +1100)]
drivers/video/backlight/lm3639_bl.c: fix up world writable sysfs file

We don't need the sysfs file to be world writable or group writable.
This file is write-only, change it to S_IWUSR (0200).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: "G.Shark Jeong" <gshark.jeong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
11 years agodrivers/video/backlight/max8925_bl.c: drop devm_kfree of devm_kzalloc'd data
Jingoo Han [Thu, 29 Nov 2012 03:18:28 +0000 (14:18 +1100)]
drivers/video/backlight/max8925_bl.c: drop devm_kfree of devm_kzalloc'd data

devm_kfree() allocates memory that is released when a driver detaches.
Thus, there is no reason to explicitly call devm_kfree in probe or remove
functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>