1. 02 Mar, 2011 17 commits
    • Tetsuo Handa's avatar
      CRED: Fix memory and refcount leaks upon security_prepare_creds() failure · 89065079
      Tetsuo Handa authored
      commit fb2b2a1d upstream.
      
      In prepare_kernel_cred() since 2.6.29, put_cred(new) is called without
      assigning new->usage when security_prepare_creds() returned an error.  As a
      result, memory for new and refcount for new->{user,group_info,tgcred} are
      leaked because put_cred(new) won't call __put_cred() unless old->usage == 1.
      
      Fix these leaks by assigning new->usage (and new->subscribers which was added
      in 2.6.32) before calling security_prepare_creds().
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      89065079
    • Tetsuo Handa's avatar
      CRED: Fix BUG() upon security_cred_alloc_blank() failure · 016d370b
      Tetsuo Handa authored
      commit 2edeaa34 upstream.
      
      In cred_alloc_blank() since 2.6.32, abort_creds(new) is called with
      new->security == NULL and new->magic == 0 when security_cred_alloc_blank()
      returns an error.  As a result, BUG() will be triggered if SELinux is enabled
      or CONFIG_DEBUG_CREDENTIALS=y.
      
      If CONFIG_DEBUG_CREDENTIALS=y, BUG() is called from __invalid_creds() because
      cred->magic == 0.  Failing that, BUG() is called from selinux_cred_free()
      because selinux_cred_free() is not expecting cred->security == NULL.  This does
      not affect smack_cred_free(), tomoyo_cred_free() or apparmor_cred_free().
      
      Fix these bugs by
      
      (1) Set new->magic before calling security_cred_alloc_blank().
      
      (2) Handle null cred->security in creds_are_invalid() and selinux_cred_free().
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      016d370b
    • Tetsuo Handa's avatar
      CRED: Fix kernel panic upon security_file_alloc() failure. · 1c0cd1eb
      Tetsuo Handa authored
      commit 78d29788 upstream.
      
      In get_empty_filp() since 2.6.29, file_free(f) is called with f->f_cred == NULL
      when security_file_alloc() returned an error.  As a result, kernel will panic()
      due to put_cred(NULL) call within RCU callback.
      
      Fix this bug by assigning f->f_cred before calling security_file_alloc().
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1c0cd1eb
    • Ben Hutchings's avatar
      bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion · 58ce8fab
      Ben Hutchings authored
      This is related to commit f88a4a9b
      upstream, but the bug cannot be properly fixed without the other
      changes to VLAN tagging in 2.6.37.
      
      bond_na_send() attempts to insert a VLAN tag in between building and
      sending packets of the respective formats.  If the slave does not
      implement hardware VLAN tag insertion then vlan_put_tag() will mangle
      the network-layer header because the Ethernet header is not present at
      this point (unlike in bond_arp_send()).
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      58ce8fab
    • David Howells's avatar
      CRED: Fix get_task_cred() and task_state() to not resurrect dead credentials · c8fd4409
      David Howells authored
      commit de09a977 upstream.
      
      It's possible for get_task_cred() as it currently stands to 'corrupt' a set of
      credentials by incrementing their usage count after their replacement by the
      task being accessed.
      
      What happens is that get_task_cred() can race with commit_creds():
      
      	TASK_1			TASK_2			RCU_CLEANER
      	-->get_task_cred(TASK_2)
      	rcu_read_lock()
      	__cred = __task_cred(TASK_2)
      				-->commit_creds()
      				old_cred = TASK_2->real_cred
      				TASK_2->real_cred = ...
      				put_cred(old_cred)
      				  call_rcu(old_cred)
      		[__cred->usage == 0]
      	get_cred(__cred)
      		[__cred->usage == 1]
      	rcu_read_unlock()
      							-->put_cred_rcu()
      							[__cred->usage == 1]
      							panic()
      
      However, since a tasks credentials are generally not changed very often, we can
      reasonably make use of a loop involving reading the creds pointer and using
      atomic_inc_not_zero() to attempt to increment it if it hasn't already hit zero.
      
      If successful, we can safely return the credentials in the knowledge that, even
      if the task we're accessing has released them, they haven't gone to the RCU
      cleanup code.
      
      We then change task_state() in procfs to use get_task_cred() rather than
      calling get_cred() on the result of __task_cred(), as that suffers from the
      same problem.
      
      Without this change, a BUG_ON in __put_cred() or in put_cred_rcu() can be
      tripped when it is noticed that the usage count is not zero as it ought to be,
      for example:
      
      kernel BUG at kernel/cred.c:168!
      invalid opcode: 0000 [#1] SMP
      last sysfs file: /sys/kernel/mm/ksm/run
      CPU 0
      Pid: 2436, comm: master Not tainted 2.6.33.3-85.fc13.x86_64 #1 0HR330/OptiPlex
      745
      RIP: 0010:[<ffffffff81069881>]  [<ffffffff81069881>] __put_cred+0xc/0x45
      RSP: 0018:ffff88019e7e9eb8  EFLAGS: 00010202
      RAX: 0000000000000001 RBX: ffff880161514480 RCX: 00000000ffffffff
      RDX: 00000000ffffffff RSI: ffff880140c690c0 RDI: ffff880140c690c0
      RBP: ffff88019e7e9eb8 R08: 00000000000000d0 R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000040 R12: ffff880140c690c0
      R13: ffff88019e77aea0 R14: 00007fff336b0a5c R15: 0000000000000001
      FS:  00007f12f50d97c0(0000) GS:ffff880007400000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f8f461bc000 CR3: 00000001b26ce000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process master (pid: 2436, threadinfo ffff88019e7e8000, task ffff88019e77aea0)
      Stack:
       ffff88019e7e9ec8 ffffffff810698cd ffff88019e7e9ef8 ffffffff81069b45
      <0> ffff880161514180 ffff880161514480 ffff880161514180 0000000000000000
      <0> ffff88019e7e9f28 ffffffff8106aace 0000000000000001 0000000000000246
      Call Trace:
       [<ffffffff810698cd>] put_cred+0x13/0x15
       [<ffffffff81069b45>] commit_creds+0x16b/0x175
       [<ffffffff8106aace>] set_current_groups+0x47/0x4e
       [<ffffffff8106ac89>] sys_setgroups+0xf6/0x105
       [<ffffffff81009b02>] system_call_fastpath+0x16/0x1b
      Code: 48 8d 71 ff e8 7e 4e 15 00 85 c0 78 0b 8b 75 ec 48 89 df e8 ef 4a 15 00
      48 83 c4 18 5b c9 c3 55 8b 07 8b 07 48 89 e5 85 c0 74 04 <0f> 0b eb fe 65 48 8b
      04 25 00 cc 00 00 48 3b b8 58 04 00 00 75
      RIP  [<ffffffff81069881>] __put_cred+0xc/0x45
       RSP <ffff88019e7e9eb8>
      ---[ end trace df391256a100ebdd ]---
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c8fd4409
    • Dan Carpenter's avatar
      av7110: check for negative array offset · dd6a19a5
      Dan Carpenter authored
      commit cb26a24e upstream.
      
      info->num comes from the user.  It's type int.  If the user passes
      in a negative value that would cause memory corruption.
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dd6a19a5
    • Jeremy Fitzhardinge's avatar
      x86/pvclock: Zero last_value on resume · 595b62a8
      Jeremy Fitzhardinge authored
      commit e7a3481c upstream.
      
      If the guest domain has been suspend/resumed or migrated, then the
      system clock backing the pvclock clocksource may revert to a smaller
      value (ie, can be non-monotonic across the migration/save-restore).
      
      Make sure we zero last_value in that case so that the domain
      continues to see clock updates.
      Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      595b62a8
    • Alan Stern's avatar
      OHCI: work around for nVidia shutdown problem · 5f528de0
      Alan Stern authored
      commit 3df7169e upstream.
      
      This patch (as1417) fixes a problem affecting some (or all) nVidia
      chipsets.  When the computer is shut down, the OHCI controllers
      continue to power the USB buses and evidently they drive a Reset
      signal out all their ports.  This prevents attached devices from going
      to low power.  Mouse LEDs stay on, for example, which is disconcerting
      for users and a drain on laptop batteries.
      
      The fix involves leaving each OHCI controller in the OPERATIONAL state
      during system shutdown rather than putting it in the RESET state.
      Although this nominally means the controller is running, in fact it's
      not doing very much since all the schedules are all disabled.  However
      there is ongoing DMA to the Host Controller Communications Area, so
      the patch also disables the bus-master capability of all PCI USB
      controllers after the shutdown routine runs.
      
      The fix is applied only to nVidia-based PCI OHCI controllers, so it
      shouldn't cause problems on systems using other hardware.  As an added
      safety measure, in case the kernel encounters one of these running
      controllers during boot, the patch changes quirk_usb_handoff_ohci()
      (which runs early on during PCI discovery) to reset the controller
      before anything bad can happen.
      Reported-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Tested-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5f528de0
    • Shaohua Li's avatar
      x86, hpet: Disable per-cpu hpet timer if ARAT is supported · bf8c4fb7
      Shaohua Li authored
      commit 39fe05e5 upstream.
      
      If CPU support always running local APIC timer, per-cpu hpet
      timer could be disabled, which is useless and wasteful in such
      case. Let's leave the timers to others.
      
      The effect is that we reserve less timers.
      Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
      Cc: venkatesh.pallipadi@intel.com
      LKML-Reference: <20090812031612.GA10062@sli10-desk.sh.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Thomas Renninger <trenn@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      bf8c4fb7
    • Apollon Oikonomopoulos's avatar
      x25: decrement netdev reference counts on unload · cfa3f57b
      Apollon Oikonomopoulos authored
      commit 171995e5 upstream.
      
      x25 does not decrement the network device reference counts on module unload.
      Thus unregistering any pre-existing interface after unloading the x25 module
      hangs and results in
      
       unregister_netdevice: waiting for tap0 to become free. Usage count = 1
      
      This patch decrements the reference counts of all interfaces in x25_link_free,
      the way it is already done in x25_link_device_down for NETDEV_DOWN events.
      Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      cfa3f57b
    • David S. Miller's avatar
      filter: make sure filters dont read uninitialized memory · f37c091b
      David S. Miller authored
      commit 57fe93b3 upstream.
      
      There is a possibility malicious users can get limited information about
      uninitialized stack mem array. Even if sk_run_filter() result is bound
      to packet length (0 .. 65535), we could imagine this can be used by
      hostile user.
      
      Initializing mem[] array, like Dan Rosenberg suggested in his patch is
      expensive since most filters dont even use this array.
      
      Its hard to make the filter validation in sk_chk_filter(), because of
      the jumps. This might be done later.
      
      In this patch, I use a bitmap (a single long var) so that only filters
      using mem[] loads/stores pay the price of added security checks.
      
      For other filters, additional cost is a single instruction.
      
      [ Since we access fentry->k a lot now, cache it in a local variable
        and mark filter entry pointer as const. -DaveM ]
      Reported-by: default avatarDan Rosenberg <drosenberg@vsecurity.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [Backported by dann frazier <dannf@debian.org>]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f37c091b
    • Dan Rosenberg's avatar
      Fix pktcdvd ioctl dev_minor range check · 12d83a21
      Dan Rosenberg authored
      commit 252a52aa upstream.
      
      The PKT_CTRL_CMD_STATUS device ioctl retrieves a pointer to a
      pktcdvd_device from the global pkt_devs array.  The index into this
      array is provided directly by the user and is a signed integer, so the
      comparison to ensure that it falls within the bounds of this array will
      fail when provided with a negative index.
      
      This can be used to read arbitrary kernel memory or cause a crash due to
      an invalid pointer dereference.  This can be exploited by users with
      permission to open /dev/pktcdvd/control (on many distributions, this is
      readable by group "cdrom").
      Signed-off-by: default avatarDan Rosenberg <dan.j.rosenberg@gmail.com>
      [ Rather than add a cast, just make the function take the right type -Linus ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      12d83a21
    • dann frazier's avatar
      ocfs2_connection_find() returns pointer to bad structure · 965f6e05
      dann frazier authored
      commit 226291aa upstream.
      
      If ocfs2_live_connection_list is empty, ocfs2_connection_find() will return
      a pointer to the LIST_HEAD, cast as a ocfs2_live_connection. This can cause
      an oops when ocfs2_control_send_down() dereferences c->oc_conn:
      
      Call Trace:
        [<ffffffffa00c2a3c>] ocfs2_control_message+0x28c/0x2b0 [ocfs2_stack_user]
        [<ffffffffa00c2a95>] ocfs2_control_write+0x35/0xb0 [ocfs2_stack_user]
        [<ffffffff81143a88>] vfs_write+0xb8/0x1a0
        [<ffffffff8155cc13>] ? do_page_fault+0x153/0x3b0
        [<ffffffff811442f1>] sys_write+0x51/0x80
        [<ffffffff810121b2>] system_call_fastpath+0x16/0x1b
      
      Fix by explicitly returning NULL if no match is found.
      Signed-off-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      965f6e05
    • Dan Rosenberg's avatar
      sctp: Fix out-of-bounds reading in sctp_asoc_get_hmac() · 1209e7ab
      Dan Rosenberg authored
      commit 51e97a12 upstream.
      
      The sctp_asoc_get_hmac() function iterates through a peer's hmac_ids
      array and attempts to ensure that only a supported hmac entry is
      returned.  The current code fails to do this properly - if the last id
      in the array is out of range (greater than SCTP_AUTH_HMAC_ID_MAX), the
      id integer remains set after exiting the loop, and the address of an
      out-of-bounds entry will be returned and subsequently used in the parent
      function, causing potentially ugly memory corruption.  This patch resets
      the id integer to 0 on encountering an invalid id so that NULL will be
      returned after finishing the loop if no valid ids are found.
      Signed-off-by: default avatarDan Rosenberg <drosenberg@vsecurity.com>
      Acked-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1209e7ab
    • Kashyap, Desai's avatar
      mptfusion: Fix Incorrect return value in mptscsih_dev_reset · bcb8164b
      Kashyap, Desai authored
      commit bcfe42e9 upstream.
      
      There's a branch at the end of this function that
      is supposed to normalize the return value with what
      the mid-layer expects. In this one case, we get it wrong.
      
      Also increase the verbosity of the INFO level printk
      at the end of mptscsih_abort to include the actual return value
      and the scmd->serial_number. The reason being success
      or failure is actually determined by the state of
      the internal tag list when a TMF is issued, and not the
      return value of the TMF cmd. The serial_number is also
      used in this decision, thus it's useful to know for debugging
      purposes.
      Reported-by: default avatarPeter M. Petrakis <peter.petrakis@canonical.com>
      Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      bcb8164b
    • Kashyap, Desai's avatar
      mptfusion: mptctl_release is required in mptctl.c · 6140386a
      Kashyap, Desai authored
      commit 84857c8b upstream.
      
      Added missing release callback for file_operations mptctl_fops.
      Without release callback there will be never freed. It remains on
      mptctl's eent list even after the file is closed and released.
      
      Relavent RHEL bugzilla is 660871
      Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6140386a
    • Konstantin Khorenko's avatar
      NFSD: memory corruption due to writing beyond the stat array · e2b71389
      Konstantin Khorenko authored
      commit 3aa6e0aa upstream.
      
      If nfsd fails to find an exported via NFS file in the readahead cache, it
      should increment corresponding nfsdstats counter (ra_depth[10]), but due to a
      bug it may instead write to ra_depth[11], corrupting the following field.
      
      In a kernel with NFSDv4 compiled in the corruption takes the form of an
      increment of a counter of the number of NFSv4 operation 0's received; since
      there is no operation 0, this is harmless.
      
      In a kernel with NFSDv4 disabled it corrupts whatever happens to be in the
      memory beyond nfsdstats.
      Signed-off-by: default avatarKonstantin Khorenko <khorenko@openvz.org>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e2b71389
  2. 18 Feb, 2011 1 commit
  3. 17 Feb, 2011 22 commits