08 Dec, 2006

40 commits

  • Currently we allocate 64k space on the user stack and use it the msgbuf for
    sys_{msgrcv,msgsnd} for compat and the results are later copied in user [
    by copy_in_user]. This patch introduces helper routines for
    sys_{msgrcv,msgsnd} as below:

    do_msgsnd() : Accepts the mtype and user space ptr to the buffer along with
    the msqid and msgflg.

    do_msgrcv() : Accepts a kernel space ptr to mtype and a userspace ptr to
    the buffer. The mtype has to be copied back the user space msgbuf by the
    caller.

    These changes avoid the need to allocate the msgsize on the userspace (
    thus removing the size limt ) and the overhead of an extra copy_in_user().

    Signed-off-by: Suzuki K P
    Cc: Arnd Bergmann
    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    suzuki
     
  • After LOADER_TYPE && INITRD_START are true, the short if-condition
    for INITRD_START can never be false.

    Remove unused code from the else condition.

    Signed-off-by: Henry Nestler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Henry Nestler
     
  • scripts/ver_linux needed some minor clean-ups, as follows:
    1) Add reporting of actual oprofile release
    2) Add reporting of actual wireless-tools release
    3) Add reporting of actual pcmciautils release

    Signed-off-by: Valdis Kletnieks
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Valdis Kletnieks
     
  • Attempts to read() from the non-existent dmesg buffer will return zero and
    userspace tends to get stuck in a busyloop.

    So just remove /dev/kmsg altogether if CONFIG_PRINTK=n.

    Signed-off-by: Mike Galbraith
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Galbraith
     
  • Might make qconf compilable with qt-3.1 as well as qt-3.3

    Cc: greg chesson
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    akpm@osdl.org
     
  • The 32 bit implementation of ktime_to_ns returns unsigned value, while the
    64 bit version correctly returns an signed value. There is no current user
    affected by this, but it has to be fixed, as ktime values can be negative.

    Pointed-out-by: Helmut Duregger
    Signed-off-by: Thomas Gleixner
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • In journal=ordered or journal=data mode retry in ext4_prepare_write()
    breaks the requirements of journaling of data with respect to metadata.
    The fix is to call commit_write to commit allocated zero blocks before
    retry.

    Signed-off-by: Kirill Korotaev
    Cc: Ingo Molnar
    Cc: Ken Chen
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Savochkin
     
  • In journal=ordered or journal=data mode retry in ext3_prepare_write()
    breaks the requirements of journaling of data with respect to metadata.
    The fix is to call commit_write to commit allocated zero blocks before
    retry.

    Signed-off-by: Kirill Korotaev
    Cc: Ingo Molnar
    Cc: Ken Chen
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Savochkin
     
  • It has no users and it's doubtful that we'll need it again.

    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Port commit a090d9132c1e53e3517111123680c15afb25c0a4 into ext2:

    All modifications of ->i_flags in inodes that might be visible to somebody
    else must be under ->i_mutex. That patch fixes ext2 ioctl() setting S_APPEND.

    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • The last thing we agreed on was to remove the macros entirely for 2.6.19,
    on all architectures. Unfortunately, I think nobody actually _did_ that,
    so they are still there.

    [akpm@osdl.org: x86_64 fix]
    Cc: David Woodhouse
    Cc: Greg Schafer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • Do proper error-checking and propagation in drivers/base/memory.c, hence fix
    __must_check warnings.

    Cc: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • A driver for the PCEngines WRAP boards (http://www.pcengines.ch), which are
    very similar to the Soekris net4801 (same NS SC1100 geode reference
    design).

    The LEDs on the WRAP are on different GPIO lines and I have modified and
    copied the net48xx error led support for this. It also includes support
    for an "extra" led (in addition to error). The three LEDs on the WRAP are
    at GPIO lines 2,3,18 (WRAP LEDs from left to right). This driver gives
    access to the second and third LEDs by twiddling GPIO lines 3 & 18.

    Because these boards are so similar to the net48xx, I basically sed-ed that
    driver to form the basis for leds-wrap.c. The only changes from
    leds-net48xx.c are:

    - #define WRAP_EXTRA_LED_GPIO

    - name changes

    - duplicate relevant sections to provide support for the "extra" led

    - reverse the various *_led_set values. The WRAP is "backwards" from the
    net48xx, and these needed to be updated for that.

    [akpm@osdl.org: build fix]
    Signed-off-by: Kristian Kielhofner
    Acked-by: Richard Purdie
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kristian Kielhofner
     
  • Fix two things. Firstly the unit is "Hz" not "HZ". Secondly it is useful
    to have 300Hz support when doing multimedia work. 250 is fine for us in
    Europe but the US frame rate is 30fps (29.99 blah for pedants). 300 gives
    us a tick divisible by both 25 and 30, and for interlace work 50 and 60.
    It's also giving similar performance to 250Hz.

    I'd argue we should remove 250 and add 300, but that might be excess
    disruption for now.

    Signed-off-by: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Workqueue functions should not leak locks, assert so, printing the
    last function ran.

    Use macros in lockdep.h to avoid include dependency pains.

    [akpm@osdl.org: build fix]
    Signed-off-by: Peter Zijlstra
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • The Coverity checker noted that this was dead code, since in all places
    above in this function, "err" is immediately checked.

    Signed-off-by: Adrian Bunk
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Implement prof=sleep profiling. TASK_UNINTERRUPTIBLE sleeps will be taken
    as a profile hit, and every millisecond spent sleeping causes a profile-hit
    for the call site that initiated the sleep.

    Sample readprofile output on i386:

    306 ps2_sendbyte 1.3973
    432 call_usermodehelper_keys 1.9548
    484 ps2_command 0.6453
    790 __driver_attach 4.7879
    1593 msleep 44.2500
    3976 sync_buffer 64.1290
    4076 do_lookup 12.4648
    8587 sync_page 122.6714
    20820 total 0.0067

    (NOTE: architectures need to check whether get_wchan() can be called from
    deep within the wakeup path.)

    akpm: we need to mark more functions __sched. lock_sock(), msleep(), others..

    akpm: the contention in do_lookup() is a surprise. Presumably doing disk
    reads for directory contents while holding i_mutex.

    [akpm@osdl.org: various fixes]
    Signed-off-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     
  • Fixed long-lived typo: remount_fs() needs BKL

    Signed-off-by: Vasily Averin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vasily Averin
     
  • Name some of the remaning 'old_style_spin_init' locks

    Signed-off-by: Peter Zijlstra
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Add debug_show_held_locks(current) to __might_sleep() and schedule(); this
    makes finding the offending lock leak easier.

    Signed-off-by: Peter Zijlstra
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Steve Grubb's fzfuzzer tool (http://people.redhat.com/sgrubb/files/
    fsfuzzer-0.6.tar.gz) generates corrupt Cramfs filesystems which cause
    Cramfs to kernel oops in cramfs_uncompress_block(). The cause of the oops
    is an unchecked corrupted block length field read by cramfs_readpage().

    This patch adds a sanity check to cramfs_readpage() which checks that the
    block length field is sensible. The (PAGE_CACHE_SIZE << 1) size check is
    intentional, even though the uncompressed data is not going to be larger
    than PAGE_CACHE_SIZE, gzip sometimes generates compressed data larger than
    the original source data. Mkcramfs checks that the compressed size is
    always less than or equal to PAGE_CACHE_SIZE << 1. Of course Cramfs could
    use the original uncompressed data in this case, but it doesn't.

    Signed-off-by: Phillip Lougher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Phillip Lougher
     
  • It turns out that the "-c" option of cpio is highly unportable even between
    distros let alone unix variants, and may actually make the wrong type of
    cpio archive. I just wasted quite some time on this, and the kernel can
    detect this and warn about it (it's __init memory so it gets thrown away
    and thus there is no runtime overhead)

    Signed-off-by: Arjan van de Ven
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     
  • In file included from drivers/char/ip2/ip2main.c:285:
    drivers/char/ip2/i2lib.c: In function `i2Output':
    drivers/char/ip2/i2lib.c:1019: warning: unused variable `rc'

    Signed-off-by: Mariusz Kozlowski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mariusz Kozlowski
     
  • Saves nearly 4kbytes on x86.

    Cc: Arnaldo Carvalho de Melo
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Saves nearly 4kbytes on x86.

    Cc: Arnaldo Carvalho de Melo
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • As Mikulas points out, (1 << anything) won't be evaluating to zero. This code
    is long-dead.

    Cc: Mikulas Patocka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • This allows a hyphenated range of positive numbers in the string passed
    to command line helper function, get_options.

    Currently the command line option "isolcpus=" takes as its argument a
    list of cpus.

    Format: ,...,
    Valid values of include all cpus, 0 to "number of CPUs in
    system - 1". This can get extremely long when isolating the majority of
    cpus on a large system. The kernel isolcpus code would not need any
    changing to use this feature. To use it, the change would be in the
    command line format for 'isolcpus='
    Format:
    ,...,
    or
    - (must be a positive range in ascending
    order.)
    or a mixture
    ,...,-

    Signed-off-by: Derek Fults
    Cc: "Randy.Dunlap"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Derek Fults
     
  • Print the other (hopefully) known good pointer when list_head debugging
    too, which may yield additional clues.

    Also fix for 80-columns to win akpm brownie points.

    Signed-off-by: Dave Jones
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jones
     
  • Clean up several code points in which the return code from misc_register is
    not handled properly.

    Several modules failed to deregister various hooks when misc_register fails,
    and this patch cleans them up. Also there are a few modules that legitimately
    don't care about the failure status of misc register. These drivers however
    unilaterally call misc_deregister on module unload.

    Since misc_register doesn't initialize the list_head in the init_routine if it
    fails, the deregister operation is at risk for oopsing when list_del is
    called. The initial solution was to manually init the list in the miscdev
    structure in each of those modules, but the consensus in this thread was to
    consolodate and do that universally inside misc_register.

    Signed-off-by: Neil Horman
    Cc: Bjorn Helgaas
    Cc: Kylene Jo Hall
    Cc: Dmitry Torokhov
    Cc: Olaf Hering
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman
     
  • d_count check after dget() is always true.

    Signed-off-by: Vasily Averin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vasily Averin
     
  • Fixing sbpcd.c baroque error printing in process.

    Signed-off-by: Alexey Dobriyan
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Fix hpfs printk warnings:

    fs/hpfs/dir.c:87: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
    fs/hpfs/dir.c:147: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'long int'
    fs/hpfs/dir.c:148: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'long int'
    fs/hpfs/dnode.c:537: warning: format '%08x' expects type 'unsigned int', but argument 5 has type 'long unsigned int'
    fs/hpfs/dnode.c:854: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'loff_t'
    fs/hpfs/ea.c:247: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
    fs/hpfs/inode.c:254: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
    fs/hpfs/map.c:129: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'ino_t'
    fs/hpfs/map.c:135: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'ino_t'
    fs/hpfs/map.c:140: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'ino_t'
    fs/hpfs/map.c:147: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'ino_t'
    fs/hpfs/map.c:154: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'ino_t'

    Signed-off-by: Randy Dunlap
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • - switch to error message buffer in .bss
    - missing va_end() (htf it worked before?)
    - use vsnprintf()
    - rename variables to understandable "fmt", "args".
    - "const char *fmt", yes.
    - add __attribute__((format ...

    Still, put that coffee down before reading more.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • It would very lame to get buffer overflow via one of the following.

    Signed-off-by: Alexey Dobriyan
    Cc: Dave Kleikamp
    Cc: Mark Fasheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • This is on our "Envoy" boxes which we have, according to the documentation, an
    "Exar ST16C554/554D Quad UART with 16-byte Fifo's". The box also has two
    other "on-board" serial ports and a modem chip.

    The two on-board serial UARTs were being detected along with the first two
    Exar UARTs. The last two Exar UARTs were not showing up and neither was the
    modem.

    This patch was the only way I could the kernel to see beyond the standard four
    serial ports and get all four of the Exar UARTs to show up.

    [akpm@osdl.org: build fix]
    Signed-off-by: Paul B Schroeder
    Cc: Lennart Sorensen
    Acked-by: Alan Cox
    Cc: Russell King
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul B Schroeder
     
  • =============================================
    [ INFO: possible recursive locking detected ]
    2.6.18-1.2699.fc6 #1
    ---------------------------------------------
    swapper/0 is trying to acquire lock:
    (&list->lock#3){+...}, at: [] skb_dequeue+0x12/0x43

    but task is already holding lock:
    (&list->lock#3){+...}, at: [] bcsp_dequeue+0x6a/0x11e [hci_uart]

    Two different list locks nest, annotate so.

    Signed-off-by: Peter Zijlstra
    Acked-by: Marcel Holtmann
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • One of the mistakes a module_param() user can make is to supply default
    value of module parameter as the last argument. module_param() accepts
    permissions instead. If default value is, say, 3 (-------wx), parameter
    becomes world-writeable.

    So far, the only remedy was to apply grep(1) and read drivers submitted
    to -mm. BTDT.

    With this patch applied, compiler will finally do some job.

    *) bounds checking on permissions
    *) world-writeable bit checking on permissions
    *) compile breakage if checks trigger

    First version of this check (only "& 2" part) directly caught 4 out of 7
    places during my last grep.

    Subject: Neverending module_param() bugs
    [X] drivers/acpi/sbs.c:101:module_param(capacity_mode, int, CAPACITY_UNIT);
    [X] drivers/acpi/sbs.c:102:module_param(update_mode, int, UPDATE_MODE);
    [ ] drivers/acpi/sbs.c:103:module_param(update_info_mode, int, UPDATE_INFO_MODE);
    [ ] drivers/acpi/sbs.c:104:module_param(update_time, int, UPDATE_TIME);
    [ ] drivers/acpi/sbs.c:105:module_param(update_time2, int, UPDATE_TIME2);
    [X] drivers/char/watchdog/sbc8360.c:203:module_param(timeout, int, 27);
    [X] drivers/media/video/tuner-simple.c:13:module_param(offset, int, 0666);

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Thomas Graf wrote:
    >
    > nla_nest_start() may return NULL, either rely on prepare_reply() to be
    > correct and BUG() on failure or do proper error handling for all
    > functions.

    nla_put() in taskstat.c can fail only if the 'size' argument of alloc_skb()
    was not right. This is a kernel bug, we should not hide it. So add 'BUG()'
    on error path and check for 'na == NULL'.

    > genlmsg_cancel() is only required in error paths for dumping
    > procedures.

    So we can remove 'genlmsg_cancel()' calls and 'void *reply' (saves 227 bytes).

    Signed-off-by: Oleg Nesterov
    Cc: Thomas Graf
    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jay Lan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Currently taskstats_user_cmd()/taskstats_exit() do:

    1) allocate stats
    2) fill stats
    3) make a temporary copy on stack (236 bytes)
    4) copy that copy to skb
    5) free stats

    With the help of nla_reserve() we can operate on skb->data directly,
    thus avoiding all these steps except 2).

    So, before this patch:

    // copy *stats to skb->data
    int mk_reply(skb, ..., struct taskstats *stats);

    fill_pid(stats);
    mk_reply(skb, ..., stats);

    After:
    // return a pointer to skb->data
    struct taskstats *mk_reply(skb, ...);

    stat = mk_reply(skb, ...);
    fill_pid(stats);

    Shrinks taskatsks.o by 162 bytes.

    A stupid benchmark (send one million TASKSTATS_CMD_ATTR_PID) shows the

    real user sys
    before:
    4.02 0.06 3.96
    4.02 0.04 3.98
    4.02 0.04 3.97
    after:
    3.86 0.08 3.78
    3.88 0.10 3.77
    3.89 0.09 3.80

    but this looks suspiciously good.

    Signed-off-by: Oleg Nesterov
    Acked-by: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jay Lan
    Cc: Thomas Graf
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Introduce mk_reply() helper which does all nla_put()s on reply.

    Saves 453 bytes and a preparation for the next patch.

    Signed-off-by: Oleg Nesterov
    Acked-by: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jay Lan
    Cc: Thomas Graf
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov