1. 02 Aug, 2010 9 commits
  2. 05 Jul, 2010 31 commits
    • Greg Kroah-Hartman's avatar
      Linux 2.6.32.16 · 6c708176
      Greg Kroah-Hartman authored
      6c708176
    • Wei Yongjun's avatar
      sctp: fix append error cause to ERROR chunk correctly · a0bda22f
      Wei Yongjun authored
      commit 2e3219b5 upstream.
      
      commit 5fa782c2
        sctp: Fix skb_over_panic resulting from multiple invalid \
          parameter errors (CVE-2010-1173) (v4)
      
      cause 'error cause' never be add the the ERROR chunk due to
      some typo when check valid length in sctp_init_cause_fixed().
      Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
      Reviewed-by: default avatarNeil Horman <nhorman@tuxdriver.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>
      a0bda22f
    • Ben Hutchings's avatar
      qla2xxx: Disable MSI on qla24xx chips other than QLA2432. · 966399a8
      Ben Hutchings authored
      commit 6377a7ae upstream.
      
      On specific platforms, MSI is unreliable on some of the QLA24xx chips, resulting
      in fatal I/O errors under load, as reported in <http://bugs.debian.org/572322>
      and by some RHEL customers.
      Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      966399a8
    • Toshiyuki Okajima's avatar
      KEYS: find_keyring_by_name() can gain access to a freed keyring · 48b97a01
      Toshiyuki Okajima authored
      commit cea7daa3 upstream.
      
      find_keyring_by_name() can gain access to a keyring that has had its reference
      count reduced to zero, and is thus ready to be freed.  This then allows the
      dead keyring to be brought back into use whilst it is being destroyed.
      
      The following timeline illustrates the process:
      
      |(cleaner)                           (user)
      |
      | free_user(user)                    sys_keyctl()
      |  |                                  |
      |  key_put(user->session_keyring)     keyctl_get_keyring_ID()
      |  ||	//=> keyring->usage = 0        |
      |  |schedule_work(&key_cleanup_task)   lookup_user_key()
      |  ||                                   |
      |  kmem_cache_free(,user)               |
      |  .                                    |[KEY_SPEC_USER_KEYRING]
      |  .                                    install_user_keyrings()
      |  .                                    ||
      | key_cleanup() [<= worker_thread()]    ||
      |  |                                    ||
      |  [spin_lock(&key_serial_lock)]        |[mutex_lock(&key_user_keyr..mutex)]
      |  |                                    ||
      |  atomic_read() == 0                   ||
      |  |{ rb_ease(&key->serial_node,) }     ||
      |  |                                    ||
      |  [spin_unlock(&key_serial_lock)]      |find_keyring_by_name()
      |  |                                    |||
      |  keyring_destroy(keyring)             ||[read_lock(&keyring_name_lock)]
      |  ||                                   |||
      |  |[write_lock(&keyring_name_lock)]    ||atomic_inc(&keyring->usage)
      |  |.                                   ||| *** GET freeing keyring ***
      |  |.                                   ||[read_unlock(&keyring_name_lock)]
      |  ||                                   ||
      |  |list_del()                          |[mutex_unlock(&key_user_k..mutex)]
      |  ||                                   |
      |  |[write_unlock(&keyring_name_lock)]  ** INVALID keyring is returned **
      |  |                                    .
      |  kmem_cache_free(,keyring)            .
      |                                       .
      |                                       atomic_dec(&keyring->usage)
      v                                         *** DESTROYED ***
      TIME
      
      If CONFIG_SLUB_DEBUG=y then we may see the following message generated:
      
      	=============================================================================
      	BUG key_jar: Poison overwritten
      	-----------------------------------------------------------------------------
      
      	INFO: 0xffff880197a7e200-0xffff880197a7e200. First byte 0x6a instead of 0x6b
      	INFO: Allocated in key_alloc+0x10b/0x35f age=25 cpu=1 pid=5086
      	INFO: Freed in key_cleanup+0xd0/0xd5 age=12 cpu=1 pid=10
      	INFO: Slab 0xffffea000592cb90 objects=16 used=2 fp=0xffff880197a7e200 flags=0x200000000000c3
      	INFO: Object 0xffff880197a7e200 @offset=512 fp=0xffff880197a7e300
      
      	Bytes b4 0xffff880197a7e1f0:  5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZZZZZ
      	  Object 0xffff880197a7e200:  6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b jkkkkkkkkkkkkkkk
      
      Alternatively, we may see a system panic happen, such as:
      
      	BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
      	IP: [<ffffffff810e61a3>] kmem_cache_alloc+0x5b/0xe9
      	PGD 6b2b4067 PUD 6a80d067 PMD 0
      	Oops: 0000 [#1] SMP
      	last sysfs file: /sys/kernel/kexec_crash_loaded
      	CPU 1
      	...
      	Pid: 31245, comm: su Not tainted 2.6.34-rc5-nofixed-nodebug #2 D2089/PRIMERGY
      	RIP: 0010:[<ffffffff810e61a3>]  [<ffffffff810e61a3>] kmem_cache_alloc+0x5b/0xe9
      	RSP: 0018:ffff88006af3bd98  EFLAGS: 00010002
      	RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88007d19900b
      	RDX: 0000000100000000 RSI: 00000000000080d0 RDI: ffffffff81828430
      	RBP: ffffffff81828430 R08: ffff88000a293750 R09: 0000000000000000
      	R10: 0000000000000001 R11: 0000000000100000 R12: 00000000000080d0
      	R13: 00000000000080d0 R14: 0000000000000296 R15: ffffffff810f20ce
      	FS:  00007f97116bc700(0000) GS:ffff88000a280000(0000) knlGS:0000000000000000
      	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      	CR2: 0000000000000001 CR3: 000000006a91c000 CR4: 00000000000006e0
      	DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      	DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      	Process su (pid: 31245, threadinfo ffff88006af3a000, task ffff8800374414c0)
      	Stack:
      	 0000000512e0958e 0000000000008000 ffff880037f8d180 0000000000000001
      	 0000000000000000 0000000000008001 ffff88007d199000 ffffffff810f20ce
      	 0000000000008000 ffff88006af3be48 0000000000000024 ffffffff810face3
      	Call Trace:
      	 [<ffffffff810f20ce>] ? get_empty_filp+0x70/0x12f
      	 [<ffffffff810face3>] ? do_filp_open+0x145/0x590
      	 [<ffffffff810ce208>] ? tlb_finish_mmu+0x2a/0x33
      	 [<ffffffff810ce43c>] ? unmap_region+0xd3/0xe2
      	 [<ffffffff810e4393>] ? virt_to_head_page+0x9/0x2d
      	 [<ffffffff81103916>] ? alloc_fd+0x69/0x10e
      	 [<ffffffff810ef4ed>] ? do_sys_open+0x56/0xfc
      	 [<ffffffff81008a02>] ? system_call_fastpath+0x16/0x1b
      	Code: 0f 1f 44 00 00 49 89 c6 fa 66 0f 1f 44 00 00 65 4c 8b 04 25 60 e8 00 00 48 8b 45 00 49 01 c0 49 8b 18 48 85 db 74 0d 48 63 45 18 <48> 8b 04 03 49 89 00 eb 14 4c 89 f9 83 ca ff 44 89 e6 48 89 ef
      	RIP  [<ffffffff810e61a3>] kmem_cache_alloc+0x5b/0xe9
      
      This problem is that find_keyring_by_name does not confirm that the keyring is
      valid before accepting it.
      
      Skipping keyrings that have been reduced to a zero count seems the way to go.
      To this end, use atomic_inc_not_zero() to increment the usage count and skip
      the candidate keyring if that returns false.
      
      The following script _may_ cause the bug to happen, but there's no guarantee
      as the window of opportunity is small:
      
      	#!/bin/sh
      	LOOP=100000
      	USER=dummy_user
      	/bin/su -c "exit;" $USER || { /usr/sbin/adduser -m $USER; add=1; }
      	for ((i=0; i<LOOP; i++))
      	do
      		/bin/su -c "echo '$i' > /dev/null" $USER
      	done
      	(( add == 1 )) && /usr/sbin/userdel -r $USER
      	exit
      
      Note that the nominated user must not be in use.
      
      An alternative way of testing this may be:
      
      	for ((i=0; i<100000; i++))
      	do
      		keyctl session foo /bin/true || break
      	done >&/dev/null
      
      as that uses a keyring named "foo" rather than relying on the user and
      user-session named keyrings.
      Reported-by: default avatarToshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Tested-by: default avatarToshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Chuck Ebbert <cebbert@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      48b97a01
    • Dan Carpenter's avatar
      KEYS: Return more accurate error codes · ec098d19
      Dan Carpenter authored
      commit 4d09ec0f upstream.
      
      We were using the wrong variable here so the error codes weren't being returned
      properly.  The original code returns -ENOKEY.
      Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ec098d19
    • Mikulas Patocka's avatar
      dm snapshot: simplify sector_to_chunk expression · 31f1b308
      Mikulas Patocka authored
      commit 102c6ddb upstream.
      
      Removed unnecessary 'and' masking: The right shift discards the lower
      bits so there is no need to clear them.
      
      (A later patch needs this change to support a 32-bit chunk_mask.)
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarMike Snitzer <snitzer@redhat.com>
      Reviewed-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      31f1b308
    • Helge Deller's avatar
      parisc: clear floating point exception flag on SIGFPE signal · 3cbc7919
      Helge Deller authored
      commit 550f0d92 upstream.
      
      Clear the floating point exception flag before returning to
      user space. This is needed, else the libc trampoline handler
      may hit the same SIGFPE again while building up a trampoline
      to a signal handler.
      
      Fixes debian bug #559406.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarKyle McMartin <kyle@mcmartin.ca>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3cbc7919
    • Yin Kangkai's avatar
      jbd: jbd-debug and jbd2-debug should be writable · 36d28220
      Yin Kangkai authored
      commit 765f8361 upstream.
      
      jbd-debug and jbd2-debug is currently read-only (S_IRUGO), which is not
      correct. Make it writable so that we can start debuging.
      Signed-off-by: default avatarYin Kangkai <kangkai.yin@intel.com>
      Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      36d28220
    • Roedel, Joerg's avatar
      KVM: x86: Inject #GP with the right rip on efer writes · fbec9e1f
      Roedel, Joerg authored
      This patch fixes a bug in the KVM efer-msr write path. If a
      guest writes to a reserved efer bit the set_efer function
      injects the #GP directly. The architecture dependent wrmsr
      function does not see this, assumes success and advances the
      rip. This results in a #GP in the guest with the wrong rip.
      This patch fixes this by reporting efer write errors back to
      the architectural wrmsr function.
      Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit b69e8cae)
      fbec9e1f
    • Avi Kivity's avatar
      KVM: x86: Add missing locking to arch specific vcpu ioctls · c86db80a
      Avi Kivity authored
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 8fbf065d)
      c86db80a
    • Avi Kivity's avatar
      KVM: Fix wallclock version writing race · 0890bb8d
      Avi Kivity authored
      Wallclock writing uses an unprotected global variable to hold the version;
      this can cause one guest to interfere with another if both write their
      wallclock at the same time.
      Acked-by: default avatarGlauber Costa <glommer@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 9ed3c444)
      0890bb8d
    • Avi Kivity's avatar
      KVM: MMU: Don't read pdptrs with mmu spinlock held in mmu_alloc_roots · 4a277f9c
      Avi Kivity authored
      On svm, kvm_read_pdptr() may require reading guest memory, which can sleep.
      
      Push the spinlock into mmu_alloc_roots(), and only take it after we've read
      the pdptr.
      Tested-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 8facbbff)
      4a277f9c
    • Shane Wang's avatar
      KVM: VMX: enable VMXON check with SMX enabled (Intel TXT) · 66307ba1
      Shane Wang authored
      Per document, for feature control MSR:
      
        Bit 1 enables VMXON in SMX operation. If the bit is clear, execution
              of VMXON in SMX operation causes a general-protection exception.
        Bit 2 enables VMXON outside SMX operation. If the bit is clear, execution
              of VMXON outside SMX operation causes a general-protection exception.
      
      This patch is to enable this kind of check with SMX for VMXON in KVM.
      Signed-off-by: default avatarShane Wang <shane.wang@intel.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit cafd6659)
      66307ba1
    • Avi Kivity's avatar
      KVM: MMU: Segregate shadow pages with different cr0.wp · 3b271148
      Avi Kivity authored
      When cr0.wp=0, we may shadow a gpte having u/s=1 and r/w=0 with an spte
      having u/s=0 and r/w=1.  This allows excessive access if the guest sets
      cr0.wp=1 and accesses through this spte.
      
      Fix by making cr0.wp part of the base role; we'll have different sptes for
      the two cases and the problem disappears.
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 3dbe1415)
      3b271148
    • Sheng Yang's avatar
      KVM: x86: Check LMA bit before set_efer · e4a13296
      Sheng Yang authored
      kvm_x86_ops->set_efer() would execute vcpu->arch.efer = efer, so the
      checking of LMA bit didn't work.
      Signed-off-by: default avatarSheng Yang <sheng@linux.intel.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit a3d204e2)
      e4a13296
    • Avi Kivity's avatar
      KVM: Don't allow lmsw to clear cr0.pe · 90a08dc7
      Avi Kivity authored
      The current lmsw implementation allows the guest to clear cr0.pe, contrary
      to the manual, which breaks EMM386.EXE.
      
      Fix by ORing the old cr0.pe with lmsw's operand.
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit f78e9176)
      90a08dc7
    • Glauber Costa's avatar
      x86, paravirt: Add a global synchronization point for pvclock · 1345126c
      Glauber Costa authored
      In recent stress tests, it was found that pvclock-based systems
      could seriously warp in smp systems. Using ingo's time-warp-test.c,
      I could trigger a scenario as bad as 1.5mi warps a minute in some systems.
      (to be fair, it wasn't that bad in most of them). Investigating further, I
      found out that such warps were caused by the very offset-based calculation
      pvclock is based on.
      
      This happens even on some machines that report constant_tsc in its tsc flags,
      specially on multi-socket ones.
      
      Two reads of the same kernel timestamp at approx the same time, will likely
      have tsc timestamped in different occasions too. This means the delta we
      calculate is unpredictable at best, and can probably be smaller in a cpu
      that is legitimately reading clock in a forward ocasion.
      
      Some adjustments on the host could make this window less likely to happen,
      but still, it pretty much poses as an intrinsic problem of the mechanism.
      
      A while ago, I though about using a shared variable anyway, to hold clock
      last state, but gave up due to the high contention locking was likely
      to introduce, possibly rendering the thing useless on big machines. I argue,
      however, that locking is not necessary.
      
      We do a read-and-return sequence in pvclock, and between read and return,
      the global value can have changed. However, it can only have changed
      by means of an addition of a positive value. So if we detected that our
      clock timestamp is less than the current global, we know that we need to
      return a higher one, even though it is not exactly the one we compared to.
      
      OTOH, if we detect we're greater than the current time source, we atomically
      replace the value with our new readings. This do causes contention on big
      boxes (but big here means *BIG*), but it seems like a good trade off, since
      it provide us with a time source guaranteed to be stable wrt time warps.
      
      After this patch is applied, I don't see a single warp in time during 5 days
      of execution, in any of the machines I saw them before.
      Signed-off-by: default avatarGlauber Costa <glommer@redhat.com>
      Acked-by: default avatarZachary Amsden <zamsden@redhat.com>
      CC: Jeremy Fitzhardinge <jeremy@goop.org>
      CC: Avi Kivity <avi@redhat.com>
      CC: Marcelo Tosatti <mtosatti@redhat.com>
      CC: Zachary Amsden <zamsden@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 489fb490)
      1345126c
    • Wei Yongjun's avatar
      KVM: PPC: Do not create debugfs if fail to create vcpu · 55d1dfd1
      Wei Yongjun authored
      If fail to create the vcpu, we should not create the debugfs
      for it.
      Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
      Acked-by: default avatarAlexander Graf <agraf@suse.de>
      Cc: stable@kernel.org
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 06056bfb)
      55d1dfd1
    • Wei Yongjun's avatar
      KVM: s390: Fix possible memory leak of in kvm_arch_vcpu_create() · 3f96c6f9
      Wei Yongjun authored
      This patch fixed possible memory leak in kvm_arch_vcpu_create()
      under s390, which would happen when kvm_arch_vcpu_create() fails.
      Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
      Acked-by: default avatarCarsten Otte <cotte@de.ibm.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      (cherry picked from commit 7b06bf2f)
      3f96c6f9
    • Dmitry Torokhov's avatar
      Input: psmouse - reset all types of mice before reconnecting · 04a08885
      Dmitry Torokhov authored
      commit ef110b24 upstream.
      
      Synaptics hardware requires resetting device after suspend to ram
      in order for the device to be operational. The reset lives in
      synaptics-specific reconnect handler, but it is not being invoked
      if synaptics support is disabled and the device is handled as a
      standard PS/2 device (bare or IntelliMouse protocol).
      
      Let's add reset into generic reconnect handler as well.
      Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
      Cc: Tim Gardner <tim.gardner@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      04a08885
    • Neil Horman's avatar
      tipc: Fix oops on send prior to entering networked mode (v3) · ed24d912
      Neil Horman authored
      commit d0021b25 upstream.
      
      Fix TIPC to disallow sending to remote addresses prior to entering NET_MODE
      
      user programs can oops the kernel by sending datagrams via AF_TIPC prior to
      entering networked mode.  The following backtrace has been observed:
      
      ID: 13459  TASK: ffff810014640040  CPU: 0   COMMAND: "tipc-client"
      [exception RIP: tipc_node_select_next_hop+90]
      RIP: ffffffff8869d3c3  RSP: ffff81002d9a5ab8  RFLAGS: 00010202
      RAX: 0000000000000001  RBX: 0000000000000001  RCX: 0000000000000001
      RDX: 0000000000000000  RSI: 0000000000000001  RDI: 0000000001001001
      RBP: 0000000001001001   R8: 0074736575716552   R9: 0000000000000000
      R10: ffff81003fbd0680  R11: 00000000000000c8  R12: 0000000000000008
      R13: 0000000000000001  R14: 0000000000000001  R15: ffff810015c6ca00
      ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
      RIP: 0000003cbd8d49a3  RSP: 00007fffc84e0be8  RFLAGS: 00010206
      RAX: 000000000000002c  RBX: ffffffff8005d116  RCX: 0000000000000000
      RDX: 0000000000000008  RSI: 00007fffc84e0c00  RDI: 0000000000000003
      RBP: 0000000000000000   R8: 00007fffc84e0c10   R9: 0000000000000010
      R10: 0000000000000000  R11: 0000000000000246  R12: 0000000000000000
      R13: 00007fffc84e0d10  R14: 0000000000000000  R15: 00007fffc84e0c30
      ORIG_RAX: 000000000000002c  CS: 0033  SS: 002b
      
      What happens is that, when the tipc module in inserted it enters a standalone
      node mode in which communication to its own address is allowed <0.0.0> but not
      to other addresses, since the appropriate data structures have not been
      allocated yet (specifically the tipc_net pointer).  There is nothing stopping a
      client from trying to send such a message however, and if that happens, we
      attempt to dereference tipc_net.zones while the pointer is still NULL, and
      explode.  The fix is pretty straightforward.  Since these oopses all arise from
      the dereference of global pointers prior to their assignment to allocated
      values, and since these allocations are small (about 2k total), lets convert
      these pointers to static arrays of the appropriate size.  All the accesses to
      these bits consider 0/NULL to be a non match when searching, so all the lookups
      still work properly, and there is no longer a chance of a bad dererence
      anywhere.  As a bonus, this lets us eliminate the setup/teardown routines for
      those pointers, and elimnates the need to preform any locking around them to
      prevent access while their being allocated/freed.
      
      I've updated the tipc_net structure to behave this way to fix the exact reported
      problem, and also fixed up the tipc_bearers and media_list arrays to fix an
      obvious simmilar problem that arises from issuing tipc-config commands to
      manipulate bearers/links prior to entering networked mode
      
      I've tested this for a few hours by running the sanity tests and stress test
      with the tipcutils suite, and nothing has fallen over.  There have been a few
      lockdep warnings, but those were there before, and can be addressed later, as
      they didn't actually result in any deadlock.
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      CC: Allan Stephens <allan.stephens@windriver.com>
      CC: David S. Miller <davem@davemloft.net>
      CC: tipc-discussion@lists.sourceforge.net
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ed24d912
    • Jiajun Wu's avatar
      ucc_geth: Fix full TX queue processing · 21eaa71f
      Jiajun Wu authored
      commit 34692421 upstream.
      
      commit 7583605b ("ucc_geth: Fix empty
      TX queue processing") fixed empty TX queue mishandling, but didn't
      account another corner case: when TX queue becomes full.
      
      Without this patch the driver will stop transmiting when TX queue
      becomes full since 'bd == ugeth->txBd[txQ]' actually checks for
      two things: queue empty or full.
      
      Let's better check for NULL skb, which unambiguously signals an empty
      queue.
      Signed-off-by: default avatarJiajun Wu <b06378@freescale.com>
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      21eaa71f
    • Anton Vorontsov's avatar
      ucc_geth: Fix netdev watchdog triggering on link changes · 7c1558cb
      Anton Vorontsov authored
      commit 08b5e1c9 upstream.
      
      Since commit 864fdf88 ("ucc_geth:
      Fix hangs after switching from full to half duplex") ucc_geth driver
      disables the controller during MAC configuration changes. Though,
      disabling the controller might take quite awhile, and so the netdev
      watchdog might get upset:
      
       NETDEV WATCHDOG: eth2 (ucc_geth): transmit queue 0 timed out
       ------------[ cut here ]------------
       Badness at c02729a8 [verbose debug info unavailable]
       NIP: c02729a8 LR: c02729a8 CTR: c01b6088
       REGS: c0451c40 TRAP: 0700   Not tainted  (2.6.32-trunk-8360e)
       [...]
       NIP [c02729a8] dev_watchdog+0x280/0x290
       LR [c02729a8] dev_watchdog+0x280/0x290
       Call Trace:
       [c0451cf0] [c02729a8] dev_watchdog+0x280/0x290 (unreliable)
       [c0451d50] [c00377c4] run_timer_softirq+0x164/0x224
       [c0451da0] [c0032a38] __do_softirq+0xb8/0x13c
       [c0451df0] [c00065cc] do_softirq+0xa0/0xac
       [c0451e00] [c003280c] irq_exit+0x7c/0x9c
       [c0451e10] [c00640c4] __ipipe_sync_stage+0x248/0x24c
       [...]
      
      This patch fixes the issue by detaching the netdev during the
      time we change the configuration.
      Reported-by: default avatarLennart Sorensen <lsorense@csclub.uwaterloo.ca>
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Tested-by: default avatarLennart Sorensen <lsorense@csclub.uwaterloo.ca>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7c1558cb
    • Anton Vorontsov's avatar
      ucc_geth: Fix empty TX queue processing · 127af1f4
      Anton Vorontsov authored
      commit 7583605b upstream.
      
      Following oops was seen with the ucc_geth driver:
      
       Unable to handle kernel paging request for data at address 0x00000058
       Faulting instruction address: 0xc024f2fc
       Oops: Kernel access of bad area, sig: 11 [#1]
       [...]
       NIP [c024f2fc] skb_recycle_check+0x14/0x100
       LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
       Call Trace:
       [df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
       [df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
       [df857dd0] [c0258cf8] net_rx_action+0xf8/0x1b8
       [df857e10] [c0032a38] __do_softirq+0xb8/0x13c
       [df857e60] [c00065cc] do_softirq+0xa0/0xac
       [...]
      
      This is because ucc_geth_tx() tries to process an empty queue when
      queues are logically stopped. Stopping the queues doesn't disable
      polling, and since nowadays ucc_geth_tx() is actually called from
      the polling routine, the oops above might pop up.
      
      Fix this by removing 'netif_queue_stopped() == 0' check.
      Reported-by: default avatarLennart Sorensen <lsorense@csclub.uwaterloo.ca>
      Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
      Tested-by: default avatarLennart Sorensen <lsorense@csclub.uwaterloo.ca>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      127af1f4
    • Shi Weihua's avatar
      Btrfs: should add a permission check for setfacl · 20dab696
      Shi Weihua authored
      commit 2f26afba upstream.
      
      On btrfs, do the following
      ------------------
      # su user1
      # cd btrfs-part/
      # touch aaa
      # getfacl aaa
        # file: aaa
        # owner: user1
        # group: user1
        user::rw-
        group::rw-
        other::r--
      # su user2
      # cd btrfs-part/
      # setfacl -m u::rwx aaa
      # getfacl aaa
        # file: aaa
        # owner: user1
        # group: user1
        user::rwx           <- successed to setfacl
        group::rw-
        other::r--
      ------------------
      but we should prohibit it that user2 changing user1's acl.
      In fact, on ext3 and other fs, a message occurs:
        setfacl: aaa: Operation not permitted
      
      This patch fixed it.
      Signed-off-by: default avatarShi Weihua <shiwh@cn.fujitsu.com>
      Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      20dab696
    • James Chapman's avatar
      l2tp: Fix oops in pppol2tp_xmit · a9689bca
      James Chapman authored
      commit 3feec909 upstream.
      
      When transmitting L2TP frames, we derive the outgoing interface's UDP
      checksum hardware assist capabilities from the tunnel dst dev. This
      can sometimes be NULL, especially when routing protocols are used and
      routing changes occur. This patch just checks for NULL dst or dev
      pointers when checking for netdev hardware assist features.
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000c
      IP: [<f89d074c>] pppol2tp_xmit+0x341/0x4da [pppol2tp]
      *pde = 00000000
      Oops: 0000 [#1] SMP
      last sysfs file: /sys/class/net/lo/operstate
      Modules linked in: pppol2tp pppox ppp_generic slhc ipv6 dummy loop snd_hda_codec_atihdmi snd_hda_intel snd_hda_codec snd_pcm snd_timer snd soundcore snd_page_alloc evdev psmouse serio_raw processor button i2c_piix4 i2c_core ati_agp agpgart pcspkr ext3 jbd mbcache sd_mod ide_pci_generic atiixp ide_core ahci ata_generic floppy ehci_hcd ohci_hcd libata e1000e scsi_mod usbcore nls_base thermal fan thermal_sys [last unloaded: scsi_wait_scan]
      
      Pid: 0, comm: swapper Not tainted (2.6.32.8 #1)
      EIP: 0060:[<f89d074c>] EFLAGS: 00010297 CPU: 3
      EIP is at pppol2tp_xmit+0x341/0x4da [pppol2tp]
      EAX: 00000000 EBX: f64d1680 ECX: 000005b9 EDX: 00000000
      ESI: f6b91850 EDI: f64d16ac EBP: f6a0c4c0 ESP: f70a9cac
       DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      Process swapper (pid: 0, ti=f70a8000 task=f70a31c0 task.ti=f70a8000)
      Stack:
       000005a9 000005b9 f734c400 f66652c0 f7352e00 f67dc800 00000000 f6b91800
      <0> 000005a3 f70ef6c4 f67dcda9 000005a3 f89b192e 00000246 000005a3 f64d1680
      <0> f63633e0 f6363320 f64d1680 f65a7320 f65a7364 f65856c0 f64d1680 f679f02f
      Call Trace:
       [<f89b192e>] ? ppp_push+0x459/0x50e [ppp_generic]
       [<f89b217f>] ? ppp_xmit_process+0x3b6/0x430 [ppp_generic]
       [<f89b2306>] ? ppp_start_xmit+0x10d/0x120 [ppp_generic]
       [<c11c15cb>] ? dev_hard_start_xmit+0x21f/0x2b2
       [<c11d0947>] ? sch_direct_xmit+0x48/0x10e
       [<c11c19a0>] ? dev_queue_xmit+0x263/0x3a6
       [<c11e2a9f>] ? ip_finish_output+0x1f7/0x221
       [<c11df682>] ? ip_forward_finish+0x2e/0x30
       [<c11de645>] ? ip_rcv_finish+0x295/0x2a9
       [<c11c0b19>] ? netif_receive_skb+0x3e9/0x404
       [<f814b791>] ? e1000_clean_rx_irq+0x253/0x2fc [e1000e]
       [<f814cb7a>] ? e1000_clean+0x63/0x1fc [e1000e]
       [<c1047eff>] ? sched_clock_local+0x15/0x11b
       [<c11c1095>] ? net_rx_action+0x96/0x195
       [<c1035750>] ? __do_softirq+0xaa/0x151
       [<c1035828>] ? do_softirq+0x31/0x3c
       [<c10358fe>] ? irq_exit+0x26/0x58
       [<c1004b21>] ? do_IRQ+0x78/0x89
       [<c1003729>] ? common_interrupt+0x29/0x30
       [<c101ac28>] ? native_safe_halt+0x2/0x3
       [<c1008c54>] ? default_idle+0x55/0x75
       [<c1009045>] ? c1e_idle+0xd2/0xd5
       [<c100233c>] ? cpu_idle+0x46/0x62
      Code: 8d 45 08 f0 ff 45 08 89 6b 08 c7 43 68 7e fb 9c f8 8a 45 24 83 e0 0c 3c 04 75 09 80 63 64 f3 e9 b4 00 00 00 8b 43 18 8b 4c 24 04 <8b> 40 0c 8d 79 11 f6 40 44 0e 8a 43 64 75 51 6a 00 8b 4c 24 08
      EIP: [<f89d074c>] pppol2tp_xmit+0x341/0x4da [pppol2tp] SS:ESP 0068:f70a9cac
      CR2: 000000000000000c
      Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a9689bca
    • Miklos Szeredi's avatar
      vfs: add NOFOLLOW flag to umount(2) · 1ef462be
      Miklos Szeredi authored
      commit db1f05bb upstream.
      
      Add a new UMOUNT_NOFOLLOW flag to umount(2).  This is needed to prevent
      symlink attacks in unprivileged unmounts (fuse, samba, ncpfs).
      
      Additionally, return -EINVAL if an unknown flag is used (and specify
      an explicitly unused flag: UMOUNT_UNUSED).  This makes it possible for
      the caller to determine if a flag is supported or not.
      
      CC: Eugene Teo <eugene@redhat.com>
      CC: Michael Kerrisk <mtk.manpages@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1ef462be
    • Steve French's avatar
      CIFS: Allow null nd (as nfs server uses) on create · de925d2e
      Steve French authored
      commit fa588e0c upstream.
      
      While creating a file on a server which supports unix extensions
      such as Samba, if a file is being created which does not supply
      nameidata (i.e. nd is null), cifs client can oops when calling
      cifs_posix_open.
      Signed-off-by: default avatarShirish Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      de925d2e
    • Neil Horman's avatar
      sctp: Fix skb_over_panic resulting from multiple invalid parameter errors (CVE-2010-1173) (v4) · 4a1a39a8
      Neil Horman authored
      commit 5fa782c2 upstream.
      
      Ok, version 4
      
      Change Notes:
      1) Minor cleanups, from Vlads notes
      
      Summary:
      
      Hey-
      	Recently, it was reported to me that the kernel could oops in the
      following way:
      
      <5> kernel BUG at net/core/skbuff.c:91!
      <5> invalid operand: 0000 [#1]
      <5> Modules linked in: sctp netconsole nls_utf8 autofs4 sunrpc iptable_filter
      ip_tables cpufreq_powersave parport_pc lp parport vmblock(U) vsock(U) vmci(U)
      vmxnet(U) vmmemctl(U) vmhgfs(U) acpiphp dm_mirror dm_mod button battery ac md5
      ipv6 uhci_hcd ehci_hcd snd_ens1371 snd_rawmidi snd_seq_device snd_pcm_oss
      snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_ac97_codec snd soundcore
      pcnet32 mii floppy ext3 jbd ata_piix libata mptscsih mptsas mptspi mptscsi
      mptbase sd_mod scsi_mod
      <5> CPU:    0
      <5> EIP:    0060:[<c02bff27>]    Not tainted VLI
      <5> EFLAGS: 00010216   (2.6.9-89.0.25.EL)
      <5> EIP is at skb_over_panic+0x1f/0x2d
      <5> eax: 0000002c   ebx: c033f461   ecx: c0357d96   edx: c040fd44
      <5> esi: c033f461   edi: df653280   ebp: 00000000   esp: c040fd40
      <5> ds: 007b   es: 007b   ss: 0068
      <5> Process swapper (pid: 0, threadinfo=c040f000 task=c0370be0)
      <5> Stack: c0357d96 e0c29478 00000084 00000004 c033f461 df653280 d7883180
      e0c2947d
      <5>        00000000 00000080 df653490 00000004 de4f1ac0 de4f1ac0 00000004
      df653490
      <5>        00000001 e0c2877a 08000800 de4f1ac0 df653490 00000000 e0c29d2e
      00000004
      <5> Call Trace:
      <5>  [<e0c29478>] sctp_addto_chunk+0xb0/0x128 [sctp]
      <5>  [<e0c2947d>] sctp_addto_chunk+0xb5/0x128 [sctp]
      <5>  [<e0c2877a>] sctp_init_cause+0x3f/0x47 [sctp]
      <5>  [<e0c29d2e>] sctp_process_unk_param+0xac/0xb8 [sctp]
      <5>  [<e0c29e90>] sctp_verify_init+0xcc/0x134 [sctp]
      <5>  [<e0c20322>] sctp_sf_do_5_1B_init+0x83/0x28e [sctp]
      <5>  [<e0c25333>] sctp_do_sm+0x41/0x77 [sctp]
      <5>  [<c01555a4>] cache_grow+0x140/0x233
      <5>  [<e0c26ba1>] sctp_endpoint_bh_rcv+0xc5/0x108 [sctp]
      <5>  [<e0c2b863>] sctp_inq_push+0xe/0x10 [sctp]
      <5>  [<e0c34600>] sctp_rcv+0x454/0x509 [sctp]
      <5>  [<e084e017>] ipt_hook+0x17/0x1c [iptable_filter]
      <5>  [<c02d005e>] nf_iterate+0x40/0x81
      <5>  [<c02e0bb9>] ip_local_deliver_finish+0x0/0x151
      <5>  [<c02e0c7f>] ip_local_deliver_finish+0xc6/0x151
      <5>  [<c02d0362>] nf_hook_slow+0x83/0xb5
      <5>  [<c02e0bb2>] ip_local_deliver+0x1a2/0x1a9
      <5>  [<c02e0bb9>] ip_local_deliver_finish+0x0/0x151
      <5>  [<c02e103e>] ip_rcv+0x334/0x3b4
      <5>  [<c02c66fd>] netif_receive_skb+0x320/0x35b
      <5>  [<e0a0928b>] init_stall_timer+0x67/0x6a [uhci_hcd]
      <5>  [<c02c67a4>] process_backlog+0x6c/0xd9
      <5>  [<c02c690f>] net_rx_action+0xfe/0x1f8
      <5>  [<c012a7b1>] __do_softirq+0x35/0x79
      <5>  [<c0107efb>] handle_IRQ_event+0x0/0x4f
      <5>  [<c01094de>] do_softirq+0x46/0x4d
      
      Its an skb_over_panic BUG halt that results from processing an init chunk in
      which too many of its variable length parameters are in some way malformed.
      
      The problem is in sctp_process_unk_param:
      if (NULL == *errp)
      	*errp = sctp_make_op_error_space(asoc, chunk,
      					 ntohs(chunk->chunk_hdr->length));
      
      	if (*errp) {
      		sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM,
      				 WORD_ROUND(ntohs(param.p->length)));
      		sctp_addto_chunk(*errp,
      			WORD_ROUND(ntohs(param.p->length)),
      				  param.v);
      
      When we allocate an error chunk, we assume that the worst case scenario requires
      that we have chunk_hdr->length data allocated, which would be correct nominally,
      given that we call sctp_addto_chunk for the violating parameter.  Unfortunately,
      we also, in sctp_init_cause insert a sctp_errhdr_t structure into the error
      chunk, so the worst case situation in which all parameters are in violation
      requires chunk_hdr->length+(sizeof(sctp_errhdr_t)*param_count) bytes of data.
      
      The result of this error is that a deliberately malformed packet sent to a
      listening host can cause a remote DOS, described in CVE-2010-1173:
      http://cve.mitre.org/cgi-bin/cvename.cgi?name=2010-1173
      
      I've tested the below fix and confirmed that it fixes the issue.  We move to a
      strategy whereby we allocate a fixed size error chunk and ignore errors we don't
      have space to report.  Tested by me successfully
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.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>
      4a1a39a8
    • Steven Whitehouse's avatar
      GFS2: Fix permissions checking for setflags ioctl() · 644e1e43
      Steven Whitehouse authored
      commit 7df0e039 upstream.
      
      We should be checking for the ownership of the file for which
      flags are being set, rather than just for write access.
      Reported-by: default avatarDan Rosenberg <dan.j.rosenberg@gmail.com>
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      644e1e43
    • Grazvydas Ignotas's avatar
      wl1251: fix a memory leak in probe · 6e3312e2
      Grazvydas Ignotas authored
      commit aa679c36 upstream.
      
      wl1251_sdio_probe() error path is missing wl1251_free_hw, add it.
      Signed-off-by: default avatarGrazvydas Ignotas <notasas@gmail.com>
      Acked-by: default avatarKalle Valo <kvalo@adurom.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6e3312e2