1. 20 11月, 2008 7 次提交
    • R
      Documentation/kernel-parameters.txt: add min_addr, fix max_addr · 1c207f95
      Randy Dunlap 提交于
      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: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1c207f95
    • D
      sparc64: wire up accept4() · f8b2256e
      David Miller 提交于
      This adds the sparc syscall hookups.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f8b2256e
    • U
      reintroduce accept4 · de11defe
      Ulrich Drepper 提交于
      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:
      http://udrepper.livejournal.com/20407.html "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
             <mtk.manpages@gmail.com>
      
        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
      #endif
      #ifndef SOCK_NONBLOCK
      #define SOCK_NONBLOCK   O_NONBLOCK
      #endif
      
      #ifdef __x86_64__
      #define SYS_accept4 288
      #elif __i386__
      #define USE_SOCKETCALL 1
      #define SYS_ACCEPT4 18
      #else
      #error "Sorry -- don't know the syscall # on this architecture"
      #endif
      
      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)
                 printf("SOCK_CLOEXEC");
             if ((flags & SOCK_CLOEXEC) && (flags & SOCK_NONBLOCK))
                 printf(" ");
             if (flags & SOCK_NONBLOCK)
                 printf("SOCK_NONBLOCK");
             printf(")");
         }
         printf("\n");
      
      #if USE_SOCKETCALL
         long args[6];
      
         args[0] = fd;
         args[1] = (long) sockaddr;
         args[2] = (long) addrlen;
         args[3] = flags;
      
         return syscall(SYS_socketcall, SYS_ACCEPT4, args);
      #else
         return syscall(SYS_accept4, fd, sockaddr, addrlen, flags);
      #endif
      }
      
      /**********************************************************************/
      
      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;
      
         printf("=======================================\n");
      
         connfd = socket(AF_INET, SOCK_STREAM, 0);
         if (connfd == -1)
             die("socket");
         if (connect(connfd, (struct sockaddr *) conn_addr,
                     sizeof(struct sockaddr_in)) == -1)
             die("connect");
      
         addrlen = sizeof(struct sockaddr_in);
         acceptfd = accept4(lfd, (struct sockaddr *) &claddr, &addrlen,
                            closeonexec_flag | nonblock_flag);
         if (acceptfd == -1) {
             perror("accept4()");
             close(connfd);
             return 0;
         }
      
         fdf = fcntl(acceptfd, F_GETFD);
         if (fdf == -1)
             die("fcntl:F_GETFD");
         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)
             die("fcntl:F_GETFD");
         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");
      
         close(acceptfd);
         close(connfd);
      
         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)
             die("socket");
      
         optval = 1;
         if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, &optval,
                        sizeof(optval)) == -1)
             die("setsockopt");
      
         if (bind(lfd, (struct sockaddr *) &svaddr,
                  sizeof(struct sockaddr_in)) == -1)
             die("bind");
      
         if (listen(lfd, 5) == -1)
             die("listen");
      
         return lfd;
      }
      
      int
      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;
      
         close(lfd);
      
         exit(passed ? EXIT_SUCCESS : EXIT_FAILURE);
      }
      
      [mtk.manpages@gmail.com: rewrote changelog, updated test program]
      Signed-off-by: NUlrich Drepper <drepper@redhat.com>
      Tested-by: NMichael Kerrisk <mtk.manpages@gmail.com>
      Acked-by: NMichael Kerrisk <mtk.manpages@gmail.com>
      Cc: <linux-api@vger.kernel.org>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      de11defe
    • C
      fbdev: clean the penguin's dirty feet · cf7ee554
      Clemens Ladisch 提交于
      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
      entries.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cf7ee554
    • N
      sysvipc: fix the ipc structures initialization · e00b4ff7
      Nadia Derbey 提交于
      A problem was found while reviewing the code after Bugzilla bug
      http://bugzilla.kernel.org/show_bug.cgi?id=11796.
      
      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: NNadia Derbey <Nadia.Derbey@bull.net>
      Reported-by: NClement Calmels <cboulte@gmail.com>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: <stable@kernel.org>		[2.6.27.x]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e00b4ff7
    • J
      drivers/video: bad error test before a dereference · cf7b9a1e
      Julien Brunel 提交于
      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:
      (http://www.emn.fr/x-info/coccinelle/)
      // <smpl>
      @def0@
      expression x;
      position p0;
      @@
      x@p0 = backlight_device_register(...)
      
      @protected@
      expression def0.x,E;
      position def0.p0;
      position p;
      statement S;
      @@
      x@p0
      ... when != x = E
      if (!IS_ERR(x) && ...) {<... x@p ...>} else S
      
      @unprotected@
      expression def0.x;
      identifier fld;
      position def0.p0;
      position p != protected.p;
      @@
      x@p0
      ... when != x = E
      * x@p->fld
      // </smpl>
      Signed-off-by: NJulien Brunel <brunel@diku.dk>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cf7b9a1e
    • H
      hwmon: applesmc: Add support for iMac 6 · 9ca791bb
      Henrik Rydberg 提交于
      Add temperature sensor support for iMac 6.
      Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
      Tested-by: NCaleb Hyde <caleb.hyde@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9ca791bb
  2. 19 11月, 2008 8 次提交
  3. 18 11月, 2008 21 次提交
  4. 17 11月, 2008 4 次提交
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 · 9753b127
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
        rtc: rtc-sun4v fixes, revised
        sparc: Fix tty compile warnings.
        sparc: struct device - replace bus_id with dev_name(), dev_set_name()
      9753b127
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 847e9170
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (27 commits)
        rtnetlink: propagate error from dev_change_flags in do_setlink()
        isdn: remove extra byteswap in isdn_net_ciscohdlck_slarp_send_reply
        Phonet: refuse to send bigger than MTU packets
        e1000e: fix IPMI traffic
        e1000e: fix warn_on reload after phy_id error
        phy: fix phy address bug
        e100: fix dma error in direction for mapping
        igb: use dev_printk instead of printk
        qla3xxx: Cleanup: Fix link print statements.
        igb: Use device_set_wakeup_enable
        e1000: Use device_set_wakeup_enable
        e1000e: Use device_set_wakeup_enable
        via-velocity: enable perfect filtering for multicast packets
        phy: Add support for Marvell 88E1118 PHY
        mlx4_en: Pause parameters per port
        phylib: fix premature freeing of struct mii_bus
        atl1: Do not enumerate options unsupported by chip
        atl1e: fix broken multicast by removing unnecessary crc inversion
        gianfar: Fix DMA unmap invocations
        net/ucc_geth: Fix oops in uec_get_ethtool_stats()
        ...
      847e9170
    • O
      sched, signals: fix the racy usage of ->signal in account_group_xxx/run_posix_cpu_timers · ad133ba3
      Oleg Nesterov 提交于
      Impact: fix potential NULL dereference
      
      Contrary to ad474cac changelog, other
      acct_group_xxx() helpers can be called after exit_notify() by timer tick.
      Thanks to Roland for pointing out this. Somehow I missed this simple fact
      when I read the original patch, and I am afraid I confused Frank during
      the discussion. Sorry.
      
      Fortunately, these helpers work with current, we can check ->exit_state
      to ensure that ->signal can't go away under us.
      
      Also, add the comment and compiler barrier to account_group_exec_runtime(),
      to make sure we load ->signal only once.
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ad133ba3
    • F
      swiotlb: use coherent_dma_mask in alloc_coherent · 1e74f300
      FUJITA Tomonori 提交于
      Impact: fix DMA buffer allocation coherency bug in certain configs
      
      This patch fixes swiotlb to use dev->coherent_dma_mask in
      swiotlb_alloc_coherent().
      
      coherent_dma_mask is a subset of dma_mask (equal to it most of
      the time), enumerating the address range that a given device
      is able to DMA to/from in a cache-coherent way.
      
      But currently, swiotlb uses dev->dma_mask in alloc_coherent()
      implicitly via address_needs_mapping(), but alloc_coherent is really
      supposed to use coherent_dma_mask.
      
      This bug could break drivers that uses smaller coherent_dma_mask than
      dma_mask (though the current code works for the majority that use the
      same mask for coherent_dma_mask and dma_mask).
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: tony.luck@intel.com
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1e74f300