1. 04 12月, 2013 1 次提交
  2. 29 9月, 2013 1 次提交
  3. 13 9月, 2013 1 次提交
  4. 03 9月, 2013 1 次提交
    • L
      module: Fix mod->mkobj.kobj potentially freed too early · 942e4431
      Li Zhong 提交于
      DEBUG_KOBJECT_RELEASE helps to find the issue attached below.
      
      After some investigation, it seems the reason is:
      The mod->mkobj.kobj(ffffffffa01600d0 below) is freed together with mod
      itself in free_module(). However, its children still hold references to
      it, as the delay caused by DEBUG_KOBJECT_RELEASE. So when the
      child(holders below) tries to decrease the reference count to its parent
      in kobject_del(), BUG happens as it tries to access already freed memory.
      
      This patch tries to fix it by waiting for the mod->mkobj.kobj to be
      really released in the module removing process (and some error code
      paths).
      
      [ 1844.175287] kobject: 'holders' (ffff88007c1f1600): kobject_release, parent ffffffffa01600d0 (delayed)
      [ 1844.178991] kobject: 'notes' (ffff8800370b2a00): kobject_release, parent ffffffffa01600d0 (delayed)
      [ 1845.180118] kobject: 'holders' (ffff88007c1f1600): kobject_cleanup, parent ffffffffa01600d0
      [ 1845.182130] kobject: 'holders' (ffff88007c1f1600): auto cleanup kobject_del
      [ 1845.184120] BUG: unable to handle kernel paging request at ffffffffa01601d0
      [ 1845.185026] IP: [<ffffffff812cda81>] kobject_put+0x11/0x60
      [ 1845.185026] PGD 1a13067 PUD 1a14063 PMD 7bd30067 PTE 0
      [ 1845.185026] Oops: 0000 [#1] PREEMPT
      [ 1845.185026] Modules linked in: xfs libcrc32c [last unloaded: kprobe_example]
      [ 1845.185026] CPU: 0 PID: 18 Comm: kworker/0:1 Tainted: G           O 3.11.0-rc6-next-20130819+ #1
      [ 1845.185026] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
      [ 1845.185026] Workqueue: events kobject_delayed_cleanup
      [ 1845.185026] task: ffff88007ca51f00 ti: ffff88007ca5c000 task.ti: ffff88007ca5c000
      [ 1845.185026] RIP: 0010:[<ffffffff812cda81>]  [<ffffffff812cda81>] kobject_put+0x11/0x60
      [ 1845.185026] RSP: 0018:ffff88007ca5dd08  EFLAGS: 00010282
      [ 1845.185026] RAX: 0000000000002000 RBX: ffffffffa01600d0 RCX: ffffffff8177d638
      [ 1845.185026] RDX: ffff88007ca5dc18 RSI: 0000000000000000 RDI: ffffffffa01600d0
      [ 1845.185026] RBP: ffff88007ca5dd18 R08: ffffffff824e9810 R09: ffffffffffffffff
      [ 1845.185026] R10: ffff8800ffffffff R11: dead4ead00000001 R12: ffffffff81a95040
      [ 1845.185026] R13: ffff88007b27a960 R14: ffff88007c1f1600 R15: 0000000000000000
      [ 1845.185026] FS:  0000000000000000(0000) GS:ffffffff81a23000(0000) knlGS:0000000000000000
      [ 1845.185026] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 1845.185026] CR2: ffffffffa01601d0 CR3: 0000000037207000 CR4: 00000000000006b0
      [ 1845.185026] Stack:
      [ 1845.185026]  ffff88007c1f1600 ffff88007c1f1600 ffff88007ca5dd38 ffffffff812cdb7e
      [ 1845.185026]  0000000000000000 ffff88007c1f1640 ffff88007ca5dd68 ffffffff812cdbfe
      [ 1845.185026]  ffff88007c974800 ffff88007c1f1640 ffff88007ff61a00 0000000000000000
      [ 1845.185026] Call Trace:
      [ 1845.185026]  [<ffffffff812cdb7e>] kobject_del+0x2e/0x40
      [ 1845.185026]  [<ffffffff812cdbfe>] kobject_delayed_cleanup+0x6e/0x1d0
      [ 1845.185026]  [<ffffffff81063a45>] process_one_work+0x1e5/0x670
      [ 1845.185026]  [<ffffffff810639e3>] ? process_one_work+0x183/0x670
      [ 1845.185026]  [<ffffffff810642b3>] worker_thread+0x113/0x370
      [ 1845.185026]  [<ffffffff810641a0>] ? rescuer_thread+0x290/0x290
      [ 1845.185026]  [<ffffffff8106bfba>] kthread+0xda/0xe0
      [ 1845.185026]  [<ffffffff814ff0f0>] ? _raw_spin_unlock_irq+0x30/0x60
      [ 1845.185026]  [<ffffffff8106bee0>] ? kthread_create_on_node+0x130/0x130
      [ 1845.185026]  [<ffffffff8150751a>] ret_from_fork+0x7a/0xb0
      [ 1845.185026]  [<ffffffff8106bee0>] ? kthread_create_on_node+0x130/0x130
      [ 1845.185026] Code: 81 48 c7 c7 28 95 ad 81 31 c0 e8 9b da 01 00 e9 4f ff ff ff 66 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb 48 83 ec 08 48 85 ff 74 1d <f6> 87 00 01 00 00 01 74 1e 48 8d 7b 38 83 6b 38 01 0f 94 c0 84
      [ 1845.185026] RIP  [<ffffffff812cda81>] kobject_put+0x11/0x60
      [ 1845.185026]  RSP <ffff88007ca5dd08>
      [ 1845.185026] CR2: ffffffffa01601d0
      [ 1845.185026] ---[ end trace 49a70afd109f5653 ]---
      Signed-off-by: NLi Zhong <zhong@linux.vnet.ibm.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      942e4431
  5. 20 8月, 2013 3 次提交
    • C
      kernel/params.c: use scnprintf() instead of sprintf() · f4940ab7
      Chen Gang 提交于
      For some strings (e.g. version string), they are permitted to be larger
      than PAGE_SIZE (although meaningless), so recommend to use scnprintf()
      instead of sprintf().
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      f4940ab7
    • S
      module: Add flag to allow mod params to have no arguments · ab013c5f
      Steven Rostedt 提交于
      Currently the params.c code allows only two "set" functions to have
      no arguments. If a parameter does not have an argument, then it
      looks at the set function and tests if it is either param_set_bool()
      or param_set_bint(). If it is not one of these functions, then it
      fails the loading of the module.
      
      But there may be module parameters that have different set functions
      and still allow no arguments. But unless each of these cases adds
      their function to the if statement, it wont be allowed to have no
      arguments. This method gets rather messing and does not scale.
      
      Instead, introduce a flags field to the kernel_param_ops, where if
      the flag KERNEL_PARAM_FL_NOARG is set, the parameter will not fail
      if it does not contain an argument. It will be expected that the
      corresponding set function can handle a NULL pointer as "val".
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      ab013c5f
    • C
      module: fix sprintf format specifier in param_get_byte() · 79ac6834
      Christoph Jaeger 提交于
      In param_get_byte(), to which the macro STANDARD_PARAM_DEF(byte, ...) expands,
      "%c" is used to print an unsigned char. So it gets printed as a character what
      is not intended here. Use "%hhu" instead.
      
      [Rusty: note drivers which would be effected:
       drivers/net/wireless/cw1200/main.c
       drivers/ntb/ntb_transport.c:68
       drivers/scsi/lpfc/lpfc_attr.c
       drivers/usb/atm/speedtch.c
       drivers/usb/gadget/g_ffs.c
      ]
      
      Acked-by: Jon Mason <jon.mason@intel.com> (for ntb)
      Acked-by: Michal Nazarewicz <mina86@mina86.com> (for g_ffs.c)
      Signed-off-by: NChristoph Jaeger <christophjaeger@linux.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      79ac6834
  6. 02 7月, 2013 1 次提交
  7. 18 3月, 2013 1 次提交
  8. 05 5月, 2012 2 次提交
  9. 01 5月, 2012 1 次提交
    • J
      params: add 3rd arg to option handler callback signature · 9fb48c74
      Jim Cromie 提交于
      Add a 3rd arg, named "doing", to unknown-options callbacks invoked
      from parse_args(). The arg is passed as:
      
        "Booting kernel" from start_kernel(),
        initcall_level_names[i] from do_initcall_level(),
        mod->name from load_module(), via parse_args(), parse_one()
      
      parse_args() already has the "name" parameter, which is renamed to
      "doing" to better reflect current uses 1,2 above.  parse_args() passes
      it to an altered parse_one(), which now passes it down into the
      unknown option handler callbacks.
      
      The mod->name will be needed to handle dyndbg for loadable modules,
      since params passed by modprobe are not qualified (they do not have a
      "$modname." prefix), and by the time the unknown-param callback is
      called, the module name is not otherwise available.
      
      Minor tweaks:
      
      Add param-name to parse_one's pr_debug(), current message doesnt
      identify the param being handled, add it.
      
      Add a pr_info to print current level and level_name of the initcall,
      and number of registered initcalls at that level.  This adds 7 lines
      to dmesg output, like:
      
         initlevel:6=device, 172 registered initcalls
      
      Drop "parameters" from initcall_level_names[], its unhelpful in the
      pr_info() added above.  This array is passed into parse_args() by
      do_initcall_level().
      
      CC: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Acked-by: NJason Baron <jbaron@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fb48c74
  10. 26 3月, 2012 2 次提交
  11. 29 2月, 2012 1 次提交
  12. 14 2月, 2012 1 次提交
  13. 13 1月, 2012 2 次提交
    • R
      module_param: avoid bool abuse, add bint for special cases. · 69116f27
      Rusty Russell 提交于
      For historical reasons, we allow module_param(bool) to take an int (or
      an unsigned int).  That's going away.
      
      A few drivers really want an int: they set it to -1 and a parameter
      will set it to 0 or 1.  This sucks: reading them from sysfs will give
      'Y' for both -1 and 1, but if we change it to an int, then the users
      might be broken (if they did "param" instead of "param=1").
      
      Use a new 'bint' parser for them.
      
      (ntfs has a different problem: it needs an int for debug_msgs because
      it's also exposed via sysctl.)
      
      Cc: Steve Glendinning <steve.glendinning@smsc.com>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Guenter Roeck <guenter.roeck@ericsson.com>
      Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
      Cc: Christoph Raisch <raisch@de.ibm.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Cc: linux390@de.ibm.com
      Cc: Anton Altaparmakov <anton@tuxera.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: lm-sensors@lm-sensors.org
      Cc: linux-rdma@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: alsa-devel@alsa-project.org
      Acked-by: Takashi Iwai <tiwai@suse.de> (For the sound part)
      Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> (For the hwmon driver)
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      69116f27
    • J
      kernel/params: replace DEBUGP with pr_debug · 8487bfd9
      Jim Cromie 提交于
      Use more flexible pr_debug.  This allows:
      
        echo "module params +p" > /dbg/dynamic_debug/control
      
      to turn on debug messages when needed.
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      8487bfd9
  14. 31 10月, 2011 1 次提交
    • P
      kernel: params.c needs module.h not moduleparam.h · 72a59aaa
      Paul Gortmaker 提交于
      Through various other implicit include paths, some files were
      getting the full module.h file, and hence living the illusion
      that they really only needed moduleparam.h -- but the reality
      is that once you remove the module.h presence, these show up:
      
      kernel/params.c:583: warning: ‘struct module_kobject’ declared inside parameter list
      
      Such files really require module.h so simply make it so.  As the
      file module.h grabs moduleparam.h on the fly, all will be well.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      72a59aaa
  15. 26 10月, 2011 1 次提交
  16. 24 7月, 2011 3 次提交
  17. 19 5月, 2011 2 次提交
  18. 26 4月, 2011 1 次提交
  19. 31 3月, 2011 1 次提交
  20. 24 1月, 2011 1 次提交
    • D
      module: show version information for built-in modules in sysfs · e94965ed
      Dmitry Torokhov 提交于
      Currently only drivers that are built as modules have their versions
      shown in /sys/module/<module_name>/version, but this information might
      also be useful for built-in drivers as well. This especially important
      for drivers that do not define any parameters - such drivers, if
      built-in, are completely invisible from userspace.
      
      This patch changes MODULE_VERSION() macro so that in case when we are
      compiling built-in module, version information is stored in a separate
      section. Kernel then uses this data to create 'version' sysfs attribute
      in the same fashion it creates attributes for module parameters.
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      e94965ed
  21. 11 8月, 2010 7 次提交
  22. 08 3月, 2010 3 次提交
  23. 07 3月, 2010 1 次提交
  24. 05 2月, 2010 1 次提交