06 Sep, 2014

40 commits

  • Greg Kroah-Hartman
     
  • commit a9ef803d740bfadf5e505fbc57efa57692e27025 upstream.

    commit bdd405d2a528 ("usb: hub: Prevent hub autosuspend if
    usbcore.autosuspend is -1") causes a build error if CONFIG_PM_RUNTIME is
    disabled. Fix that by doing a simple #ifdef guard around it.

    Reported-by: Stephen Rothwell
    Reported-by: kbuild test robot
    Cc: Roger Quadros
    Cc: Michael Welling
    Cc: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • commit 4449a51a7c281602d3a385044ab928322a122a02 upstream.

    Aleksei hit the soft lockup during reading /proc/PID/smaps. David
    investigated the problem and suggested the right fix.

    while_each_thread() is racy and should die, this patch updates
    vm_is_stack().

    Signed-off-by: Oleg Nesterov
    Reported-by: Aleksei Besogonov
    Tested-by: Aleksei Besogonov
    Suggested-by: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Oleg Nesterov
     
  • commit aee7af356e151494d5014f57b33460b162f181b5 upstream.

    In the presence of delegations, we can no longer assume that the
    state->n_rdwr, state->n_rdonly, state->n_wronly reflect the open
    stateid share mode, and so we need to calculate the initial value
    for calldata->arg.fmode using the state->flags.

    Reported-by: James Drews
    Fixes: 88069f77e1ac5 (NFSv41: Fix a potential state leakage when...)
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit f87d928f6d98644d39809a013a22f981d39017cf upstream.

    When creating a new object on the NFS server, we should not be sending
    posix setacl requests unless the preceding posix_acl_create returned a
    non-trivial acl. Doing so, causes Solaris servers in particular to
    return an EINVAL.

    Fixes: 013cdf1088d72 (nfs: use generic posix ACL infrastructure,,,)
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1132786
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 3c45ddf823d679a820adddd53b52c6699c9a05ac upstream.

    The current code always selects XPRT_TRANSPORT_BC_TCP for the back
    channel, even when the forward channel was not TCP (eg, RDMA). When
    a 4.1 mount is attempted with RDMA, the server panics in the TCP BC
    code when trying to send CB_NULL.

    Instead, construct the transport protocol number from the forward
    channel transport or'd with XPRT_TRANSPORT_BC. Transports that do
    not support bi-directional RPC will not have registered a "BC"
    transport, causing create_backchannel_client() to fail immediately.

    Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=265
    Signed-off-by: Chuck Lever
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Chuck Lever
     
  • commit 7a9e75a185e6b3a3860e6a26fb6e88691fc2c9d9 upstream.

    There was a check for result being not NULL. But get_acl() may return
    NULL, or ERR_PTR, or actual pointer.
    The purpose of the function where current change is done is to "list
    ACLs only when they are available", so any error condition of get_acl()
    mustn't be elevated, and returning 0 there is still valid.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=81111
    Signed-off-by: Andrey Utkin
    Reviewed-by: Christoph Hellwig
    Fixes: 74adf83f5d77 (nfs: only show Posix ACLs in listxattr if actually...)
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Andrey Utkin
     
  • commit d9499a95716db0d4bc9b67e88fd162133e7d6b08 upstream.

    A memory allocation failure could cause nfsd_startup_generic to fail, in
    which case nfsd_users wouldn't be incorrectly left elevated.

    After nfsd restarts nfsd_startup_generic will then succeed without doing
    anything--the first consequence is likely nfs4_start_net finding a bad
    laundry_wq and crashing.

    Signed-off-by: Kinglong Mee
    Fixes: 4539f14981ce "nfsd: replace boolean nfsd_up flag by users counter"
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     
  • commit bdd405d2a5287bdb9b04670ea255e1f122138e66 upstream.

    If user specifies that USB autosuspend must be disabled by module
    parameter "usbcore.autosuspend=-1" then we must prevent
    autosuspend of USB hub devices as well.

    commit 596d789a211d introduced in v3.8 changed the original behaivour
    and stopped respecting the usbcore.autosuspend parameter for hubs.

    Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"

    Signed-off-by: Roger Quadros
    Tested-by: Michael Welling
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Roger Quadros
     
  • commit 5cbcc35e5bf0eae3c7494ce3efefffc9977827ae upstream.

    The roothub's index per controller is from 0, but the hub port index per hub
    is from 1, this patch fixes "can't find device at roohub" problem for connecting
    test fixture at roohub when do USB-IF Embedded Host High-Speed Electrical Test.

    This patch is for v3.12+.

    Signed-off-by: Peter Chen
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Peter Chen
     
  • commit 6817ae225cd650fb1c3295d769298c38b1eba818 upstream.

    This patch fixes a potential security issue in the whiteheat USB driver
    which might allow a local attacker to cause kernel memory corrpution. This
    is due to an unchecked memcpy into a fixed size buffer (of 64 bytes). On
    EHCI and XHCI busses it's possible to craft responses greater than 64
    bytes leading a buffer overflow.

    Signed-off-by: James Forshaw
    Signed-off-by: Greg Kroah-Hartman

    James Forshaw
     
  • commit 646907f5bfb0782c731ae9ff6fb63471a3566132 upstream.

    Added support to the ftdi_sio driver for ekey Converter USB which
    uses an FT232BM chip.

    Signed-off-by: Jaša Bartelj
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Jaša Bartelj
     
  • commit 6552cc7f09261db2aeaae389aa2c05a74b3a93b4 upstream.

    Add device id for Basic Micro ATOM Nano USB2Serial adapters.

    Reported-by: Nicolas Alt
    Tested-by: Nicolas Alt
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit cc824534d4fef0e46e4486d5c1e10d3c6b1ebadc upstream.

    Looks like MUSB cable removal can cause wake-up interrupts to
    stop working for device tree based booting at least for UART3
    even as nothing is dynamically remuxed. This can be fixed by
    calling reconfigure_io_chain() for device tree based booting
    in hwmod code. Note that we already do that for legacy booting
    if the legacy mux is configured.

    My guess is that this is related to UART3 and MUSB ULPI
    hsusb0_data0 and hsusb0_data1 support for Carkit mode that
    somehow affect the configured IO chain for UART3 and require
    rearming the wake-up interrupts.

    In general, for device tree based booting, pinctrl-single
    calls the rearm hook that in turn calls reconfigure_io_chain
    so calling reconfigure_io_chain should not be needed from the
    hwmod code for other events.

    So let's limit the hwmod rearming of iochain only to
    HWMOD_FORCE_MSTANDBY where MUSB is currently the only user
    of it. If we see other devices needing similar changes we can
    add more checks for it.

    Cc: Paul Walmsley
    Signed-off-by: Tony Lindgren
    Signed-off-by: Greg Kroah-Hartman

    Tony Lindgren
     
  • commit 2597fe99bb0259387111d0431691f5daac84f5a5 upstream.

    AMD xHC also needs short tx quirk after tested on most of chipset
    generations. That's because there is the same incorrect behavior like
    Fresco Logic host. Please see below message with on USB webcam
    attached on xHC host:

    [ 139.262944] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.266934] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.270913] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.274937] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.278914] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.282936] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.286915] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.290938] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.294913] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
    [ 139.298917] xhci_hcd 0000:00:10.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?

    Reported-by: Arindam Nath
    Tested-by: Shriraj-Rai P
    Signed-off-by: Huang Rui
    Signed-off-by: Mathias Nyman
    Signed-off-by: Greg Kroah-Hartman

    Huang Rui
     
  • commit 9a54886342e227433aebc9d374f8ae268a836475 upstream.

    When using a Renesas uPD720231 chipset usb-3 uas to sata bridge with a 120G
    Crucial M500 ssd, model string: Crucial_ CT120M500SSD1, together with a
    the integrated Intel xhci controller on a Haswell laptop:

    00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC [8086:9c31] (rev 04)

    The following error gets logged to dmesg:

    xhci error: Transfer event TRB DMA ptr not part of current TD

    Treating COMP_STOP the same as COMP_STOP_INVAL when no event_seg gets found
    fixes this.

    Signed-off-by: Hans de Goede
    Signed-off-by: Mathias Nyman
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit a2fa6721c7237b5a666f16f732628c0c09c0b954 upstream.

    The Elecom WDC-150SU2M uses this chip.

    Reported-by: Hiroki Kondo
    Signed-off-by: Larry Finger
    Signed-off-by: Greg Kroah-Hartman

    Larry Finger
     
  • commit 8626d524ef08f10fccc0c41e5f75aef8235edf47 upstream.

    The stick is not recognized.
    This dongle uses r8188eu but usb-id is missing.
    3.16.0

    Signed-off-by: Holger Paradies
    Signed-off-by: Larry Finger
    Signed-off-by: Greg Kroah-Hartman

    Holger Paradies
     
  • commit ec0a38bf8b28b036202070cf3ef271e343d9eafc upstream.

    Fix two reported bugs, caused by et131x_adapter->phydev->addr being accessed
    before it is initialised, by:

    - letting et131x_mii_write() take a phydev address, instead of using the one
    stored in adapter by default. This is so et131x_mdio_write() can use it's own
    addr value.
    - removing implementation of et131x_mdio_reset(), as it's not needed.
    - moving a call to et131x_disable_phy_coma() in et131x_pci_setup(), which uses
    phydev->addr, until after the mdiobus has been registered.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=80751
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=77121
    Signed-off-by: Mark Einon
    Signed-off-by: Greg Kroah-Hartman

    Mark Einon
     
  • commit db9ee220361de03ee86388f9ea5e529eaad5323c upstream.

    It turns out that there are some serious problems with the on-disk
    format of journal checksum v2. The foremost is that the function to
    calculate descriptor tag size returns sizes that are too big. This
    causes alignment issues on some architectures and is compounded by the
    fact that some parts of jbd2 use the structure size (incorrectly) to
    determine the presence of a 64bit journal instead of checking the
    feature flags.

    Therefore, introduce journal checksum v3, which enlarges the
    descriptor block tag format to allow for full 32-bit checksums of
    journal blocks, fix the journal tag function to return the correct
    sizes, and fix the jbd2 recovery code to use feature flags to
    determine 64bitness.

    Add a few function helpers so we don't have to open-code quite so
    many pieces.

    Switching to a 16-byte block size was found to increase journal size
    overhead by a maximum of 0.1%, to convert a 32-bit journal with no
    checksumming to a 32-bit journal with checksum v3 enabled.

    Signed-off-by: Darrick J. Wong
    Reported-by: TR Reardon
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Darrick J. Wong
     
  • commit 022eaa7517017efe4f6538750c2b59a804dc7df7 upstream.

    When recovering the journal, don't fall into an infinite loop if we
    encounter a corrupt journal block. Instead, just skip the block and
    return an error, which fails the mount and thus forces the user to run
    a full filesystem fsck.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Darrick J. Wong
     
  • commit 6603120e96eae9a5d6228681ae55c7fdc998d1bb upstream.

    In case of delalloc block i_disksize may be less than i_size. So we
    have to update i_disksize each time we allocated and submitted some
    blocks beyond i_disksize. We weren't doing this on the error paths,
    so fix this.

    testcase: xfstest generic/019

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

    Dmitry Monakhov
     
  • commit 8e8248b1369c97c7bb6f8bcaee1f05deeabab8ef upstream.

    NFC will leak buffer if send failed.
    Use single exit point that does the freeing

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 73ab4232388b7a08f17c8d08141ff2099fa0b161 upstream.

    If connect request is queued (e.g. device in pg) set client state
    to initializing, thus avoid preliminary exit in wait if current
    state is disconnected.

    This is regression from:

    commit e4d8270e604c3202131bac607969605ac397b893
    Author: Alexander Usyskin
    mei: set connecting state just upon connection request is sent to the fw

    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 38c1c2e44bacb37efd68b90b3f70386a8ee370ee upstream.

    The crash is

    ------------[ cut here ]------------
    kernel BUG at fs/btrfs/extent_io.c:2124!
    [...]
    Workqueue: btrfs-endio normal_work_helper [btrfs]
    RIP: 0010:[] [] end_bio_extent_readpage+0xb45/0xcd0 [btrfs]

    This is in fact a regression.

    It is because we forgot to increase @offset properly in reading corrupted block,
    so that the @offset remains, and this leads to checksum errors while reading
    left blocks queued up in the same bio, and then ends up with hiting the above
    BUG_ON.

    Reported-by: Chris Murphy
    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Liu Bo
     
  • commit ce62003f690dff38d3164a632ec69efa15c32cbf upstream.

    When failing to allocate space for the whole compressed extent, we'll
    fallback to uncompressed IO, but we've forgotten to redirty the pages
    which belong to this compressed extent, and these 'clean' pages will
    simply skip 'submit' part and go to endio directly, at last we got data
    corruption as we write nothing.

    Signed-off-by: Liu Bo
    Tested-By: Martin Steigerwald
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Liu Bo
     
  • commit 6f7ff6d7832c6be13e8c95598884dbc40ad69fb7 upstream.

    Before processing the extent buffer, acquire a read lock on it, so
    that we're safe against concurrent updates on the extent buffer.

    Signed-off-by: Filipe Manana
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Filipe Manana
     
  • commit 27b9a8122ff71a8cadfbffb9c4f0694300464f3b upstream.

    Under rare circumstances we can end up leaving 2 versions of a checksum
    for the same file extent range.

    The reason for this is that after calling btrfs_next_leaf we process
    slot 0 of the leaf it returns, instead of processing the slot set in
    path->slots[0]. Most of the time (by far) path->slots[0] is 0, but after
    btrfs_next_leaf() releases the path and before it searches for the next
    leaf, another task might cause a split of the next leaf, which migrates
    some of its keys to the leaf we were processing before calling
    btrfs_next_leaf(). In this case btrfs_next_leaf() returns again the
    same leaf but with path->slots[0] having a slot number corresponding
    to the first new key it got, that is, a slot number that didn't exist
    before calling btrfs_next_leaf(), as the leaf now has more keys than
    it had before. So we must really process the returned leaf starting at
    path->slots[0] always, as it isn't always 0, and the key at slot 0 can
    have an offset much lower than our search offset/bytenr.

    For example, consider the following scenario, where we have:

    sums->bytenr: 40157184, sums->len: 16384, sums end: 40173568
    four 4kb file data blocks with offsets 40157184, 40161280, 40165376, 40169472

    Leaf N:

    slot = 0 slot = btrfs_header_nritems() - 1
    |-------------------------------------------------------------------|
    | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4] |
    |-------------------------------------------------------------------|

    Leaf N + 1:

    slot = 0 slot = btrfs_header_nritems() - 1
    |--------------------------------------------------------------------|
    | [(CSUM CSUM 40161280), size 32] ... [((CSUM CSUM 40615936), size 8 |
    |--------------------------------------------------------------------|

    Because we are at the last slot of leaf N, we call btrfs_next_leaf() to
    find the next highest key, which releases the current path and then searches
    for that next key. However after releasing the path and before finding that
    next key, the item at slot 0 of leaf N + 1 gets moved to leaf N, due to a call
    to ctree.c:push_leaf_left() (via ctree.c:split_leaf()), and therefore
    btrfs_next_leaf() will returns us a path again with leaf N but with the slot
    pointing to its new last key (CSUM CSUM 40161280). This new version of leaf N
    is then:

    slot = 0 slot = btrfs_header_nritems() - 2 slot = btrfs_header_nritems() - 1
    |----------------------------------------------------------------------------------------------------|
    | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4] [(CSUM CSUM 40161280), size 32] |
    |----------------------------------------------------------------------------------------------------|

    And incorrecly using slot 0, makes us set next_offset to 39239680 and we jump
    into the "insert:" label, which will set tmp to:

    tmp = min((sums->len - total_bytes) >> blocksize_bits,
    (next_offset - file_key.offset) >> blocksize_bits) =
    min((16384 - 0) >> 12, (39239680 - 40157184) >> 12) =
    min(4, (u64)-917504 = 18446744073708634112 >> 12) = 4

    and

    ins_size = csum_size * tmp = 4 * 4 = 16 bytes.

    In other words, we insert a new csum item in the tree with key
    (CSUM_OBJECTID CSUM_KEY 40157184 = sums->bytenr) that contains the checksums
    for all the data (4 blocks of 4096 bytes each = sums->len). Which is wrong,
    because the item with key (CSUM CSUM 40161280) (the one that was moved from
    leaf N + 1 to the end of leaf N) contains the old checksums of the last 12288
    bytes of our data and won't get those old checksums removed.

    So this leaves us 2 different checksums for 3 4kb blocks of data in the tree,
    and breaks the logical rule:

    Key_N+1.offset >= Key_N.offset + length_of_data_its_checksums_cover

    An obvious bad effect of this is that a subsequent csum tree lookup to get
    the checksum of any of the blocks with logical offset of 40161280, 40165376
    or 40169472 (the last 3 4kb blocks of file data), will get the old checksums.

    Signed-off-by: Filipe Manana
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Filipe Manana
     
  • commit 4eb1f66dce6c4dc28dd90a7ffbe6b2b1cb08aa4e upstream.

    We've got bug reports that btrfs crashes when quota is enabled on
    32bit kernel, typically with the Oops like below:
    BUG: unable to handle kernel NULL pointer dereference at 00000004
    IP: [] find_parent_nodes+0x360/0x1380 [btrfs]
    *pde = 00000000
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 151 Comm: kworker/u8:2 Tainted: G S W 3.15.2-1.gd43d97e-default #1
    Workqueue: btrfs-qgroup-rescan normal_work_helper [btrfs]
    task: f1478130 ti: f147c000 task.ti: f147c000
    EIP: 0060:[] EFLAGS: 00010213 CPU: 0
    EIP is at find_parent_nodes+0x360/0x1380 [btrfs]
    EAX: f147dda8 EBX: f147ddb0 ECX: 00000011 EDX: 00000000
    ESI: 00000000 EDI: f147dda4 EBP: f147ddf8 ESP: f147dd38
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    CR0: 8005003b CR2: 00000004 CR3: 00bf3000 CR4: 00000690
    Stack:
    00000000 00000000 f147dda4 00000050 00000001 00000000 00000001 00000050
    00000001 00000000 d3059000 00000001 00000022 000000a8 00000000 00000000
    00000000 000000a1 00000000 00000000 00000001 00000000 00000000 11800000
    Call Trace:
    [] __btrfs_find_all_roots+0x9d/0xf0 [btrfs]
    [] btrfs_qgroup_rescan_worker+0x401/0x760 [btrfs]
    [] normal_work_helper+0xc8/0x270 [btrfs]
    [] process_one_work+0x11b/0x390
    [] worker_thread+0x101/0x340
    [] kthread+0x9b/0xb0
    [] ret_from_kernel_thread+0x21/0x30
    [] kthread_create_on_node+0x110/0x110

    This indicates a NULL corruption in prefs_delayed list. The further
    investigation and bisection pointed that the call of ulist_add_merge()
    results in the corruption.

    ulist_add_merge() takes u64 as aux and writes a 64bit value into
    old_aux. The callers of this function in backref.c, however, pass a
    pointer of a pointer to old_aux. That is, the function overwrites
    64bit value on 32bit pointer. This caused a NULL in the adjacent
    variable, in this case, prefs_delayed.

    Here is a quick attempt to band-aid over this: a new function,
    ulist_add_merge_ptr() is introduced to pass/store properly a pointer
    value instead of u64. There are still ugly void ** cast remaining
    in the callers because void ** cannot be taken implicitly. But, it's
    safer than explicit cast to u64, anyway.

    Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=887046
    Signed-off-by: Takashi Iwai
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 0758f4f732b08b6ef07f2e5f735655cf69fea477 upstream.

    When copy_from_user fails, return -EFAULT, not -ENOMEM

    Signed-off-by: Stephen M. Cameron
    Reported-by: Robert Elliott
    Reviewed-by: Joe Handzik
    Reviewed-by: Scott Teel
    Reviewed by: Mike MIller
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Greg Kroah-Hartman

    Stephen M. Cameron
     
  • commit 8d5999df35314607c38fbd6bdd709e25c3a4eeab upstream.

    If the timer irqs are resumed during device resume it is possible in
    certain circumstances for the resume to hang early on, before device
    interrupts are resumed. For an Ubuntu 14.04 PVHVM guest this would
    occur in ~0.5% of resume attempts.

    It is not entirely clear what is occuring the point of the hang but I
    think a task necessary for the resume calls schedule_timeout(),
    waiting for a timer interrupt (which never arrives). This failure may
    require specific tasks to be running on the other VCPUs to trigger
    (processes are not frozen during a suspend/resume if PREEMPT is
    disabled).

    Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in
    syscore_resume().

    Signed-off-by: David Vrabel
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Greg Kroah-Hartman

    David Vrabel
     
  • commit 7d951f3ccb0308c95bf76d5eef9886dea35a7013 upstream.

    Commit b7dd0e350e0b (x86/xen: safely map and unmap grant frames when
    in atomic context) causes PVH guests to crash in
    arch_gnttab_map_shared() when they attempted to map the pages for the
    grant table.

    This use of a PV-specific function during the PVH grant table setup is
    non-obvious and not needed. The standard vmap() function does the
    right thing.

    Signed-off-by: David Vrabel
    Reported-by: Mukesh Rathor
    Tested-by: Mukesh Rathor
    Signed-off-by: Greg Kroah-Hartman

    David Vrabel
     
  • commit 7b2a583afb4ab894f78bc0f8bd136e96b6499a7e upstream.

    Without CONFIG_RELOCATABLE the early boot code will decompress the
    kernel to LOAD_PHYSICAL_ADDR. While this may have been fine in the BIOS
    days, that isn't going to fly with UEFI since parts of the firmware
    code/data may be located at LOAD_PHYSICAL_ADDR.

    Straying outside of the bounds of the regions we've explicitly requested
    from the firmware will cause all sorts of trouble. Bruno reports that
    his machine resets while trying to decompress the kernel image.

    We already go to great pains to ensure the kernel is loaded into a
    suitably aligned buffer, it's just that the address isn't necessarily
    LOAD_PHYSICAL_ADDR, because we can't guarantee that address isn't in-use
    by the firmware.

    Explicitly enforce CONFIG_RELOCATABLE for the EFI boot stub, so that we
    can load the kernel at any address with the correct alignment.

    Reported-by: Bruno Prémont
    Tested-by: Bruno Prémont
    Cc: H. Peter Anvin
    Signed-off-by: Matt Fleming
    Signed-off-by: Greg Kroah-Hartman

    Matt Fleming
     
  • commit dcecb8fd93a65787130a74e61fdf29932c8d85eb upstream.

    When using the FIFO-based ABI on x86_64, if the last port is at the
    end of an event array page then sync_test_bit() on this port's event
    word will read beyond the end of the page and in certain circumstances
    this may fault.

    The fault requires the following page in the kernel's direct mapping
    to be not present, which would mean:

    a) the array page is the last page of RAM; or

    b) the following page is ballooned out /and/ it has been used for a
    foreign mapping by a kernel driver (such as netback or blkback)
    /and/ the grant has been unmapped.

    Use the infrastructure added for arm64 to ensure that all bitops
    operating on event words are unsigned long aligned.

    Signed-off-by: David Vrabel
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Greg Kroah-Hartman

    David Vrabel
     
  • commit 0b9e7b741f2bf8103b15bb14d5b4a6f5ee91c59a upstream.

    commit 28e134464734 "[SCSI] hpsa: enable unit attention reporting"
    turns on unit attention notifications, but got the change wrong for
    all architectures other than x86, which now store an uninitialized
    value into the device register.

    Gcc helpfully warns about this:

    ../drivers/scsi/hpsa.c: In function 'hpsa_set_driver_support_bits':
    ../drivers/scsi/hpsa.c:6373:17: warning: 'driver_support' is used uninitialized in this function [-Wuninitialized]
    driver_support |= ENABLE_UNIT_ATTN;
    ^

    This moves the #ifdef so only the prefetch-enable is conditional
    on x86, not also reading the initial register contents.

    Signed-off-by: Arnd Bergmann
    Fixes: 28e134464734 "[SCSI] hpsa: enable unit attention reporting"
    Acked-by: Stephen M. Cameron
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 53b884ac3745353de220d92ef792515c3ae692f0 upstream.

    This commit in Linux 3.6:

    commit c767a54ba0657e52e6edaa97cbe0b0a8bf1c1655
    Author: Joe Perches
    Date: Mon May 21 19:50:07 2012 -0700

    x86/debug: Add KERN_ to bare printks, convert printks to pr_

    caused warn_bad_vsyscall to output garbage in the middle of the
    line. Revert the bad part of it.

    The printk in question isn't actually bare; the level is "%s".

    The bug this fixes is purely cosmetic; backports are optional.

    Signed-off-by: Andy Lutomirski
    Link: http://lkml.kernel.org/r/03eac1f24110bbe496ecc12a4df467e0d88466d4.1406330947.git.luto@amacapital.net
    Signed-off-by: H. Peter Anvin
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • commit a32305bf90a2ae0e6a9a93370c7616565f75e15a upstream.

    powerpc defines various machine-specific routines for handling
    pci_set_dma_mask(). The routines for machine "PowerNV" may neglect
    to set dev->dma_mask. This could confuse anyone (e.g. drivers) that
    consult dev->dma_mask to find the current mask. Set the dma_mask in
    the PowerNV leaf routine.

    Signed-off-by: Brian W. Hart
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Brian W Hart
     
  • commit 7340056567e32b2c9d3554eb146e1977c93da116 upstream.

    Commit bcdde7e made __sysfs_remove_dir() recursive and introduced a BUG_ON
    during PHB removal while attempting to delete the power managment attribute
    group of the bus. This is a result of tearing the bridge and bus devices down
    out of order in remove_phb_dynamic. Since, the the bus resides below the bridge
    in the sysfs device tree it should be torn down first.

    This patch simply moves the device_unregister call for the PHB bridge device
    after the device_unregister call for the PHB bus.

    Fixes: bcdde7e221a8 ("sysfs: make __sysfs_remove_dir() recursive")
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Tyrel Datwyler
     
  • commit cbace46a9710a480cae51e4611697df5de41713e upstream.

    Commit 30919b0bf356 ("x86: avoid low BIOS area when allocating address
    space") moved the test for resource allocations that fall within the first
    1MB of address space from the PCI-specific path to a generic path, such
    that all resource allocations will avoid this area. However, this breaks
    ISA cards which need to allocate a memory region within the first 1MB. An
    example is the i82365 PCMCIA controller and derivatives like the Ricoh
    RF5C296/396 which map part of the PCMCIA socket memory address space into
    the first 1MB of system memory address space. They do not work anymore as
    no usable memory region exists due to this change:

    Intel ISA PCIC probe: Ricoh RF5C296/396 ISA-to-PCMCIA at port 0x3e0 ofs 0x00, 2 sockets
    host opts [0]: none
    host opts [1]: none
    ISA irqs (scanned) = 3,4,5,9,10 status change on irq 10
    pcmcia_socket pcmcia_socket1: pccard: PCMCIA card inserted into slot 1
    pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff
    pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: clean.
    pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x0d0000-0x0dffff: clean.
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x0e0000-0x0effff: clean.
    pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean.
    pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean.
    pcmcia_socket pcmcia_socket1: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff
    pcmcia_socket pcmcia_socket1: cs: IO port probe 0xa00-0xaff: clean.
    pcmcia_socket pcmcia_socket1: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0d0000-0x0dffff: clean.
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0e0000-0x0effff: clean.
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x60000000-0x60ffffff: clean.
    pcmcia_socket pcmcia_socket1: cs: memory probe 0xa0000000-0xa0ffffff: clean.
    pcmcia_socket pcmcia_socket1: cs: memory probe 0x0cc000-0x0effff: excluding 0xe0000-0xeffff
    pcmcia_socket pcmcia_socket1: cs: unable to map card memory!

    If filtering out the first 1MB is reverted, everything works as expected.

    Tested-by: Robert Resch
    Signed-off-by: Christoph Schulz
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Greg Kroah-Hartman

    Christoph Schulz
     
  • commit dcfa9be83866e28fcb8b7e22b4eeb4ba63bd3174 upstream.

    Fix errors in handling "device label" _DSM return values.

    If _DSM returns a Unicode string, the ACPI type is ACPI_TYPE_BUFFER, not
    ACPI_TYPE_STRING. Fix dsm_label_utf16s_to_utf8s() to convert UTF-16 from
    acpi_object->buffer instead of acpi_object->string.

    Prior to v3.14, we accepted Unicode labels (ACPI_TYPE_BUFFER return
    values). But after 1d0fcef73283, we accepted only ASCII (ACPI_TYPE_STRING)
    (and we incorrectly tried to convert those ASCII labels from UTF-16 to
    UTF-8).

    Rejecting Unicode labels made us return -EPERM when reading sysfs
    "acpi_index" or "label" files, which in turn caused on-board network
    interfaces on a Dell PowerEdge E420 to be renamed (by udev net_id internal)
    from eno1/eno2 to enp2s0f0/enp2s0f1.

    Fix this by accepting either ACPI_TYPE_STRING (and treating it as ASCII) or
    ACPI_TYPE_BUFFER (and converting from UTF-16 to UTF-8).

    [bhelgaas: changelog]
    Fixes: 1d0fcef73283 ("ACPI / PCI: replace open-coded _DSM code with helper functions")
    Signed-off-by: Simone Gotti
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Jiang Liu
    Signed-off-by: Greg Kroah-Hartman

    Simone Gotti