modpost: Fix resource leak in read_dump()

Function read_dump() memory maps the input via grab_file(), but fails to call
the corresponding unmap function. Add the missing call to release_file().
Detected by Coverity: CID 1192419

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
param: hand arguments after -- straight to init

The kernel passes any args it doesn't need through to init, except it
assumes anything containing '.' belongs to the kernel (for a module).
This change means all users can clearly distinguish which arguments
are for init.

For example, the kernel uses debug ("dee-bug") to mean log everything to
the console, where systemd uses the debug from the Scandinavian "day-boog"
meaning "fail to boot".  If a future versions uses argv[] instead of
reading /proc/cmdline, this confusion will be avoided.

eg: test 'FOO="this is --foo"' -- 'systemd.debug="true true true"'

Gives:
argv[0] = '/debug-init'
argv[1] = 'test'
argv[2] = 'systemd.debug=true true true'
envp[0] = 'HOME=/'
envp[1] = 'TERM=linux'
envp[2] = 'FOO=this is --foo'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Documentation: Update kernel-parameters.tx

1) __setup() is messy, prefer module_param and core_param.
2) Document --
3) Document modprobe scraping /proc/cmdline.
4) Document handing of leftover parameters to init.
5) Document use of quotes to protect whitespace.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cpumask.h: silence warning with -Wsign-compare

Silence the warning when building with -Wsign-compare when cpumask.h
is included:

include/linux/cpumask.h: In function ‘cpumask_parse’:
include/linux/cpumask.h:603:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
  int len = nl ? nl - buf : strlen(buf);
                          ^

V2: Rusty pointed out that unsigned should be used instead.

Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
speakup: fix incorrect perms on speakup_acntsa.c

22c9bcad859d5c969289b3b37084a96c621f8f2c contained a bad
substitution for ROOT_W => S_IRUSR|S_IRUGO instead of
S_IWUSR|S_IRUGO.

Fixes: 22c9bcad859d5c969289b3b37084a96c621f8f2c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Vincent Sanders <vince@simtec.co.uk>
Cc: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Simon Wood <simon@mungewell.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Lindar Liu <lindar_liu@usish.com>
Cc: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/regulator/virtual: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/staging/speakup/: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Christopher Brannon <chris@the-brannons.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Bruno Prémont <bonbons@linux-vserver.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
samples/kobject/: avoid world-writable sysfs files.

In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
module: set nx before marking module MODULE_STATE_COMING.

We currently set RO & NX on modules very late: after we move them from
MODULE_STATE_UNFORMED to MODULE_STATE_COMING, and after we call
parse_args() (which can exec code in the module).

Much better is to do it in complete_formation() and then call
the notifier.

This means that the notifiers will be called on a module which
is already RO & NX, so that may cause problems (ftrace already
changed so they're unaffected).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module updates from Rusty Russell:
 "Most of this is cleaning up various driver sysfs permissions so we can
  re-add the perm check (we unified the module param and sysfs checks,
  but the module ones were stronger so we weakened them temporarily).

  Param parsing gets documented, and also "--" now forces args to be
  handed to init (and ignored by the kernel).

  Module NX/RO protections get tightened: we now set them before calling
  parse_args()"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: set nx before marking module MODULE_STATE_COMING.
  samples/kobject/: avoid world-writable sysfs files.
  drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.
  drivers/staging/speakup/: avoid world-writable sysfs files.
  drivers/regulator/virtual: avoid world-writable sysfs files.
  drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.
  drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.
  drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.
  drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.
  speakup: fix incorrect perms on speakup_acntsa.c
  cpumask.h: silence warning with -Wsign-compare
  Documentation: Update kernel-parameters.tx
  param: hand arguments after -- straight to init
  modpost: Fix resource leak in read_dump()