03 Apr, 2012

40 commits

  • commit 3fa016a0b5c5237e9c387fc3249592b2cb5391c6 upstream.

    Looking at hibernate overwriting I though it looked like a cursor,
    so I tracked down this missing piece to stop the cursor blink
    timer. I've no idea if this is sufficient to fix the hibernate
    problems people are seeing, but please test it.

    Both radeon and nouveau have done this for a long time.

    I've run this personally all night hib/resume cycles with no fails.

    Reviewed-by: Keith Packard
    Reported-by: Petr Tesarik
    Reported-by: Stanislaw Gruszka
    Reported-by: Lots of misc segfaults after hibernate across the world.
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=37142
    Tested-by: Dave Airlie
    Tested-by: Bojan Smojver
    Tested-by: Andreas Hartmann
    Signed-off-by: Dave Airlie
    Signed-off-by: Greg Kroah-Hartman

    Dave Airlie
     
  • commit fa0fb93f2ac308a76fa64eb57c18511dadf97089 upstream.

    For high-speed/super-speed isochronous endpoints, the bInterval
    value is used as exponent, 2^(bInterval-1). Luckily we have
    usb_fill_int_urb() function that handles it correctly. So we just
    call this function to fill in the RX URB.

    Cc: Marcel Holtmann
    Signed-off-by: Bing Zhao
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo F. Padovan
    Signed-off-by: Greg Kroah-Hartman

    Bing Zhao
     
  • commit f946eeb9313ff1470758e171a60fe7438a2ded3f upstream.

    Module size was limited to 64MB, this was legacy limitation due to vmalloc()
    which was removed a while ago.

    Limiting module size to 64MB is both pointless and affects real world use
    cases.

    Cc: Tim Abbott
    Signed-off-by: Sasha Levin
    Signed-off-by: Rusty Russell
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     
  • commit 66c4c35c6bc5a1a452b024cf0364635b28fd94e4 upstream.

    sysfs_slab_add() calls various sysfs functions that actually may
    end up in userspace doing all sorts of things.

    Release the slub_lock after adding the kmem_cache structure to the list.
    At that point the address of the kmem_cache is not known so we are
    guaranteed exlusive access to the following modifications to the
    kmem_cache structure.

    If the sysfs_slab_add fails then reacquire the slub_lock to
    remove the kmem_cache structure from the list.

    Reported-by: Sasha Levin
    Acked-by: Eric Dumazet
    Signed-off-by: Christoph Lameter
    Signed-off-by: Pekka Enberg
    Signed-off-by: Greg Kroah-Hartman

    Christoph Lameter
     
  • commit d97d32edcd732110758799ae60af725e5110b3dc upstream.

    When an IO error happens during inode deletion run from
    xlog_recover_process_iunlinks() filesystem gets shutdown. Thus any subsequent
    attempt to read buffers fails. Code in xlog_recover_process_iunlinks() does not
    count with the fact that read of a buffer which was read a while ago can
    really fail which results in the oops on
    agi = XFS_BUF_TO_AGI(agibp);

    Fix the problem by cleaning up the buffer handling in
    xlog_recover_process_iunlinks() as suggested by Dave Chinner. We release buffer
    lock but keep buffer reference to AG buffer. That is enough for buffer to stay
    pinned in memory and we don't have to call xfs_read_agi() all the time.

    Signed-off-by: Jan Kara
    Reviewed-by: Dave Chinner
    Signed-off-by: Ben Myers
    Signed-off-by: Greg Kroah-Hartman

    Jan Kara
     
  • commit 8da00edc1069f01c34510fa405dc15d96c090a3f upstream.

    Fix typo in drivers/video/backlight/tosa_lcd.c
    "tosa_lcd_reume" should be "tosa_lcd_resume".

    Signed-off-by: Masanari Iida
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Masanari Iida
     
  • commit aadbe266f2f89ccc68b52f4effc7b3a8b29521ef upstream.

    Call the correct exit function on failure in dm_exception_store_init.

    Signed-off-by: Andrei Warkentin
    Acked-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Signed-off-by: Greg Kroah-Hartman

    Andrei Warkentin
     
  • commit 72c6e7afc43e19f68a31dea204fc366624d6eee9 upstream.

    Always set io->error to -EIO when an error is detected in dm-crypt.

    There were cases where an error code would be set only if we finish
    processing the last sector. If there were other encryption operations in
    flight, the error would be ignored and bio would be returned with
    success as if no error happened.

    This bug is present in kcryptd_crypt_write_convert, kcryptd_crypt_read_convert
    and kcryptd_async_done.

    Signed-off-by: Mikulas Patocka
    Reviewed-by: Milan Broz
    Signed-off-by: Alasdair G Kergon
    Signed-off-by: Greg Kroah-Hartman

    Mikulas Patocka
     
  • commit aeb2deae2660a1773c83d3c6e9e6575daa3855d6 upstream.

    This patch fixes a possible deadlock in dm-crypt's mempool use.

    Currently, dm-crypt reserves a mempool of MIN_BIO_PAGES reserved pages.
    It allocates first MIN_BIO_PAGES with non-failing allocation (the allocation
    cannot fail and waits until the mempool is refilled). Further pages are
    allocated with different gfp flags that allow failing.

    Because allocations may be done in parallel, this code can deadlock. Example:
    There are two processes, each tries to allocate MIN_BIO_PAGES and the processes
    run simultaneously.
    It may end up in a situation where each process allocates (MIN_BIO_PAGES / 2)
    pages. The mempool is exhausted. Each process waits for more pages to be freed
    to the mempool, which never happens.

    To avoid this deadlock scenario, this patch changes the code so that only
    the first page is allocated with non-failing gfp mask. Allocation of further
    pages may fail.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Milan Broz
    Signed-off-by: Alasdair G Kergon
    Signed-off-by: Greg Kroah-Hartman

    Mikulas Patocka
     
  • commit a0391a3ae91d301c0e59368531a4de5f0b122bcf upstream.

    udf_release_file() can be called from munmap() path with mmap_sem held. Thus
    we cannot take i_mutex there because that ranks above mmap_sem. Luckily,
    i_mutex is not needed in udf_release_file() anymore since protection by
    i_data_sem is enough to protect from races with write and truncate.

    Reported-by: Al Viro
    Reviewed-by: Namjae Jeon
    Signed-off-by: Jan Kara
    Signed-off-by: Greg Kroah-Hartman

    Jan Kara
     
  • commit b18dafc86bb879d2f38a1743985d7ceb283c2f4d upstream.

    In d_materialise_unique() there are 3 subcases to the 'aliased dentry'
    case; in two subcases the inode i_lock is properly released but this
    does not occur in the -ELOOP subcase.

    This seems to have been introduced by commit 1836750115f2 ("fix loop
    checks in d_materialise_unique()").

    Signed-off-by: Michel Lespinasse
    [ Added a comment, and moved the unlock to where we generate the -ELOOP,
    which seems to be more natural.

    You probably can't actually trigger this without a buggy network file
    server - d_materialize_unique() is for finding aliases on non-local
    filesystems, and the d_ancestor() case is for a hardlinked directory
    loop.

    But we should be robust in the case of such buggy servers anyway. ]
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Michel Lespinasse
     
  • commit 31d4f3a2f3c73f279ff96a7135d7202ef6833f12 upstream.

    Explicitly test for an extent whose length is zero, and flag that as a
    corrupted extent.

    This avoids a kernel BUG_ON assertion failure.

    Tested: Without this patch, the file system image found in
    tests/f_ext_zero_len/image.gz in the latest e2fsprogs sources causes a
    kernel panic. With this patch, an ext4 file system error is noted
    instead, and the file system is marked as being corrupted.

    https://bugzilla.kernel.org/show_bug.cgi?id=42859

    Signed-off-by: "Theodore Ts'o"
    Signed-off-by: Greg Kroah-Hartman

    Theodore Ts'o
     
  • commit 3d2b158262826e8b75bbbfb7b97010838dd92ac7 upstream.

    Ext4 does not support data journalling with delayed allocation enabled.
    We even do not allow to mount the file system with delayed allocation
    and data journalling enabled, however it can be set via FS_IOC_SETFLAGS
    so we can hit the inode with EXT4_INODE_JOURNAL_DATA set even on file
    system mounted with delayed allocation (default) and that's where
    problem arises. The easies way to reproduce this problem is with the
    following set of commands:

    mkfs.ext4 /dev/sdd
    mount /dev/sdd /mnt/test1
    dd if=/dev/zero of=/mnt/test1/file bs=1M count=4
    chattr +j /mnt/test1/file
    dd if=/dev/zero of=/mnt/test1/file bs=1M count=4 conv=notrunc
    chattr -j /mnt/test1/file

    Additionally it can be reproduced quite reliably with xfstests 272 and
    269. In fact the above reproducer is a part of test 272.

    To fix this we should ignore the EXT4_INODE_JOURNAL_DATA inode flag if
    the file system is mounted with delayed allocation. This can be easily
    done by fixing ext4_should_*_data() functions do ignore data journal
    flag when delalloc is set (suggested by Ted). We also have to set the
    appropriate address space operations for the inode (again, ignoring data
    journal flag if delalloc enabled).

    Additionally this commit introduces ext4_inode_journal_mode() function
    because ext4_should_*_data() has already had a lot of common code and
    this change is putting it all into one function so it is easier to
    read.

    Successfully tested with xfstests in following configurations:

    delalloc + data=ordered
    delalloc + data=writeback
    data=journal
    nodelalloc + data=ordered
    nodelalloc + data=writeback
    nodelalloc + data=journal

    Signed-off-by: Lukas Czerner
    Signed-off-by: "Theodore Ts'o"
    Signed-off-by: Greg Kroah-Hartman

    Lukas Czerner
     
  • commit 15291164b22a357cb211b618adfef4fa82fc0de3 upstream.

    journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
    state ala discard_buffer(), but does not touch _Delay or _Unwritten as
    discard_buffer() does.

    This can be problematic in some areas of the ext4 code which assume
    that if they have found a buffer marked unwritten or delay, then it's
    a live one. Perhaps those spots should check whether it is mapped
    as well, but if jbd2 is going to tear down a buffer, let's really
    tear it down completely.

    Without this I get some fsx failures on sub-page-block filesystems
    up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
    and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
    away, because buried within that large change is some more flag
    clearing. I still think it's worth doing in jbd2, since
    ->invalidatepage leads here directly, and it's the right place
    to clear away these flags.

    Signed-off-by: Eric Sandeen
    Signed-off-by: "Theodore Ts'o"
    Signed-off-by: Greg Kroah-Hartman

    Eric Sandeen
     
  • commit dccaf33fa37a1bc5d651baeb3bfeb6becb86597b upstream.

    (backported to 3.0 by mjt)

    There is a race between ext4 buffer write and direct_IO read with
    dioread_nolock mount option enabled. The problem is that we clear
    PageWriteback flag during end_io time but will do
    uninitialized-to-initialized extent conversion later with dioread_nolock.
    If an O_direct read request comes in during this period, ext4 will return
    zero instead of the recently written data.

    This patch checks whether there are any pending uninitialized-to-initialized
    extent conversion requests before doing O_direct read to close the race.
    Note that this is just a bandaid fix. The fundamental issue is that we
    clear PageWriteback flag before we really complete an IO, which is
    problem-prone. To fix the fundamental issue, we may need to implement an
    extent tree cache that we can use to look up pending to-be-converted extents.

    Signed-off-by: Jiaying Zhang
    Signed-off-by: "Theodore Ts'o"
    Cc: Jan Kara
    Signed-off-by: Michael Tokarev
    Signed-off-by: Greg Kroah-Hartman

    Jiaying Zhang
     
  • commit 05b4877f6a4f1ba4952d1222213d262bf8c132b7 upstream.

    If create_basic_memory_bitmaps() fails, usermodehelpers are not re-enabled
    before returning. Fix this. And while at it, reword the goto labels so that
    they look more meaningful.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Srivatsa S. Bhat
     
  • commit 09357b00255c233705b1cf6d76a8d147340545b8 upstream.

    Based on the original patch submitted my Michael Wang
    .
    Descriptors may not be write-back while checking TX hang with flag
    FLAG2_DMA_BURST on.
    So when we detect hang, we just flush the descriptor and detect
    again for once.

    -v2 change 1 to true and 0 to false and remove extra ()

    CC: Michael Wang
    CC: Flavio Leitner
    Acked-by: Jesse Brandeburg
    Tested-by: Aaron Brown
    Signed-off-by: Jeff Kirsher
    Signed-off-by: Greg Kroah-Hartman

    Jeff Kirsher
     
  • commit 9ab2393fc3e460cd2040de1483918eb17abb822f upstream.

    The D1F5 revision of the WinTV HVR-1900 uses a tda18271c2 tuner
    instead of a tda18271c1 tuner as used in revision D1E9. To
    account for this, we must hardcode the frontend configuration
    to use the same IF frequency configuration for both revisions
    of the device.

    6MHz DVB-T is unaffected by this issue, as the recommended
    IF Frequency configuration for 6MHz DVB-T is the same on both
    c1 and c2 revisions of the tda18271 tuner.

    Signed-off-by: Michael Krufky
    Cc: Mike Isely
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Michael Krufky
     
  • commit 34817174fca0c5512c2d5b6ea0fc37a0337ce1d8 upstream.

    The error handling in lgdt3303_read_status() and lgdt330x_read_ucblocks()
    doesn't work, because i2c_read_demod_bytes() returns a u8 and (err < 0)
    is always false.

    err = i2c_read_demod_bytes(state, 0x58, buf, 1);
    if (err < 0)
    return err;

    Change the return type of i2c_read_demod_bytes() to int. Also change
    the return value on error to -EIO to make (err < 0) work.

    Signed-off-by: Xi Wang
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Xi Wang
     
  • commit fc0900cbda9243957d812cd6b4cc87965f9fe75f upstream.

    Wrong bit was used for sign extension which caused wrong end results.
    Thanks to Andre for spotting this bug.

    Reported-by: Andre Przywara
    Signed-off-by: Andreas Herrmann
    Acked-by: Guenter Roeck
    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Andreas Herrmann
     
  • commit 1b26c9b334044cff6d1d2698f2be41bc7d9a0864 upstream.

    The namespace cleanup path leaks a dentry which holds a reference count
    on a network namespace. Keeping that network namespace from being freed
    when the last user goes away. Leaving things like vlan devices in the
    leaked network namespace.

    If you use ip netns add for much real work this problem becomes apparent
    pretty quickly. It light testing the problem hides because frequently
    you simply don't notice the leak.

    Use d_set_d_op() so that DCACHE_OP_* flags are set correctly.

    This issue exists back to 3.0.

    Acked-by: "Eric W. Biederman"
    Reported-by: Justin Pettit
    Signed-off-by: Pravin B Shelar
    Signed-off-by: Jesse Gross
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Pravin B Shelar
     
  • commit 29a2e2836ff9ea65a603c89df217f4198973a74f upstream.

    The problem occurs on !CONFIG_VM86 kernels [1] when a kernel-mode task
    returns from a system call with a pending signal.

    A real-life scenario is a child of 'khelper' returning from a failed
    kernel_execve() in ____call_usermodehelper() [ kernel/kmod.c ].
    kernel_execve() fails due to a pending SIGKILL, which is the result of
    "kill -9 -1" (at least, busybox's init does it upon reboot).

    The loop is as follows:

    * syscall_exit_work:
    - work_pending: // start_of_the_loop
    - work_notify_sig:
    - do_notify_resume()
    - do_signal()
    - if (!user_mode(regs)) return;
    - resume_userspace // TIF_SIGPENDING is still set
    - work_pending // so we call work_pending => goto
    // start_of_the_loop

    More information can be found in another LKML thread:
    http://www.serverphorums.com/read.php?12,457826

    [1] the problem was also seen on MIPS.

    Signed-off-by: Dmitry Adamushko
    Link: http://lkml.kernel.org/r/1332448765.2299.68.camel@dimm
    Cc: Oleg Nesterov
    Cc: Roland McGrath
    Cc: Andrew Morton
    Signed-off-by: H. Peter Anvin
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Adamushko
     
  • commit 5d5440a835710d09f0ef18da5000541ec98b537a upstream.

    URB unlinking is always racing with its completion and tx_complete
    may be called before or during running usb_unlink_urb, so tx_complete
    must not clear urb->dev since it will be used in unlink path,
    otherwise invalid memory accesses or usb device leak may be caused
    inside usb_unlink_urb.

    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Ming Lei
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    tom.leiming@gmail.com
     
  • commit 0956a8c20b23d429e79ff86d4325583fc06f9eb4 upstream.

    Commit 4231d47e6fe69f061f96c98c30eaf9fb4c14b96d(net/usbnet: avoid
    recursive locking in usbnet_stop()) fixes the recursive locking
    problem by releasing the skb queue lock, but it makes usb_unlink_urb
    racing with defer_bh, and the URB to being unlinked may be freed before
    or during calling usb_unlink_urb, so use-after-free problem may be
    triggerd inside usb_unlink_urb.

    The patch fixes the use-after-free problem by increasing URB
    reference count with skb queue lock held before calling
    usb_unlink_urb, so the URB won't be freed until return from
    usb_unlink_urb.

    Cc: Sebastian Andrzej Siewior
    Cc: Alan Stern
    Cc: Oliver Neukum
    Reported-by: Dave Jones
    Signed-off-by: Ming Lei
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    tom.leiming@gmail.com
     
  • commit 540a0f7584169651f485e8ab67461fcb06934e38 upstream.

    The problem is that for the case of priority queues, we
    have to assume that __rpc_remove_wait_queue_priority will move new
    elements from the tk_wait.links lists into the queue->tasks[] list.
    We therefore cannot use list_for_each_entry_safe() on queue->tasks[],
    since that will skip these new tasks that __rpc_remove_wait_queue_priority
    is adding.

    Without this fix, rpc_wake_up and rpc_wake_up_status will both fail
    to wake up all functions on priority wait queues, which can result
    in some nasty hangs.

    Reported-by: Andy Adamson
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 7eb3aa65853e1b223bfc786b023b702018cb76c0 upstream.

    The 'find_wl_entry()' function expects the maximum difference as the second
    argument, not the maximum absolute value. So the "unknown" eraseblock picking
    was incorrect, as Shmulik Ladkani spotted. This patch fixes the issue.

    Reported-by: Shmulik Ladkani
    Signed-off-by: Artem Bityutskiy
    Reviewed-by: Shmulik Ladkani
    Signed-off-by: Greg Kroah-Hartman

    Artem Bityutskiy
     
  • commit a29852be492d61001d86c6ebf5fff9b93d7b4be9 upstream.

    Two bad things can happen in ubi_scan():
    1. If kmem_cache_create() fails we jump to out_si and call
    ubi_scan_destroy_si() which calls kmem_cache_destroy().
    But si->scan_leb_slab is NULL.
    2. If process_eb() fails we jump to out_vidh, call
    kmem_cache_destroy() and ubi_scan_destroy_si() which calls
    again kmem_cache_destroy().

    Signed-off-by: Richard Weinberger
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Greg Kroah-Hartman

    Richard Weinberger
     
  • commit 1daaae8fa4afe3df78ca34e724ed7e8187e4eb32 upstream.

    This patch fixes an issue when cifs_mount receives a
    STATUS_BAD_NETWORK_NAME error during cifs_get_tcon but is able to
    continue after an DFS ROOT referral. In this case, the return code
    variable is not reset prior to trying to mount from the system referred
    to. Thus, is_path_accessible is not executed and the final DFS referral
    is not performed causing a mount error.

    Use case: In DNS, example.com resolves to the secondary AD server
    ad2.example.com Our primary domain controller is ad1.example.com and has
    a DFS redirection set up from \\ad1\share\Users to \\files\share\Users.
    Mounting \\example.com\share\Users fails.

    Regression introduced by commit 724d9f1.

    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     
  • commit f30d500f809eca67a21704347ab14bb35877b5ee upstream.

    When we get concurrent lookups of the same inode that is not in the
    per-AG inode cache, there is a race condition that triggers warnings
    in unlock_new_inode() indicating that we are initialising an inode
    that isn't in a the correct state for a new inode.

    When we do an inode lookup via a file handle or a bulkstat, we don't
    serialise lookups at a higher level through the dentry cache (i.e.
    pathless lookup), and so we can get concurrent lookups of the same
    inode.

    The race condition is between the insertion of the inode into the
    cache in the case of a cache miss and a concurrently lookup:

    Thread 1 Thread 2
    xfs_iget()
    xfs_iget_cache_miss()
    xfs_iread()
    lock radix tree
    radix_tree_insert()
    rcu_read_lock
    radix_tree_lookup
    lock inode flags
    XFS_INEW not set
    igrab()
    unlock inode flags
    rcu_read_unlock
    use uninitialised inode
    .....
    lock inode flags
    set XFS_INEW
    unlock inode flags
    unlock radix tree
    xfs_setup_inode()
    inode flags = I_NEW
    unlock_new_inode()
    WARNING as inode flags != I_NEW

    This can lead to inode corruption, inode list corruption, etc, and
    is generally a bad thing to occur.

    Fix this by setting XFS_INEW before inserting the inode into the
    radix tree. This will ensure any concurrent lookup will find the new
    inode with XFS_INEW set and that forces the lookup to wait until the
    XFS_INEW flag is removed before allowing the lookup to succeed.

    Signed-off-by: Dave Chinner
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Ben Myers
    Signed-off-by: Greg Kroah-Hartman

    Dave Chinner
     
  • commit 3114ea7a24d3264c090556a2444fc6d2c06176d4 upstream.

    If a setattr() fails because of an NFS4ERR_OPENMODE error, it is
    probably due to us holding a read delegation. Ensure that the
    recovery routines return that delegation in this case.

    Reported-by: Miklos Szeredi
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit a1d0b5eebc4fd6e0edb02688b35f17f67f42aea5 upstream.

    If we know that the delegation stateid is bad or revoked, we need to
    remove that delegation as soon as possible, and then mark all the
    stateids that relied on that delegation for recovery. We cannot use
    the delegation as part of the recovery process.

    Also note that NFSv4.1 uses a different error code (NFS4ERR_DELEG_REVOKED)
    to indicate that the delegation was revoked.

    Finally, ensure that setlk() and setattr() can both recover safely from
    a revoked delegation.

    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit c2226fc9e87ba3da060e47333657cd6616652b84 upstream.

    On hosts without this patch, 32bit guests will crash (and 64bit guests
    may behave in a wrong way) for example by simply executing following
    nasm-demo-application:

    [bits 32]
    global _start
    SECTION .text
    _start: syscall

    (I tested it with winxp and linux - both always crashed)

    Disassembly of section .text:

    00000000 :
    0: 0f 05 syscall

    The reason seems a missing "invalid opcode"-trap (int6) for the
    syscall opcode "0f05", which is not available on Intel CPUs
    within non-longmodes, as also on some AMD CPUs within legacy-mode.
    (depending on CPU vendor, MSR_EFER and cpuid)

    Because previous mentioned OSs may not engage corresponding
    syscall target-registers (STAR, LSTAR, CSTAR), they remain
    NULL and (non trapping) syscalls are leading to multiple
    faults and finally crashs.

    Depending on the architecture (AMD or Intel) pretended by
    guests, various checks according to vendor's documentation
    are implemented to overcome the current issue and behave
    like the CPUs physical counterparts.

    [mtosatti: cleanup/beautify code]

    Signed-off-by: Stephan Baerwolf
    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Stefan Bader
    Signed-off-by: Greg Kroah-Hartman

    Stephan Bärwolf
     
  • commit bdb42f5afebe208eae90406959383856ae2caf2b upstream.

    In order to be able to proceed checks on CPU-specific properties
    within the emulator, function "get_cpuid" is introduced.
    With "get_cpuid" it is possible to virtually call the guests
    "cpuid"-opcode without changing the VM's context.

    [mtosatti: cleanup/beautify code]

    Signed-off-by: Stephan Baerwolf
    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Stefan Bader
    Signed-off-by: Greg Kroah-Hartman

    Stephan Bärwolf
     
  • commit 0c0efbacab8d70700d13301e0ae7975783c0cb0a upstream.

    handle_ir_buffer_fill() assumed that a completed descriptor would be
    indicated by a non-zero transfer_status (as in most other descriptors).
    However, this field is written by the controller as soon as (the end of)
    the first packet has been written into the buffer. As a consequence, if
    we happen to run into such a descriptor when the interrupt handler is
    executed after such a packet has completed, the descriptor would be
    taken out of the list of active descriptors as soon as the buffer had
    been partially filled, so the event for the buffer being completely
    filled would never be sent.

    To fix this, handle descriptors only when they have been completely
    filled, i.e., when res_count == 0. (This also matches the condition
    that is reported by the controller with an interrupt.)

    Signed-off-by: Clemens Ladisch
    Signed-off-by: Stefan Richter
    Signed-off-by: Greg Kroah-Hartman

    Clemens Ladisch
     
  • commit 9716387311c790de381214c03e7f1b72b91a8189 upstream.

    According to the HT6560H datasheet, the recovery timing field is 4-bit wide,
    with a value of 0 meaning 16 cycles. Correct obvious thinko in the recovery
    field mask.

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Jeff Garzik
    Signed-off-by: Greg Kroah-Hartman

    Sergei Shtylyov
     
  • commit 6c30d5a53229aad22bb675e0bd6eb518ecaa4316 upstream.

    Add support for the camera key. The hotkey for
    Asus S.H.E(Super Hybrid Engine) mode is mapped to KEY_KEY_PROG1
    just for notifying the userspace.

    Signed-off-by: Keng-Yu Lin
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Keng-Yu Lin
     
  • commit 3596bb929f2abd3433c2eaa5755fad48ac207af1 upstream.

    The Asus All-In-One PC has a wireless keyboard with wifi toggle,
    brightness up, brightness down and display off hotkeys.

    This patch adds suppoort for these hotkeys.

    Signed-off-by: Keng-Yu Lin
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Keng-Yu Lin
     
  • commit 6b6ba88b5bb8779156b21bb957520a448c3642e2 upstream.

    The ID is found on Asus K54HR and K53U.
    Blacklist the AR3011-based device ID [0489:e03d]
    and add to ath3k.c for firmware loading.

    Below is the output of usb-devices script:

    Before the fiwmware loading:

    T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
    D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0489 ProdID=e03d Rev=00.01
    C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

    After the fiwmware loading:

    T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
    D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0cf3 ProdID=3005 Rev=00.01
    C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

    Signed-off-by: Keng-Yu Lin
    Signed-off-by: Gustavo F. Padovan
    Signed-off-by: Johan Hedberg
    Signed-off-by: Greg Kroah-Hartman

    Keng-Yu Lin
     
  • commit 33395fb8a13731c7ef7b175dbf5a4d8a6738fe6c upstream.

    The old code did (MSB << 8) & 0xff, which always evaluates to 0. Just use
    get_unaligned_be16() so we don't have to worry about whether our open-coded
    version is correct or not.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Roland Dreier
     
  • commit effc6cc8828257c32c37635e737f14fd6e19ecd7 upstream.

    SPC-4 says about the WBUS16 and SYNC bits:

    The meanings of these fields are specific to SPI-5 (see 6.4.3).
    For SCSI transport protocols other than the SCSI Parallel
    Interface, these fields are reserved.

    We don't have a SPI fabric module, so we should never set these bits.
    (The comment was misleading, since it only mentioned Sync but the
    actual code set WBUS16 too).

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Roland Dreier