1. 19 Nov, 2008 20 commits
    • Glauber Costa's avatar
      mm: vmalloc search restart fix · 0ae15132
      Glauber Costa authored
      Current vmalloc restart search for a free area in case we can't find one.
      The reason is there are areas which are lazily freed, and could be
      possibly freed now.  However, current implementation start searching the
      tree from the last failing address, which is pretty much by definition at
      the end of address space.  So, we fail.
      The proposal of this patch is to restart the search from the beginning of
      the requested vstart address.  This fixes the regression in running KVM
      virtual machines for me, described in http://lkml.org/lkml/2008/10/28/349,
      caused by commit db64fe02
      Signed-off-by: default avatarGlauber Costa <glommer@redhat.com>
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Nick Piggin's avatar
      mm: vmalloc failure flush fix · 496850e5
      Nick Piggin authored
      An initial vmalloc failure should start off a synchronous flush of lazy
      areas, in case someone is in progress flushing them already, which could
      cause us to return an allocation failure even if there is plenty of KVA
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Nick Piggin's avatar
      mm: vmalloc allocator off by one · f011c2da
      Nick Piggin authored
      Fix off by one bug in the KVA allocator that can leave gaps in the address
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Miao Xie's avatar
      cpuset: update top cpuset's mems after adding a node · f481891f
      Miao Xie authored
      After adding a node into the machine, top cpuset's mems isn't updated.
      By reviewing the code, we found that the update function
      was invoked after node_states[N_ONLINE] changes.  It is wrong because
      N_ONLINE just means node has pgdat, and if node has/added memory, we use
      N_HIGH_MEMORY.  So, We should invoke the update function after
      node_states[N_HIGH_MEMORY] changes, just like its commit says.
      This patch fixes it.  And we use notifier of memory hotplug instead of
      direct calling of cpuset_track_online_nodes().
      Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
      Acked-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Paul Menage <menage@google.com
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Michael Halcrow's avatar
      eCryptfs: Allocate up to two scatterlists for crypto ops on keys · ac97b9f9
      Michael Halcrow authored
      I have received some reports of out-of-memory errors on some older AMD
      architectures.  These errors are what I would expect to see if
      crypt_stat->key were split between two separate pages.  eCryptfs should
      not assume that any of the memory sent through virt_to_scatterlist() is
      all contained in a single page, and so this patch allocates two
      scatterlist structs instead of one when processing keys.  I have received
      confirmation from one person affected by this bug that this patch resolves
      the issue for him, and so I am submitting it for inclusion in a future
      stable release.
      Note that virt_to_scatterlist() runs sg_init_table() on the scatterlist
      structs passed to it, so the calls to sg_init_table() in
      decrypt_passphrase_encrypted_session_key() are redundant.
      Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
      Reported-by: default avatarPaulo J. S. Silva <pjssilva@ime.usp.br>
      Cc: "Leon Woestenberg" <leon.woestenberg@gmail.com>
      Cc: Tim Gardner <tim.gardner@canonical.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Andrea Paterniani's avatar
      spi_imx: full duplex dma corruption bugfix · 3b45d638
      Andrea Paterniani authored
      Fix unsafe order in dma mapping operation: always flush data from the
      cache *BEFORE* invalidating it, to allow full duplex transfers where the
      same buffer may be used for both writes and reads.
      Signed-off-by: default avatarAndrea Paterniani <a.paterniani@swapp-eng.it>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Ben Dooks's avatar
      lcd: fix oops if driver only interested in .set_power · b3b4dc88
      Ben Dooks authored
      The LCD driver core calls LCD drivers when either the blanking state or
      the display mode has changed, but does not make any check to see if the
      called driver has a .set_mode method.
      This means if a driver only has a .set_power method then the system will
      OOPS on changing mode (and with the console semaphore held so you cannot
      easily see the problem).
      Fix the problem by ensuring that either callback is valid before use.
      Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Bruno Prémont's avatar
      viafb: fix releasing of /proc/viafb/ subtree · c267fd77
      Bruno Prémont authored
      When unloading viafb module it does not remove it's /proc/viafb/ subtree
      which causes multiple viafb directories to appear below proc when
      mobprobing viafb and also lets kernel WARN() on duplicate proc entries:
      [  145.458387] WARNING: at /usr/src/linux-2.6.28-rc3-git6/fs/proc/generic.c:551 proc_register+0xe6/0x160()
      [  145.458945] proc_dir_entry '/proc/viafb' already registered
      [  145.459278] Modules linked in: viafb(+) i2c_algo_bit cfbcopyarea cfbimgblt cfbfillrect snd_hda_intel snd_pcm snd_timer snd soundcore snd_page_alloc sg via_agp agpgart [last unloaded: drm]
      [  145.460647] Pid: 1904, comm: modprobe Tainted: G        W  2.6.28-rc3-git6 #4
      [  145.461064] Call Trace:
      [  145.461248]  [<c01066f1>] ? dump_stack+0x1/0x80
      [  145.461533]  [<c01228a3>] warn_slowpath+0x63/0x80
      [  145.461851]  [<c0253ec9>] ? idr_get_empty_slot+0xe9/0x250
      [  145.462186]  [<c0254120>] ? ida_get_new_above+0xf0/0x150
      [  145.462528]  [<c019fb86>] proc_register+0xe6/0x160
      [  145.462827]  [<c019fdc6>] proc_mkdir_mode+0x36/0x50
      [  145.463135]  [<c019fdef>] proc_mkdir+0xf/0x20
      [  145.463457]  [<f807173c>] viafb_init+0x73c/0xc86 [viafb]
      [  145.463823]  [<f8071000>] ? viafb_init+0x0/0xc86 [viafb]
      [  145.464147]  [<c010111d>] do_one_initcall+0x2d/0x160
      [  145.464460]  [<c01a6543>] ? sysfs_add_file+0x13/0x20
      [  145.464786]  [<c015f031>] ? vfree+0x21/0x30
      [  145.465049]  [<c01433b5>] ? load_module+0x1215/0x1500
      [  145.465381]  [<c014e455>] ? __alloc_pages_internal+0x95/0x400
      [  145.465755]  [<c0143723>] sys_init_module+0x83/0x1a0
      [  145.466065]  [<c016ceed>] ? sys_read+0x3d/0x70
      [  145.466354]  [<c0103bc1>] sysenter_do_call+0x12/0x25
      [  145.466653] ---[ end trace c84b37826e16748c ]---
      Signed-off-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Cc: <JosephChan@via.com.tw>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Ned Forrester's avatar
      pxa2xx_spi: bugfix full duplex dma data corruption · 393df744
      Ned Forrester authored
      Fixes a data corruption bug in pxa2xx_spi.c when operating in full duplex
      mode with DMA and using buffers that overlap.
      SPI transmit and receive buffers are allowed to be the same or to overlap.
       However, this driver fails if such overlap is attempted in DMA mode
      because it maps the rx and tx buffers in the wrong order.  By mapping
      DMA_FROM_DEVICE (read) before DMA_TO_DEVICE (write), it invalidates the
      cache before flushing it, thus discarding data which should have been
      The patch corrects the order of mapping.  This bug exists in all versions
      of pxa2xx_spi.c; similar bugs are in the drivers for two other SPI
      controllers (au1500, imx).
      A version of this patch has been tested on kernel 2.6.20 using
      verification of loopback data with: random transfer length, random
      bits-per-word, random positive offsets (both larger and smaller than
      transfer length) between the start of the rx and tx buffers, and varying
      clock rates.
      Signed-off-by: default avatarNed Forrester <nforrester@whoi.edu>
      Cc: Vernon Sauder <vernoninhand@gmail.com>
      Cc: J. Scott Merritt <merrij3@rpi.edu>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: <stable@kernel.org>		[2.6.27.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Arjan van de Ven's avatar
      lib/scatterlist.c: fix kunmap() argument in sg_miter_stop() · f652c521
      Arjan van de Ven authored
      kunmap() takes as argument the struct page that orginally got kmap()'d,
      however the sg_miter_stop() function passed it the kernel virtual address
      instead, resulting in weird stuff.
      Somehow I ended up fixing this bug by accident while looking for a bug in
      the same area.
      Reported-by: kerneloops.org
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Cc: Hugh Dickins <hugh@veritas.com>
      Cc: <stable@kernel.org>		[2.6.27.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Dmitry Baryshkov's avatar
      tmiofb: fix compilation with ACCEL disabled · a495a6d3
      Dmitry Baryshkov authored
      Restore support for compiling tmiofb with acceleration disabled.
      Signed-off-by: default avatarDmitry Baryshkov <dbaryshkov@gmail.com>
      Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Jack Steiner's avatar
      GRU: fix for debug option · 415d8cfa
      Jack Steiner authored
      Enable -D DEBUG in the GRU Makefile if CONFIG_SGI_GRU_DEBUG is selected.
      Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Jarkko Nikula's avatar
      gpiolib: extend gpio label column width in debugfs file · 6e8ba729
      Jarkko Nikula authored
      There are already various drivers having bigger label than 12 bytes.  Most
      of them fit well under 20 bytes but make column width exact so that
      oversized labels don't mess up output alignment.
      Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@nokia.com>
      Acked-by: default avatarDavid Brownell <david-b@pacbell.net>
      Cc: <stable@kernel.org>		[2.6.26.x, 2.6.26.x, 2.6.27.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Randy Dunlap's avatar
      Documentation/kernel-parameters.txt: add min_addr, fix max_addr · 1c207f95
      Randy Dunlap authored
      Add "min_addr" documentation.
      For "max_addr", add nn before [KMG] since a number is needed and this
      is consistent with other uses of [KMG].
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • David Miller's avatar
      sparc64: wire up accept4() · f8b2256e
      David Miller authored
      This adds the sparc syscall hookups.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Ulrich Drepper's avatar
      reintroduce accept4 · de11defe
      Ulrich Drepper authored
      Introduce a new accept4() system call.  The addition of this system call
      matches analogous changes in 2.6.27 (dup3(), evenfd2(), signalfd4(),
      inotify_init1(), epoll_create1(), pipe2()) which added new system calls
      that differed from analogous traditional system calls in adding a flags
      argument that can be used to access additional functionality.
      The accept4() system call is exactly the same as accept(), except that
      it adds a flags bit-mask argument.  Two flags are initially implemented.
      (Most of the new system calls in 2.6.27 also had both of these flags.)
      SOCK_CLOEXEC causes the close-on-exec (FD_CLOEXEC) flag to be enabled
      for the new file descriptor returned by accept4().  This is a useful
      security feature to avoid leaking information in a multithreaded
      program where one thread is doing an accept() at the same time as
      another thread is doing a fork() plus exec().  More details here:
       "Secure File Descriptor Handling",
      Ulrich Drepper).
      The other flag is SOCK_NONBLOCK, which causes the O_NONBLOCK flag
      to be enabled on the new open file description created by accept4().
      (This flag is merely a convenience, saving the use of additional calls
      fcntl(F_GETFL) and fcntl (F_SETFL) to achieve the same result.
      Here's a test program.  Works on x86-32.  Should work on x86-64, but
      I (mtk) don't have a system to hand to test with.
      It tests accept4() with each of the four possible combinations of
      SOCK_CLOEXEC and SOCK_NONBLOCK set/clear in 'flags', and verifies
      that the appropriate flags are set on the file descriptor/open file
      description returned by accept4().
      I tested Ulrich's patch in this thread by applying against 2.6.28-rc2,
      and it passes according to my test program.
      /* test_accept4.c
        Copyright (C) 2008, Linux Foundation, written by Michael Kerrisk
        Licensed under the GNU GPLv2 or later.
      #define _GNU_SOURCE
      #include <unistd.h>
      #include <sys/syscall.h>
      #include <sys/socket.h>
      #include <netinet/in.h>
      #include <stdlib.h>
      #include <fcntl.h>
      #include <stdio.h>
      #include <string.h>
      #define PORT_NUM 33333
      #define die(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
      /* The following is what we need until glibc gets a wrapper for
        accept4() */
      /* Flags for socket(), socketpair(), accept4() */
      #ifndef SOCK_CLOEXEC
      #define SOCK_CLOEXEC    O_CLOEXEC
      #ifndef SOCK_NONBLOCK
      #ifdef __x86_64__
      #define SYS_accept4 288
      #elif __i386__
      #define USE_SOCKETCALL 1
      #define SYS_ACCEPT4 18
      #error "Sorry -- don't know the syscall # on this architecture"
      static int
      accept4(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
         printf("Calling accept4(): flags = %x", flags);
         if (flags != 0) {
             printf(" (");
             if (flags & SOCK_CLOEXEC)
             if ((flags & SOCK_CLOEXEC) && (flags & SOCK_NONBLOCK))
                 printf(" ");
             if (flags & SOCK_NONBLOCK)
         long args[6];
         args[0] = fd;
         args[1] = (long) sockaddr;
         args[2] = (long) addrlen;
         args[3] = flags;
         return syscall(SYS_socketcall, SYS_ACCEPT4, args);
         return syscall(SYS_accept4, fd, sockaddr, addrlen, flags);
      static int
      do_test(int lfd, struct sockaddr_in *conn_addr,
             int closeonexec_flag, int nonblock_flag)
         int connfd, acceptfd;
         int fdf, flf, fdf_pass, flf_pass;
         struct sockaddr_in claddr;
         socklen_t addrlen;
         connfd = socket(AF_INET, SOCK_STREAM, 0);
         if (connfd == -1)
         if (connect(connfd, (struct sockaddr *) conn_addr,
                     sizeof(struct sockaddr_in)) == -1)
         addrlen = sizeof(struct sockaddr_in);
         acceptfd = accept4(lfd, (struct sockaddr *) &claddr, &addrlen,
                            closeonexec_flag | nonblock_flag);
         if (acceptfd == -1) {
             return 0;
         fdf = fcntl(acceptfd, F_GETFD);
         if (fdf == -1)
         fdf_pass = ((fdf & FD_CLOEXEC) != 0) ==
                    ((closeonexec_flag & SOCK_CLOEXEC) != 0);
         printf("Close-on-exec flag is %sset (%s); ",
                 (fdf & FD_CLOEXEC) ? "" : "not ",
                 fdf_pass ? "OK" : "failed");
         flf = fcntl(acceptfd, F_GETFL);
         if (flf == -1)
         flf_pass = ((flf & O_NONBLOCK) != 0) ==
                    ((nonblock_flag & SOCK_NONBLOCK) !=0);
         printf("nonblock flag is %sset (%s)\n",
                 (flf & O_NONBLOCK) ? "" : "not ",
                 flf_pass ? "OK" : "failed");
         printf("Test result: %s\n", (fdf_pass && flf_pass) ? "PASS" : "FAIL");
         return fdf_pass && flf_pass;
      static int
      create_listening_socket(int port_num)
         struct sockaddr_in svaddr;
         int lfd;
         int optval;
         memset(&svaddr, 0, sizeof(struct sockaddr_in));
         svaddr.sin_family = AF_INET;
         svaddr.sin_addr.s_addr = htonl(INADDR_ANY);
         svaddr.sin_port = htons(port_num);
         lfd = socket(AF_INET, SOCK_STREAM, 0);
         if (lfd == -1)
         optval = 1;
         if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, &optval,
                        sizeof(optval)) == -1)
         if (bind(lfd, (struct sockaddr *) &svaddr,
                  sizeof(struct sockaddr_in)) == -1)
         if (listen(lfd, 5) == -1)
         return lfd;
      main(int argc, char *argv[])
         struct sockaddr_in conn_addr;
         int lfd;
         int port_num;
         int passed;
         passed = 1;
         port_num = (argc > 1) ? atoi(argv[1]) : PORT_NUM;
         memset(&conn_addr, 0, sizeof(struct sockaddr_in));
         conn_addr.sin_family = AF_INET;
         conn_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
         conn_addr.sin_port = htons(port_num);
         lfd = create_listening_socket(port_num);
         if (!do_test(lfd, &conn_addr, 0, 0))
             passed = 0;
         if (!do_test(lfd, &conn_addr, SOCK_CLOEXEC, 0))
             passed = 0;
         if (!do_test(lfd, &conn_addr, 0, SOCK_NONBLOCK))
             passed = 0;
         if (!do_test(lfd, &conn_addr, SOCK_CLOEXEC, SOCK_NONBLOCK))
             passed = 0;
         exit(passed ? EXIT_SUCCESS : EXIT_FAILURE);
      [mtk.manpages@gmail.com: rewrote changelog, updated test program]
      Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
      Tested-by: default avatarMichael Kerrisk <mtk.manpages@gmail.com>
      Acked-by: default avatarMichael Kerrisk <mtk.manpages@gmail.com>
      Cc: <linux-api@vger.kernel.org>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Clemens Ladisch's avatar
      fbdev: clean the penguin's dirty feet · cf7ee554
      Clemens Ladisch authored
      When booting in a direct color mode, the penguin has dirty feet, i.e.,
      some pixels have the wrong color.  This is caused by
      fb_set_logo_directpalette() which does not initialize the last 32 palette
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Nadia Derbey's avatar
      sysvipc: fix the ipc structures initialization · e00b4ff7
      Nadia Derbey authored
      A problem was found while reviewing the code after Bugzilla bug
      In ipc_addid(), the newly allocated ipc structure is inserted into the
      ipcs tree (i.e made visible to readers) without locking it.  This is not
      correct since its initialization continues after it has been inserted in
      the tree.
      This patch moves the ipc structure lock initialization + locking before
      the actual insertion.
      Signed-off-by: default avatarNadia Derbey <Nadia.Derbey@bull.net>
      Reported-by: default avatarClement Calmels <cboulte@gmail.com>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: <stable@kernel.org>		[2.6.27.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Julien Brunel's avatar
      drivers/video: bad error test before a dereference · cf7b9a1e
      Julien Brunel authored
      The error test that follows the call to backlight_device_register semms
      not to concern the right variable.
      A simplified version of the semantic match that finds this problem is
      as follows:
      // <smpl>
      expression x;
      position p0;
      x@p0 = backlight_device_register(...)
      expression def0.x,E;
      position def0.p0;
      position p;
      statement S;
      ... when != x = E
      if (!IS_ERR(x) && ...) {<... x@p ...>} else S
      expression def0.x;
      identifier fld;
      position def0.p0;
      position p != protected.p;
      ... when != x = E
      * x@p->fld
      // </smpl>
      Signed-off-by: default avatarJulien Brunel <brunel@diku.dk>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Henrik Rydberg's avatar
      hwmon: applesmc: Add support for iMac 6 · 9ca791bb
      Henrik Rydberg authored
      Add temperature sensor support for iMac 6.
      Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
      Tested-by: default avatarCaleb Hyde <caleb.hyde@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  2. 18 Nov, 2008 20 commits