1. 11 8月, 2010 2 次提交
    • R
      param: add a free hook to kernel_param_ops. · e6df34a4
      Rusty Russell 提交于
      This allows us to generalize the KPARAM_KMALLOCED flag, by calling a function
      on every parameter when a module is unloaded.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Tested-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
      e6df34a4
    • R
      param: use ops in struct kernel_param, rather than get and set fns directly · 9bbb9e5a
      Rusty Russell 提交于
      This is more kernel-ish, saves some space, and also allows us to
      expand the ops without breaking all the callers who are happy for the
      new members to be NULL.
      
      The few places which defined their own param types are changed to the
      new scheme (more which crept in recently fixed in following patches).
      
      Since we're touching them anyway, we change get() and set() to take a
      const struct kernel_param (which they really are).  This causes some
      harmless warnings until we fix them (in following patches).
      
      To reduce churn, module_param_call creates the ops struct so the callers
      don't have to change (and casts the functions to reduce warnings).
      The modern version which takes an ops struct is called module_param_cb.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Tested-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ville Syrjala <syrjala@sci.fi>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Alessandro Rubini <rubini@ipvvis.unipv.it>
      Cc: Michal Januszewski <spock@gentoo.org>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-input@vger.kernel.org
      Cc: linux-fbdev-devel@lists.sourceforge.net
      Cc: linux-nfs@vger.kernel.org
      Cc: netdev@vger.kernel.org
      9bbb9e5a
  2. 29 10月, 2009 1 次提交
    • R
      param: fix lots of bugs with writing charp params from sysfs, by leaking mem. · 65afac7d
      Rusty Russell 提交于
      e180a6b7 "param: fix charp parameters set via sysfs" fixed the case
      where charp parameters written via sysfs were freed, leaving drivers
      accessing random memory.
      
      Unfortunately, storing a flag in the kparam struct was a bad idea: it's
      rodata so setting it causes an oops on some archs.  But that's not all:
      
      1) module_param_array() on charp doesn't work reliably, since we use an
         uninitialized temporary struct kernel_param.
      2) there's a fundamental race if a module uses this parameter and then
         it's changed: they will still access the old, freed, memory.
      
      The simplest fix (ie. for 2.6.32) is to never free the memory.  This
      prevents all these problems, at cost of a memory leak.  In practice, there
      are only 18 places where a charp is writable via sysfs, and all are
      root-only writable.
      Reported-by: NTakashi Iwai <tiwai@suse.de>
      Cc: Sitsofe Wheeler <sitsofe@yahoo.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Christof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: stable@kernel.org
      65afac7d
  3. 12 6月, 2009 3 次提交
  4. 31 3月, 2009 1 次提交
  5. 22 10月, 2008 2 次提交
    • R
      core_param() for genuinely core kernel parameters · 67e67cea
      Rusty Russell 提交于
      There are a lot of one-liner uses of __setup() in the kernel: they're
      cumbersome and not queryable (definitely not settable) via /sys.  Yet
      it's ugly to simplify them to module_param(), because by default that
      inserts a prefix of the module name (usually filename).
      
      So, introduce a "core_param".  The parameter gets no prefix, but
      appears in /sys/module/kernel/parameters/ (if non-zero perms arg).  I
      thought about using the name "core", but that's more common than
      "kernel".  And if you create a module called "kernel", you will die
      a horrible death.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      67e67cea
    • R
      module: check kernel param length at compile time, not runtime · 730b69d2
      Rusty Russell 提交于
      The kparam code tries to handle over-length parameter prefixes at
      runtime.  Not only would I bet this has never been tested, it's not
      clear that truncating names is a good idea either.
      
      So let's check at compile time.  We need to move the #define to
      moduleparam.h to do this, though.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      730b69d2
  6. 14 2月, 2008 1 次提交
  7. 29 1月, 2008 1 次提交
  8. 17 10月, 2007 1 次提交
  9. 18 2月, 2007 1 次提交
  10. 17 2月, 2007 1 次提交
  11. 08 12月, 2006 1 次提交
    • A
      [PATCH] Compile-time check re world-writeable module params · 9774a1f5
      Alexey Dobriyan 提交于
      One of the mistakes a module_param() user can make is to supply default
      value of module parameter as the last argument.  module_param() accepts
      permissions instead.  If default value is, say, 3 (-------wx), parameter
      becomes world-writeable.
      
      So far, the only remedy was to apply grep(1) and read drivers submitted
      to -mm. BTDT.
      
      With this patch applied, compiler will finally do some job.
      
      *) bounds checking on permissions
      *) world-writeable bit checking on permissions
      *) compile breakage if checks trigger
      
      First version of this check (only "& 2" part) directly caught 4 out of 7
      places during my last grep.
      
          Subject: Neverending module_param() bugs
          [X] drivers/acpi/sbs.c:101:module_param(capacity_mode, int, CAPACITY_UNIT);
          [X] drivers/acpi/sbs.c:102:module_param(update_mode, int, UPDATE_MODE);
          [ ] drivers/acpi/sbs.c:103:module_param(update_info_mode, int, UPDATE_INFO_MODE);
          [ ] drivers/acpi/sbs.c:104:module_param(update_time, int, UPDATE_TIME);
          [ ] drivers/acpi/sbs.c:105:module_param(update_time2, int, UPDATE_TIME2);
          [X] drivers/char/watchdog/sbc8360.c:203:module_param(timeout, int, 27);
          [X] drivers/media/video/tuner-simple.c:13:module_param(offset, int, 0666);
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9774a1f5
  12. 26 3月, 2006 1 次提交
  13. 07 1月, 2006 1 次提交
    • S
      kbuild: un-stringnify KBUILD_MODNAME · 367cb704
      Sam Ravnborg 提交于
      Now when kbuild passes KBUILD_MODNAME with "" do not __stringify it when
      used. Remove __stringnify for all users.
      This also fixes the output of:
      
      $ ls -l /sys/module/
      drwxr-xr-x 4 root root 0 2006-01-05 14:24 pcmcia
      drwxr-xr-x 4 root root 0 2006-01-05 14:24 pcmcia_core
      drwxr-xr-x 3 root root 0 2006-01-05 14:24 "processor"
      drwxr-xr-x 3 root root 0 2006-01-05 14:24 "psmouse"
      
      The quoting of the module names will be gone again.
      Thanks to GregKH + Kay Sievers for reproting this.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      367cb704
  14. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4