1. 21 Dec, 2011 10 commits
    • Linus Torvalds's avatar
      Make TASKSTATS require root access · 6824291b
      Linus Torvalds authored
      commit 1a51410a upstream.
      
      Ok, this isn't optimal, since it means that 'iotop' needs admin
      capabilities, and we may have to work on this some more.  But at the
      same time it is very much not acceptable to let anybody just read
      anybody elses IO statistics quite at this level.
      
      Use of the GENL_ADMIN_PERM suggested by Johannes Berg as an alternative
      to checking the capabilities by hand.
      Reported-by: default avatarVasiliy Kulikov <segoon@openwall.com>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Acked-by: default avatarBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6824291b
    • Eryu Guan's avatar
      jbd/jbd2: validate sb->s_first in journal_get_superblock() · 90384625
      Eryu Guan authored
      commit 8762202d upstream.
      
      I hit a J_ASSERT(blocknr != 0) failure in cleanup_journal_tail() when
      mounting a fsfuzzed ext3 image. It turns out that the corrupted ext3
      image has s_first = 0 in journal superblock, and the 0 is passed to
      journal->j_head in journal_reset(), then to blocknr in
      cleanup_journal_tail(), in the end the J_ASSERT failed.
      
      So validate s_first after reading journal superblock from disk in
      journal_get_superblock() to ensure s_first is valid.
      
      The following script could reproduce it:
      
      fstype=ext3
      blocksize=1024
      img=$fstype.img
      offset=0
      found=0
      magic="c0 3b 39 98"
      
      dd if=/dev/zero of=$img bs=1M count=8
      mkfs -t $fstype -b $blocksize -F $img
      filesize=`stat -c %s $img`
      while [ $offset -lt $filesize ]
      do
              if od -j $offset -N 4 -t x1 $img | grep -i "$magic";then
                      echo "Found journal: $offset"
                      found=1
                      break
              fi
              offset=`echo "$offset+$blocksize" | bc`
      done
      
      if [ $found -ne 1 ];then
              echo "Magic \"$magic\" not found"
              exit 1
      fi
      
      dd if=/dev/zero of=$img seek=$(($offset+23)) conv=notrunc bs=1 count=1
      
      mkdir -p ./mnt
      mount -o loop $img ./mnt
      
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: default avatarEryu Guan <guaneryu@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      90384625
    • Linus Torvalds's avatar
      linux/log2.h: Fix rounddown_pow_of_two(1) · 2b8efc69
      Linus Torvalds authored
      commit 13c07b02 upstream.
      
      Exactly like roundup_pow_of_two(1), the rounddown version was buggy for
      the case of a compile-time constant '1' argument.  Probably because it
      originated from the same code, sharing history with the roundup version
      from before the bugfix (for that one, see commit 1a06a52e: "Fix
      roundup_pow_of_two(1)").
      
      However, unlike the roundup version, the fix for rounddown is to just
      remove the broken special case entirely.  It's simply not needed - the
      generic code
      
          1UL << ilog2(n)
      
      does the right thing for the constant '1' argment too.  The only reason
      roundup needed that special case was because rounding up does so by
      subtracting one from the argument (and then adding one to the result)
      causing the obvious problems with "ilog2(0)".
      
      But rounddown doesn't do any of that, since ilog2() naturally truncates
      (ie "rounds down") to the right rounded down value.  And without the
      ilog2(0) case, there's no reason for the special case that had the wrong
      value.
      
      tl;dr: rounddown_pow_of_two(1) should be 1, not 0.
      Acked-by: default avatarDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2b8efc69
    • Tushar Gohad's avatar
      xfrm: Fix key lengths for rfc3686(ctr(aes)) · 57cc6e02
      Tushar Gohad authored
      commit 4203223a upstream.
      
      Fix the min and max bit lengths for AES-CTR (RFC3686) keys.
      The number of bits in key spec is the key length (128/256)
      plus 32 bits of nonce.
      
      This change takes care of the "Invalid key length" errors
      reported by setkey when specifying 288 bit keys for aes-ctr.
      Signed-off-by: default avatarTushar Gohad <tgohad@mvista.com>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarCalvin Owens <jcalvinowens@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      57cc6e02
    • Tejun Heo's avatar
      percpu: fix chunk range calculation · f9da6299
      Tejun Heo authored
      commit a855b84c upstream.
      
      Percpu allocator recorded the cpus which map to the first and last
      units in pcpu_first/last_unit_cpu respectively and used them to
      determine the address range of a chunk - e.g. it assumed that the
      first unit has the lowest address in a chunk while the last unit has
      the highest address.
      
      This simply isn't true.  Groups in a chunk can have arbitrary positive
      or negative offsets from the previous one and there is no guarantee
      that the first unit occupies the lowest offset while the last one the
      highest.
      
      Fix it by actually comparing unit offsets to determine cpus occupying
      the lowest and highest offsets.  Also, rename pcu_first/last_unit_cpu
      to pcpu_low/high_unit_cpu to avoid confusion.
      
      The chunk address range is used to flush cache on vmalloc area
      map/unmap and decide whether a given address is in the first chunk by
      per_cpu_ptr_to_phys() and the bug was discovered by invalid
      per_cpu_ptr_to_phys() translation for crash_note.
      
      Kudos to Dave Young for tracking down the problem.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
      Reported-by: default avatarDave Young <dyoung@redhat.com>
      Tested-by: default avatarDave Young <dyoung@redhat.com>
      LKML-Reference: <4EC21F67.10905@redhat.com>
      Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f9da6299
    • Robert Richter's avatar
      oprofile: Fix locking dependency in sync_start() · 41f7082e
      Robert Richter authored
      commit 130c5ce7 upstream.
      
      This fixes the A->B/B->A locking dependency, see the warning below.
      
      The function task_exit_notify() is called with (task_exit_notifier)
      .rwsem set and then calls sync_buffer() which locks buffer_mutex. In
      sync_start() the buffer_mutex was set to prevent notifier functions to
      be started before sync_start() is finished. But when registering the
      notifier, (task_exit_notifier).rwsem is locked too, but now in
      different order than in sync_buffer(). In theory this causes a locking
      dependency, what does not occur in practice since task_exit_notify()
      is always called after the notifier is registered which means the lock
      is already released.
      
      However, after checking the notifier functions it turned out the
      buffer_mutex in sync_start() is unnecessary. This is because
      sync_buffer() may be called from the notifiers even if sync_start()
      did not finish yet, the buffers are already allocated but empty. No
      need to protect this with the mutex.
      
      So we fix this theoretical locking dependency by removing buffer_mutex
      in sync_start(). This is similar to the implementation before commit:
      
       750d857c oprofile: fix crash when accessing freed task structs
      
      which introduced the locking dependency.
      
      Lockdep warning:
      
      oprofiled/4447 is trying to acquire lock:
       (buffer_mutex){+.+...}, at: [<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile]
      
      but task is already holding lock:
       ((task_exit_notifier).rwsem){++++..}, at: [<ffffffff81058026>] __blocking_notifier_call_chain+0x39/0x67
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #1 ((task_exit_notifier).rwsem){++++..}:
             [<ffffffff8106557f>] lock_acquire+0xf8/0x11e
             [<ffffffff81463a2b>] down_write+0x44/0x67
             [<ffffffff810581c0>] blocking_notifier_chain_register+0x52/0x8b
             [<ffffffff8105a6ac>] profile_event_register+0x2d/0x2f
             [<ffffffffa00013c1>] sync_start+0x47/0xc6 [oprofile]
             [<ffffffffa00001bb>] oprofile_setup+0x60/0xa5 [oprofile]
             [<ffffffffa00014e3>] event_buffer_open+0x59/0x8c [oprofile]
             [<ffffffff810cd3b9>] __dentry_open+0x1eb/0x308
             [<ffffffff810cd59d>] nameidata_to_filp+0x60/0x67
             [<ffffffff810daad6>] do_last+0x5be/0x6b2
             [<ffffffff810dbc33>] path_openat+0xc7/0x360
             [<ffffffff810dbfc5>] do_filp_open+0x3d/0x8c
             [<ffffffff810ccfd2>] do_sys_open+0x110/0x1a9
             [<ffffffff810cd09e>] sys_open+0x20/0x22
             [<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1b
      
      -> #0 (buffer_mutex){+.+...}:
             [<ffffffff81064dfb>] __lock_acquire+0x1085/0x1711
             [<ffffffff8106557f>] lock_acquire+0xf8/0x11e
             [<ffffffff814634f0>] mutex_lock_nested+0x63/0x309
             [<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile]
             [<ffffffffa0001226>] task_exit_notify+0x16/0x1a [oprofile]
             [<ffffffff81467b96>] notifier_call_chain+0x37/0x63
             [<ffffffff8105803d>] __blocking_notifier_call_chain+0x50/0x67
             [<ffffffff81058068>] blocking_notifier_call_chain+0x14/0x16
             [<ffffffff8105a718>] profile_task_exit+0x1a/0x1c
             [<ffffffff81039e8f>] do_exit+0x2a/0x6fc
             [<ffffffff8103a5e4>] do_group_exit+0x83/0xae
             [<ffffffff8103a626>] sys_exit_group+0x17/0x1b
             [<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1b
      
      other info that might help us debug this:
      
      1 lock held by oprofiled/4447:
       #0:  ((task_exit_notifier).rwsem){++++..}, at: [<ffffffff81058026>] __blocking_notifier_call_chain+0x39/0x67
      
      stack backtrace:
      Pid: 4447, comm: oprofiled Not tainted 2.6.39-00007-gcf4d8d4 #10
      Call Trace:
       [<ffffffff81063193>] print_circular_bug+0xae/0xbc
       [<ffffffff81064dfb>] __lock_acquire+0x1085/0x1711
       [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile]
       [<ffffffff8106557f>] lock_acquire+0xf8/0x11e
       [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile]
       [<ffffffff81062627>] ? mark_lock+0x42f/0x552
       [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile]
       [<ffffffff814634f0>] mutex_lock_nested+0x63/0x309
       [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile]
       [<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile]
       [<ffffffff81058026>] ? __blocking_notifier_call_chain+0x39/0x67
       [<ffffffff81058026>] ? __blocking_notifier_call_chain+0x39/0x67
       [<ffffffffa0001226>] task_exit_notify+0x16/0x1a [oprofile]
       [<ffffffff81467b96>] notifier_call_chain+0x37/0x63
       [<ffffffff8105803d>] __blocking_notifier_call_chain+0x50/0x67
       [<ffffffff81058068>] blocking_notifier_call_chain+0x14/0x16
       [<ffffffff8105a718>] profile_task_exit+0x1a/0x1c
       [<ffffffff81039e8f>] do_exit+0x2a/0x6fc
       [<ffffffff81465031>] ? retint_swapgs+0xe/0x13
       [<ffffffff8103a5e4>] do_group_exit+0x83/0xae
       [<ffffffff8103a626>] sys_exit_group+0x17/0x1b
       [<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1b
      Reported-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
      Cc: Carl Love <carll@us.ibm.com>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      41f7082e
    • Robert Richter's avatar
      oprofile: Free potentially owned tasks in case of errors · 0faa8aa9
      Robert Richter authored
      commit 6ac6519b upstream.
      
      After registering the task free notifier we possibly have tasks in our
      dying_tasks list. Free them after unregistering the notifier in case
      of an error.
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0faa8aa9
    • Hans Verkuil's avatar
      ARM: davinci: dm646x evm: wrong register used in setup_vpif_input_channel_mode · 372dfcdb
      Hans Verkuil authored
      commit 83713fc9 upstream.
      
      The function setup_vpif_input_channel_mode() used the VSCLKDIS register
      instead of VIDCLKCTL. This meant that when in HD mode videoport channel 0
      used a different clock from channel 1.
      
      Clearly a copy-and-paste error.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarManjunath Hadli <manjunath.hadli@ti.com>
      Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      372dfcdb
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Fix Oops in alc_mux_select() · 0f215d5b
      Takashi Iwai authored
      commit cce4aa37 upstream.
      
      When no imux is available (e.g. a single capture source),
      alc_auto_init_input_src() may trigger an Oops due to the access to -1.
      Add a proper zero-check to avoid it.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0f215d5b
    • David Dillow's avatar
      ALSA: sis7019 - give slow codecs more time to reset · d21de8b1
      David Dillow authored
      commit fc084e0b upstream.
      
      There are some AC97 codec and board combinations that have been observed
      to take a very long time to respond after the cold reset has completed.
      In one case, more than 350 ms was required. To allow users to have sound
      on those platforms, we'll wait up to 500ms for the codec to become
      ready.
      
      As a board may have multiple codecs, with some faster than others to
      reset, we add a module parameter to inform the driver which codecs
      should be present.
      Reported-by: default avatarKotCzarny <tjosko@yahoo.com>
      Signed-off-by: default avatarDavid Dillow <dave@thedillows.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d21de8b1
  2. 09 Dec, 2011 28 commits
  3. 26 Nov, 2011 2 commits