1. 25 2月, 2012 1 次提交
    • M
      sysfs: Fix memory leak in sysfs_sd_setsecdata(). · 93518dd2
      Masami Ichikawa 提交于
      This patch fixies follwing two memory leak patterns that reported by kmemleak.
      sysfs_sd_setsecdata() is called during sys_lsetxattr() operation.
      It checks sd->s_iattr is NULL or not. Then if it is NULL, it calls
      sysfs_init_inode_attrs() to allocate memory.
      That code is this.
      
      iattrs = sd->s_iattr;
      if (!iattrs)
                      iattrs = sysfs_init_inode_attrs(sd);
      
      The iattrs recieves sysfs_init_inode_attrs()'s result,  but sd->s_iattr
      doesn't know the address. so it needs to set correct address to
      sd->s_iattr to free memory in other function.
      
      unreferenced object 0xffff880250b73e60 (size 32):
        comm "systemd", pid 1, jiffies 4294683888 (age 94.553s)
        hex dump (first 32 bytes):
          73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f  system_u:object_
          72 3a 73 79 73 66 73 5f 74 3a 73 30 00 00 00 00  r:sysfs_t:s0....
        backtrace:
          [<ffffffff814cb1d0>] kmemleak_alloc+0x73/0x98
          [<ffffffff811270ab>] __kmalloc+0x100/0x12c
          [<ffffffff8120775a>] context_struct_to_string+0x106/0x210
          [<ffffffff81207cc1>] security_sid_to_context_core+0x10b/0x129
          [<ffffffff812090ef>] security_sid_to_context+0x10/0x12
          [<ffffffff811fb0da>] selinux_inode_getsecurity+0x7d/0xa8
          [<ffffffff811fb127>] selinux_inode_getsecctx+0x22/0x2e
          [<ffffffff811f4d62>] security_inode_getsecctx+0x16/0x18
          [<ffffffff81191dad>] sysfs_setxattr+0x96/0x117
          [<ffffffff811542f0>] __vfs_setxattr_noperm+0x73/0xd9
          [<ffffffff811543d9>] vfs_setxattr+0x83/0xa1
          [<ffffffff811544c6>] setxattr+0xcf/0x101
          [<ffffffff81154745>] sys_lsetxattr+0x6a/0x8f
          [<ffffffff814efda9>] system_call_fastpath+0x16/0x1b
          [<ffffffffffffffff>] 0xffffffffffffffff
      unreferenced object 0xffff88024163c5a0 (size 96):
        comm "systemd", pid 1, jiffies 4294683888 (age 94.553s)
        hex dump (first 32 bytes):
          00 00 00 00 ed 41 00 00 00 00 00 00 00 00 00 00  .....A..........
          00 00 00 00 00 00 00 00 0c 64 42 4f 00 00 00 00  .........dBO....
        backtrace:
          [<ffffffff814cb1d0>] kmemleak_alloc+0x73/0x98
          [<ffffffff81127402>] kmem_cache_alloc_trace+0xc4/0xee
          [<ffffffff81191cbe>] sysfs_init_inode_attrs+0x2a/0x83
          [<ffffffff81191dd6>] sysfs_setxattr+0xbf/0x117
          [<ffffffff811542f0>] __vfs_setxattr_noperm+0x73/0xd9
          [<ffffffff811543d9>] vfs_setxattr+0x83/0xa1
          [<ffffffff811544c6>] setxattr+0xcf/0x101
          [<ffffffff81154745>] sys_lsetxattr+0x6a/0x8f
          [<ffffffff814efda9>] system_call_fastpath+0x16/0x1b
          [<ffffffffffffffff>] 0xffffffffffffffff
      `
      Signed-off-by: NMasami Ichikawa <masami256@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93518dd2
  2. 01 2月, 2012 1 次提交
  3. 25 1月, 2012 6 次提交
  4. 04 1月, 2012 3 次提交
  5. 02 11月, 2011 2 次提交
  6. 25 10月, 2011 1 次提交
  7. 20 10月, 2011 3 次提交
  8. 27 9月, 2011 1 次提交
  9. 23 8月, 2011 4 次提交
  10. 20 7月, 2011 3 次提交
  11. 13 6月, 2011 1 次提交
    • A
      Delay struct net freeing while there's a sysfs instance refering to it · a685e089
      Al Viro 提交于
      	* new refcount in struct net, controlling actual freeing of the memory
      	* new method in kobj_ns_type_operations (->drop_ns())
      	* ->current_ns() semantics change - it's supposed to be followed by
      corresponding ->drop_ns().  For struct net in case of CONFIG_NET_NS it bumps
      the new refcount; net_drop_ns() decrements it and calls net_free() if the
      last reference has been dropped.  Method renamed to ->grab_current_ns().
      	* old net_free() callers call net_drop_ns() instead.
      	* sysfs_exit_ns() is gone, along with a large part of callchain
      leading to it; now that the references stored in ->ns[...] stay valid we
      do not need to hunt them down and replace them with NULL.  That fixes
      problems in sysfs_lookup() and sysfs_readdir(), along with getting rid
      of sb->s_instances abuse.
      
      	Note that struct net *shutdown* logics has not changed - net_cleanup()
      is called exactly when it used to be called.  The only thing postponed by
      having a sysfs instance refering to that struct net is actual freeing of
      memory occupied by struct net.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a685e089
  12. 14 5月, 2011 1 次提交
  13. 11 5月, 2011 1 次提交
  14. 21 1月, 2011 1 次提交
    • D
      kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT · 6a108a14
      David Rientjes 提交于
      The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
      is used to configure any non-standard kernel with a much larger scope than
      only small devices.
      
      This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
      references to the option throughout the kernel.  A new CONFIG_EMBEDDED
      option is added that automatically selects CONFIG_EXPERT when enabled and
      can be used in the future to isolate options that should only be
      considered for embedded systems (RISC architectures, SLOB, etc).
      
      Calling the option "EXPERT" more accurately represents its intention: only
      expert users who understand the impact of the configuration changes they
      are making should enable it.
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NDavid Woodhouse <david.woodhouse@intel.com>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Robin Holt <holt@sgi.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6a108a14
  15. 11 1月, 2011 1 次提交
  16. 07 1月, 2011 4 次提交
    • N
      fs: provide rcu-walk aware permission i_ops · b74c79e9
      Nick Piggin 提交于
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      b74c79e9
    • N
      fs: rcu-walk aware d_revalidate method · 34286d66
      Nick Piggin 提交于
      Require filesystems be aware of .d_revalidate being called in rcu-walk
      mode (nd->flags & LOOKUP_RCU). For now do a simple push down, returning
      -ECHILD from all implementations.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      34286d66
    • N
      fs: dcache reduce branches in lookup path · fb045adb
      Nick Piggin 提交于
      Reduce some branches and memory accesses in dcache lookup by adding dentry
      flags to indicate common d_ops are set, rather than having to check them.
      This saves a pointer memory access (dentry->d_op) in common path lookup
      situations, and saves another pointer load and branch in cases where we
      have d_op but not the particular operation.
      
      Patched with:
      
      git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fb045adb
    • N
      fs: change d_delete semantics · fe15ce44
      Nick Piggin 提交于
      Change d_delete from a dentry deletion notification to a dentry caching
      advise, more like ->drop_inode. Require it to be constant and idempotent,
      and not take d_lock. This is how all existing filesystems use the callback
      anyway.
      
      This makes fine grained dentry locking of dput and dentry lru scanning
      much simpler.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fe15ce44
  17. 30 11月, 2010 1 次提交
  18. 29 10月, 2010 1 次提交
  19. 23 10月, 2010 2 次提交
  20. 17 10月, 2010 1 次提交
  21. 04 9月, 2010 1 次提交