1. 05 2月, 2010 3 次提交
  2. 04 2月, 2010 3 次提交
  3. 03 2月, 2010 34 次提交
    • T
      futex: Handle futex value corruption gracefully · 59647b6a
      Thomas Gleixner 提交于
      The WARN_ON in lookup_pi_state which complains about a mismatch
      between pi_state->owner->pid and the pid which we retrieved from the
      user space futex is completely bogus.
      
      The code just emits the warning and then continues despite the fact
      that it detected an inconsistent state of the futex. A conveniant way
      for user space to spam the syslog.
      
      Replace the WARN_ON by a consistency check. If the values do not match
      return -EINVAL and let user space deal with the mess it created.
      
      This also fixes the missing task_pid_vnr() when we compare the
      pi_state->owner pid with the futex value.
      Reported-by: NJermome Marchand <jmarchan@redhat.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NDarren Hart <dvhltc@us.ibm.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      59647b6a
    • T
      futex: Handle user space corruption gracefully · 51246bfd
      Thomas Gleixner 提交于
      If the owner of a PI futex dies we fix up the pi_state and set
      pi_state->owner to NULL. When a malicious or just sloppy programmed
      user space application sets the futex value to 0 e.g. by calling
      pthread_mutex_init(), then the futex can be acquired again. A new
      waiter manages to enqueue itself on the pi_state w/o damage, but on
      unlock the kernel dereferences pi_state->owner and oopses.
      
      Prevent this by checking pi_state->owner in the unlock path. If
      pi_state->owner is not current we know that user space manipulated the
      futex value. Ignore the mess and return -EINVAL.
      
      This catches the above case and also the case where a task hijacks the
      futex by setting the tid value and then tries to unlock it.
      Reported-by: NJermome Marchand <jmarchan@redhat.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NDarren Hart <dvhltc@us.ibm.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      51246bfd
    • M
      futex_lock_pi() key refcnt fix · 5ecb01cf
      Mikael Pettersson 提交于
      This fixes a futex key reference count bug in futex_lock_pi(),
      where a key's reference count is incremented twice but decremented
      only once, causing the backing object to not be released.
      
      If the futex is created in a temporary file in an ext3 file system,
      this bug causes the file's inode to become an "undead" orphan,
      which causes an oops from a BUG_ON() in ext3_put_super() when the
      file system is unmounted. glibc's test suite is known to trigger this,
      see <http://bugzilla.kernel.org/show_bug.cgi?id=14256>.
      
      The bug is a regression from 2.6.28-git3, namely Peter Zijlstra's
      38d47c1b "[PATCH] futex: rely on
      get_user_pages() for shared futexes". That commit made get_futex_key()
      also increment the reference count of the futex key, and updated its
      callers to decrement the key's reference count before returning.
      Unfortunately the normal exit path in futex_lock_pi() wasn't corrected:
      the reference count is incremented by get_futex_key() and queue_lock(),
      but the normal exit path only decrements once, via unqueue_me_pi().
      The fix is to put_futex_key() after unqueue_me_pi(), since 2.6.31
      this is easily done by 'goto out_put_key' rather than 'goto out'.
      Signed-off-by: NMikael Pettersson <mikpe@it.uu.se>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NDarren Hart <dvhltc@us.ibm.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: <stable@kernel.org>
      5ecb01cf
    • S
      microblaze: fix interrupt state restore · 58424a49
      Steven J. Magnani 提交于
      Interrupts must be disabled while an interrupt state restore
      (prep for interrupt return) is in progress.
      Code to do this was lost in the port to the mainline kernel.
      Signed-off-by: NSteven J. Magnani <steve@digidescorp.com>
      Signed-off-by: NMichal Simek <monstr@monstr.eu>
      58424a49
    • S
      GFS2: Extend umount wait coverage to full glock lifetime · 8f05228e
      Steven Whitehouse 提交于
      Although all glocks are, by the time of the umount glock wait,
      scheduled for demotion, some of them haven't made it far
      enough through the process for the original set of waiting
      code to wait for them.
      
      This extends the ref count to the whole glock lifetime in order
      to ensure that the waiting does catch all glocks. It does make
      it a bit more invasive, but it seems the only sensible solution
      at the moment.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      8f05228e
    • S
      GFS2: Wait for unlock completion on umount · e402746a
      Steven Whitehouse 提交于
      This patch adds a wait on umount between the point at which we
      dispose of all glocks and the point at which we unmount the
      lock protocol. This ensures that we've received all the replies
      to our unlock requests before we stop the locking.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      Reported-by: NFabio M. Di Nitto <fdinitto@redhat.com>
      e402746a
    • M
      microblaze: Defconfig update · 7823860c
      Michal Simek 提交于
      There were several changes in Microblaze defconfig that's why
      is good to update defconfigs.
      Signed-off-by: NMichal Simek <monstr@monstr.eu>
      7823860c
    • L
      c80d292f
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 2a2a5660
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (23 commits)
        connector: Delete buggy notification code.
        be2net: use eq-id to calculate cev-isr reg offset
        Bluetooth: Use the control channel for raw HID reports
        Bluetooth: Add DFU driver for Atheros Bluetooth chipset AR3011
        Bluetooth: Redo checks in IRQ handler for shared IRQ support
        Bluetooth: Fix memory leak in L2CAP
        Bluetooth: Remove double free of SKB pointer in L2CAP
        cdc_ether: Partially revert "usbnet: Set link down initially ..."
        be2net: Fix memset() arg ordering.
        bonding: bond_open error return value
        ixgbe: if ixgbe_copy_dcb_cfg is going to fail learn about it early
        ixgbe: set the correct DCB bit for pg tx settings
        igbvf: fix issue w/ mapped_as_page being left set after unmap
        drivers/net: ks8851_mll ethernet network driver
        be2net: Bug fix to support newer generation of BE ASIC
        starfire: clean up properly if firmware loading fails
        mac80211: fix NULL pointer dereference when ftrace is enabled
        netfilter: ctnetlink: fix expectation mask dump
        ipv6: conntrack: Add member of user to nf_ct_frag6_queue structure
        ath9k: fix eeprom INI values override for 2GHz-only cards
        ...
      2a2a5660
    • T
      pktcdvd: removing device does not remove its sysfs dir · ca0bf64d
      Thadeu Lima de Souza Cascardo 提交于
      This is the counterpart to cba76717
      ("pktcdvd: remove broken dev_t export of class devices").  Device is not
      registered using dev_t, so it should not be destroyed using device_destroy
      which looks up the device by dev_t.  This will fail and adding the device
      again will fail with the "duplicate name" error.  This is fixed using
      device_unregister instead of device_destroy.
      Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Peter Osterlund <petero2@telia.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ca0bf64d
    • S
      memory hotplug: fix a bug on /dev/mem for 64-bit kernels · ea085417
      Shaohui Zheng 提交于
      Newly added memory can not be accessed via /dev/mem, because we do not
      update the variables high_memory, max_pfn and max_low_pfn.
      
      Add a function update_end_of_memory_vars() to update these variables for
      64-bit kernels.
      
      [akpm@linux-foundation.org: simplify comment]
      Signed-off-by: NShaohui Zheng <shaohui.zheng@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Li Haicheng <haicheng.li@intel.com>
      Reviewed-by: NWu Fengguang <fengguang.wu@intel.com>
      Reviewed-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ea085417
    • A
      fault injection: correct function names in documentation · a225a5cc
      Anton Blanchard 提交于
      init_fault_attr_entries() should be init_fault_attr_dentries().
      
      cleanup_fault_attr_entries() should be cleanup_fault_attr_dentries().
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Acked-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a225a5cc
    • J
      hugetlb: fix section mismatches · 094e9539
      Jeff Mahoney 提交于
      hugetlb_sysfs_add_hstate is called by hugetlb_register_node directly
      during init and also indirectly via sysfs after init.
      
      This patch removes the __init tag from hugetlb_sysfs_add_hstate.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      094e9539
    • R
      uartlite: fix crash when using as console · 03eac7bb
      Richard Röjfors 提交于
      Move the ulite_console_setup to the .devinit section since it might be
      called on probe, which is in devinit.  Fixes the crash below where the
      uartlite hw is probed after the .init section is freed from the kernel.
      
      uartlite: ttyUL0 at MMIO 0xc8000100 (irq = 30) is a uartlite
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: [<c176720e>] ulite_console_setup+0x6f/0xa8
      *pdpt = 0000000036fb0001 *pde = 0000000000000000
      Oops: 0000 [#1] PREEMPT SMP
      last sysfs file: /sys/devices/pci0000:00/0000:00:1f.1/host0/uevent
      Modules linked in: puffin(+) serio_raw
      
      Pid: 151, comm: modprobe Not tainted (2.6.31.5-1.0.b1-b1 #1) POULSBO
      EIP: 0060:[<c176720e>] EFLAGS: 00010246 CPU: 0
      EIP is at ulite_console_setup+0x6f/0xa8
      EAX: c16ec824 EBX: c16ec824 ECX: c176719f EDX: 00000000
      ESI: 00000000 EDI: c17b42c4 EBP: f6fd1cf0 ESP: f6fd1cd8
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      Process modprobe (pid: 151, ti=f6fd0000 task=f6fa1020 task.ti=f6fd0000)
      Stack:
       c1031f51 00000000 00000000 00000246 c182237c f7742000 f6fd1d5c c11fd316
      <0> c16ec85c f77420d4 0000001e 00000000 00000000 c1633e78 4f494d4d 63783020
      <0> 30303038 00303031 f6fd1d3c c10e0786 f6fd1d48 00000000 f6fd1d48 00000000
      Call Trace:
       [<c1031f51>] ? register_console+0xf6/0x1fc
       [<c11fd316>] ? uart_add_one_port+0x237/0x2bb
       [<c10e0786>] ? sysfs_add_one+0x13/0xd3
       [<c10e142f>] ? sysfs_do_create_link+0xba/0xfc
       [<c146f200>] ? ulite_probe+0x198/0x1eb
       [<c12064ee>] ? platform_drv_probe+0xc/0xe
       [<c120597b>] ? driver_probe_device+0x79/0x105
       [<c1205a8e>] ? __device_attach+0x28/0x30
       [<c120511f>] ? bus_for_each_drv+0x3d/0x67
       [<c1205af9>] ? device_attach+0x44/0x58
       [<c1205a66>] ? __device_attach+0x0/0x30
       [<c1204fb8>] ? bus_probe_device+0x1f/0x34
       [<c1203e68>] ? device_add+0x385/0x4c0
       [<c148491f>] ? _write_unlock+0x8/0x1f
       [<c1206aac>] ? platform_device_add+0xd9/0x11c
       [<c120c685>] ? mfd_add_devices+0x165/0x1bc
       [<f831b378>] ? puffin_probe+0x2d0/0x390 [puffin]
       [<c11a08ef>] ? pci_match_device+0xa0/0xa7
       [<c11a07bc>] ? local_pci_probe+0xe/0x10
       [<c11a11db>] ? pci_device_probe+0x43/0x66
       [<c120597b>] ? driver_probe_device+0x79/0x105
       [<c1205a4a>] ? __driver_attach+0x43/0x5f
       [<c120535d>] ? bus_for_each_dev+0x3d/0x67
       [<c1205852>] ? driver_attach+0x14/0x16
       [<c1205a07>] ? __driver_attach+0x0/0x5f
       [<c1204dea>] ? bus_add_driver+0xf9/0x220
       [<c1205c8f>] ? driver_register+0x8b/0xeb
       [<c11a1518>] ? __pci_register_driver+0x43/0x9f
       [<c10477ef>] ? __blocking_notifier_call_chain+0x40/0x4c
       [<f831f000>] ? puffin_init+0x0/0x48 [puffin]
       [<f831f017>] ? puffin_init+0x17/0x48 [puffin]
       [<c1001139>] ? do_one_initcall+0x4c/0x131
       [<c105607b>] ? sys_init_module+0xa7/0x1b7
       [<c1002a61>] ? syscall_call+0x7/0xb
       Code: 6e 74 00 00 00 92 33 00 00 18 00 0e 01 73 79 6e 63 65 2d 72 65 67 69 73 74 72 79 0c 00 49 32
      00 00 14 00 09 01 61 6c 73 61 2d 69 <6e> 66 6f 00 00 00 42 37 00 00 10 00 07 01 6b 69 6c 6c 61 6c 6c
      EIP: [<c176720e>] ulite_console_setup+0x6f/0xa8 SS:ESP 0068:f6fd1cd8
      CR2: 0000000000000000
      Signed-off-by: NRichard Röjfors <richard.rojfors@pelagicore.com>
      Acked-by: NPeter Korsgaard <jacmet@sunsite.dk>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      03eac7bb
    • U
      imxfb: correct location of callbacks in suspend and resume · 1ec56203
      Uwe Kleine-König 提交于
      The probe function passes a pointer to a struct fb_info to
      platform_set_drvdata(), so don't interpret the return value of
      platform_get_drvdata() as a pointer to struct imxfb_info.
      
      The original imxfb_info *fbi backlight_power was NULL but in imxfb_suspend
      it was 4 resulting in an oops as imxfb_suspend calls
      imxfb_disable_controller(fbi) which in turn has
      
      	if (fbi->backlight_power)
      			fbi->backlight_power(0);
      Signed-off-by: NUwe Kleine-König  <u.kleine-koenig@pengutronix.de>
      Acked-by: NSascha Hauer <kernel@pengutronix.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1ec56203
    • L
      cgroups: fix to return errno in a failure path · 4528fd05
      Li Zefan 提交于
      In cgroup_create(), if alloc_css_id() returns failure, the errno is not
      propagated to userspace, so mkdir will fail silently.
      
      To trigger this bug, we mount blkio (or memory subsystem), and create more
      then 65534 cgroups.  (The number of cgroups is limited to 65535 if a
      subsystem has use_id == 1)
      
       # mount -t cgroup -o blkio xxx /mnt
       # for ((i = 0; i < 65534; i++)); do mkdir /mnt/$i; done
       # mkdir /mnt/65534
       (should return ENOSPC)
       #
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Acked-by: NPaul Menage <menage@google.com>
      Acked-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4528fd05
    • H
      markup_oops.pl: fix $func_offset error with x86_64 · ef2b9b05
      Hui Zhu 提交于
      When I use markup_oops.pl parse a x8664 oops, I got:
      
      objdump: --start-address: bad number: NaN
      No matching code found
      This is because:
      main::(./m.pl:228):	open(FILE, "objdump -dS --adjust-vma=$vmaoffset --start-address=$decodestart --stop-address=$decodestop $filename |") || die "Cannot start objdump";
        DB<3> p $decodestart
      NaN
      
      This NaN is from:
      main::(./m.pl:176):	my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset");
        DB<2> p $func_offset
      0x175
      
      There is already a "0x" in $func_offset, another 0x makes it a NaN.
      
      The $func_offset is from line:
      
      	if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\]  \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
      		$function = $1;
      		$func_offset = $2;
      	}
      
      I make a patch to change "(0x[0-9a-f]+)\/0x[a-f0-9]/)" to "0x([0-9a-f]+)\/0x[a-f0-9]/)".
      Signed-off-by: NHui Zhu <teawater@gmail.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ef2b9b05
    • R
      get_maintainer.pl: teach git log to use --no-color · 99cf6116
      Richard Kennedy 提交于
      When git has been set to always use color in .gitconfig then I get the
      warning message
      
              Bad divisor in main::vcs_assign: 0
      
      This is caused by vcs_file_signoffs not matching any commits due to the
      pattern not understand the colour codes.  Fix this by telling git log to
      never use colour.
      Signed-off-by: NRichard Kennedy <richard@rsk.demon.co.uk>
      Acked-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      99cf6116
    • W
      devmem: fix kmem write bug on memory holes · c85e9a97
      Wu Fengguang 提交于
      write_kmem() used to assume vwrite() always return the full buffer length.
      However now vwrite() could return 0 to indicate memory hole.  This
      creates a bug that "buf" is not advanced accordingly.
      
      Fix it to simply ignore the return value, hence the memory hole.
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Nick Piggin <npiggin@suse.de>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c85e9a97
    • K
      devmem: check vmalloc address on kmem read/write · 325fda71
      KAMEZAWA Hiroyuki 提交于
      Otherwise vmalloc_to_page() will BUG().
      
      This also makes the kmem read/write implementation aligned with mem(4):
      "References to nonexistent locations cause errors to be returned." Here we
      return -ENXIO (inspired by Hugh) if no bytes have been transfered to/from
      user space, otherwise return partial read/write results.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      325fda71
    • A
      mm: flush dcache before writing into page to avoid alias · 931e80e4
      anfei zhou 提交于
      The cache alias problem will happen if the changes of user shared mapping
      is not flushed before copying, then user and kernel mapping may be mapped
      into two different cache line, it is impossible to guarantee the coherence
      after iov_iter_copy_from_user_atomic.  So the right steps should be:
      
      	flush_dcache_page(page);
      	kmap_atomic(page);
      	write to page;
      	kunmap_atomic(page);
      	flush_dcache_page(page);
      
      More precisely, we might create two new APIs flush_dcache_user_page and
      flush_dcache_kern_page to replace the two flush_dcache_page accordingly.
      
      Here is a snippet tested on omap2430 with VIPT cache, and I think it is
      not ARM-specific:
      
      	int val = 0x11111111;
      	fd = open("abc", O_RDWR);
      	addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
      	*(addr+0) = 0x44444444;
      	tmp = *(addr+0);
      	*(addr+1) = 0x77777777;
      	write(fd, &val, sizeof(int));
      	close(fd);
      
      The results are not always 0x11111111 0x77777777 at the beginning as expected.  Sometimes we see 0x44444444 0x77777777.
      Signed-off-by: NAnfei <anfei.zhou@gmail.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Cc: <linux-arch@vger.kernel.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      931e80e4
    • R
      kfifo: fix kernel-doc notation · bc173f70
      Randy Dunlap 提交于
      Fix kfifo kernel-doc warnings:
      
      Warning(kernel/kfifo.c:361): No description found for parameter 'total'
      Warning(kernel/kfifo.c:402): bad line:  @ @lenout: pointer to output variable with copied data
      Warning(kernel/kfifo.c:412): No description found for parameter 'lenout'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Stefani Seibold <stefani@seibold.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bc173f70
    • S
      rtc-fm3130: add missing braces · f4b51628
      Sergey Matyukevich 提交于
      Add missing braces for multiline 'if' statements in fm3130_probe.
      Signed-off-by: NSergey Matyukevich <geomatsi@gmail.com>
      Signed-off-by: NAlessandro Zummo <a.zummo@towertech.it>
      Cc: Sergey Lapin <slapin@ossfans.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f4b51628
    • A
      mx3fb: some debug and initialisation fixes · b3cb5372
      Alberto Panizzo 提交于
      Fix the kernel oops when dev_dbg is called with mx3_fbi->txd == NULL
      
      Fix the late initialisation of mx3fb->backlight_level.  If not, in the
      chain of function started by init_fb_chan(), in __blank() call
      sdc_set_brightness(mx3fb, mx3fb->backlight_level) that will shut down the
      CONTRAST PWM output.
      Signed-off-by: NAlberto Panizzo <maramaopercheseimorto@gmail.com>
      Acked-by: Guennadi Liakhovetski <g.liakhovetski <at> gmx.de>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b3cb5372
    • T
      idr: fix a critical misallocation bug · 859ddf09
      Tejun Heo 提交于
      Eric Paris located a bug in idr.  With IDR_BITS of 6, it grows to three
      layers when id 4096 is first allocated.  When that happens, idr wraps
      incorrectly and searches the idr array ignoring the high bits.  The
      following test code from Eric demonstrates the bug nicely.
      
      #include <linux/idr.h>
      #include <linux/kernel.h>
      #include <linux/module.h>
      
      static DEFINE_IDR(test_idr);
      
      int init_module(void)
      {
      	int ret, forty95, forty96;
      	void *addr;
      
      	/* add 2 entries both with 4095 as the start address */
      again1:
      	if (!idr_pre_get(&test_idr, GFP_KERNEL))
      		return -ENOMEM;
      	ret = idr_get_new_above(&test_idr, (void *)4095, 4095, &forty95);
      	if (ret) {
      		if (ret == -EAGAIN)
      			goto again1;
      		return ret;
      	}
      	if (forty95 != 4095)
      		printk(KERN_ERR "hmmm, forty95=%d\n", forty95);
      
      again2:
      	if (!idr_pre_get(&test_idr, GFP_KERNEL))
      		return -ENOMEM;
      	ret = idr_get_new_above(&test_idr, (void *)4096, 4095, &forty96);
      	if (ret) {
      		if (ret == -EAGAIN)
      			goto again2;
      		return ret;
      	}
      	if (forty96 != 4096)
      		printk(KERN_ERR "hmmm, forty96=%d\n", forty96);
      
      	/* try to find the 2 entries, noticing that 4096 broke */
      	addr = idr_find(&test_idr, forty95);
      	if ((int)addr != forty95)
      		printk(KERN_ERR "hmmm, after find forty95=%d addr=%d\n", forty95, (int)addr);
      	addr = idr_find(&test_idr, forty96);
      	if ((int)addr != forty96)
      		printk(KERN_ERR "hmmm, after find forty96=%d addr=%d\n", forty96, (int)addr);
      	/* really weird, the entry which should be at 4096 is actually at 0!! */
      	addr = idr_find(&test_idr, 0);
      	if ((int)addr)
      		printk(KERN_ERR "found an entry at id=0 for addr=%d\n", (int)addr);
      
      	idr_remove(&test_idr, forty95);
      	idr_remove(&test_idr, forty96);
      
      	return 0;
      }
      
      void cleanup_module(void)
      {
      }
      
      MODULE_AUTHOR("Eric Paris <eparis@redhat.com>");
      MODULE_DESCRIPTION("Simple idr test");
      MODULE_LICENSE("GPL");
      
      This happens because when sub_alloc() back tracks it doesn't always do it
      step-by-step while the over-the-limit detection assumes step-by-step
      backtracking.  The logic in sub_alloc() looks like the following.
      
        restart:
          clear pa[top level + 1] for end cond detection
          l = top level
          while (true) {
      	search for empty slot at this level
      	if (not found) {
      	    push id to the next possible value
      	    l++
      A:	    if (pa[l] is clear)
      	        failed, return asking caller to grow the tree
      	    if (going up 1 level gives more slots to search)
      	        continue the while loop above with the incremented l
      	    else
      C:	        goto restart
      	}
      	adjust id accordingly to the found slot
      	if (l == 0)
      	    return found id;
      	create lower level if not there yet
      	record pa[l] and l--
          }
      
      Test A is the fail exit condition but this assumes that failure is
      propagated upwared one level at a time but the B optimization path breaks
      the assumption and restarts the whole thing with a start value which is
      above the possible limit with the current layers.  sub_alloc() assumes the
      start id value is inside the limit when called and test A is the only exit
      condition check, so it ends up searching for empty slot while ignoring
      high set bit.
      
      So, for 4095->4096 test, level0 search fails but pa[1] contains a valid
      pointer.  However, going up 1 level wouldn't give any more empty slot so
      it takes C and when the whole thing restarts nobody notices the high bit
      set beyond the top level.
      
      This patch fixes the bug by changing the fail exit condition check to full
      id limit check.
      
      Based-on-patch-from: Eric Paris <eparis@redhat.com>
      Reported-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      859ddf09
    • E
      connector: Delete buggy notification code. · f98bfbd7
      Evgeniy Polyakov 提交于
      On Tue, Feb 02, 2010 at 02:57:14PM -0800, Greg KH (gregkh@suse.de) wrote:
      > > There are at least two ways to fix it: using a big cannon and a small
      > > one. The former way is to disable notification registration, since it is
      > > not used by anyone at all. Second way is to check whether calling
      > > process is root and its destination group is -1 (kind of priveledged
      > > one) before command is dispatched to workqueue.
      > 
      > Well if no one is using it, removing it makes the most sense, right?
      > 
      > No objection from me, care to make up a patch either way for this?
      
      Getting it is not used, let's drop support for notifications about
      (un)registered events from connector.
      Another option was to check credentials on receiving, but we can always
      restore it without bugs if needed, but genetlink has a wider code base
      and none complained, that userspace can not get notification when some
      other clients were (un)registered.
      
      Kudos for Sebastian Krahmer <krahmer@suse.de>, who found a bug in the
      code.
      Signed-off-by: NEvgeniy Polyakov <zbr@ioremap.net>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f98bfbd7
    • J
      kernel/cred.c: use kmem_cache_free · b8a1d37c
      Julia Lawall 提交于
      Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather
      than kfree.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression x,E,c;
      @@
      
       x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...)
       ... when != x = E
           when != &x
      ?-kfree(x)
      +kmem_cache_free(c,x)
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Steve Dickson <steved@redhat.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      b8a1d37c
    • L
      Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block · 1a45dcfe
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.dk/linux-2.6-block:
        cfq-iosched: Do not idle on async queues
        blk-cgroup: Fix potential deadlock in blk-cgroup
        block: fix bugs in bio-integrity mempool usage
        block: fix bio_add_page for non trivial merge_bvec_fn case
        drbd: null dereference bug
        drbd: fix max_segment_size initialization
      1a45dcfe
    • N
      mm: purge fragmented percpu vmap blocks · 02b709df
      Nick Piggin 提交于
      Improve handling of fragmented per-CPU vmaps.  We previously don't free
      up per-CPU maps until all its addresses have been used and freed.  So
      fragmented blocks could fill up vmalloc space even if they actually had
      no active vmap regions within them.
      
      Add some logic to allow all CPUs to have these blocks purged in the case
      of failure to allocate a new vm area, and also put some logic to trim
      such blocks of a current CPU if we hit them in the allocation path (so
      as to avoid a large build up of them).
      
      Christoph reported some vmap allocation failures when using the per CPU
      vmap APIs in XFS, which cannot be reproduced after this patch and the
      previous bug fix.
      
      Cc: linux-mm@kvack.org
      Cc: stable@kernel.org
      Tested-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      --
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      02b709df
    • N
      mm: percpu-vmap fix RCU list walking · de560423
      Nick Piggin 提交于
      RCU list walking of the per-cpu vmap cache was broken.  It did not use
      RCU primitives, and also the union of free_list and rcu_head is
      obviously wrong (because free_list is indeed the list we are RCU
      walking).
      
      While we are there, remove a couple of unused fields from an earlier
      iteration.
      
      These APIs aren't actually used anywhere, because of problems with the
      XFS conversion.  Christoph has now verified that the problems are solved
      with these patches.  Also it is an exported interface, so I think it
      will be good to be merged now (and Christoph wants to get the XFS
      changes into their local tree).
      
      Cc: stable@kernel.org
      Cc: linux-mm@kvack.org
      Tested-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      --
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      de560423
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 489b24f2
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        random: Remove unused inode variable
        crypto: padlock-sha - Add import/export support
        random: drop weird m_time/a_time manipulation
      489b24f2
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes · 4dab75ec
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
        GFS2: Use GFP_NOFS for alloc structure
        GFS2: Fix previous patch
        GFS2: Don't withdraw on partial rindex entries
        GFS2: Fix refcnt leak on gfs2_follow_link() error path
      4dab75ec
    • L
      Merge branch 'sh/for-2.6.33' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 · 7fbcca25
      Linus Torvalds 提交于
      * 'sh/for-2.6.33' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
        sh: Fix access to released memory in clk_debugfs_register_one()
        sh: Fix access to released memory in dwarf_unwinder_cleanup()
        usb: r8a66597-hdc disable interrupts fix
        spi: spi_sh_msiof: Fixed data sampling on the correct edge
      7fbcca25
    • L
      Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus · e770a0f1
      Linus Torvalds 提交于
      * 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
        MIPS: 64-bit: Detect virtual memory size
        MIPS: AR7: Fix USB slave mem range typo
        MIPS: Alchemy: Fix dbdma ring destruction memory debugcheck.
      e770a0f1