30 Sep, 2015

40 commits

  • commit 99b1a4c32ad22024ac6198a4337aaec5ea23168f upstream.

    It is rather pointless to test the value of transport->inet after
    calling xs_reset_transport(), since it will always be zero, and
    so we will never see any exponential back off behaviour.
    Also don't force early connections for SOFTCONN tasks. If the server
    disconnects us, we should respect the exponential backoff.

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

    Trond Myklebust
     
  • commit 051ac3848a94f21cfdec899cc9c65ce7f9f116fa upstream.

    `perf stat -e sunrpc:svc_xprt_do_enqueue true` results in

    Warning: unknown op '->'
    Warning: [sunrpc:svc_xprt_do_enqueue] unknown op '->'

    Similar warning for svc_handle_xprt as well.

    Actually TP_printk() should never dereference an address saved in the ring
    buffer that points somewhere in the kernel. There's no guarantee that that
    object still exists (with the exception of static strings).

    Therefore change all the arguments for TP_printk(), so that it references
    values existing in the ring buffer only.

    While doing that, also fix another possible bug when argument xprt could be
    NULL and TP_fast_assign() tries to access it's elements.

    Signed-off-by: Pratyush Anand
    Reviewed-by: Jeff Layton
    Acked-by: Steven Rostedt
    Fixes: 83a712e0afef "sunrpc: add some tracepoints around ..."
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Pratyush Anand
     
  • commit 36319608e28701c07cad80ae3be8b0fdfb1ab40f upstream.

    This reverts commit 4e379d36c050b0117b5d10048be63a44f5036115.

    This commit opens up a race between the recovery code and the open code.

    Reported-by: Olga Kornievskaia
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 4a1e2feb9d246775dee0f78ed5b18826bae2b1c5 upstream.

    According to RFC5661 Section 18.2.4, CLOSE is supposed to return
    the zero stateid. This means that nfs_clear_open_stateid_locked()
    cannot assume that the result stateid will always match the 'other'
    field of the existing open stateid when trying to determine a race
    with a parallel OPEN.

    Instead, we look at the argument, and check for matches.

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

    Trond Myklebust
     
  • commit d13549074cf066d6d5bb29903d044beffea342d3 upstream.

    According to the flexfiles protocol, the layoutreturn should specify an
    array of errors in the following format:

    struct ff_ioerr4 {
    offset4 ffie_offset;
    length4 ffie_length;
    stateid4 ffie_stateid;
    device_error4 ffie_errors<>;
    };

    This patch fixes up the code to ensure that our ffie_errors is indeed
    encoded as an array (albeit with only a single entry).

    Reported-by: Tom Haynes
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 5420401079e152ff68a8024f6a375804b1c21505 upstream.

    We do not want to update inode attributes with DS values.

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

    Peng Tao
     
  • commit aaae3f00d3f67f681a1f3cb7af999e976e8a24ce upstream.

    If the ctime or mtime or change attribute have changed because
    of an operation we initiated, we should make sure that we force
    an attribute update. However we do not want to mark the page cache
    for revalidation.

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

    Trond Myklebust
     
  • commit 69f230d907e8c1ca3f9bd528993eeb98f712b0dd upstream.

    Otherwise we break fstest case tests/read_write/mctime.t

    Does files layout need the same fix as well?

    Cc: Anna Schumaker
    Signed-off-by: Peng Tao
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Peng Tao
     
  • commit e9ae58aeee8842a50f7e199d602a5ccb2e41a95f upstream.

    We should ensure that we always set the pgio_header's error field
    if a READ or WRITE RPC call returns an error. The current code depends
    on 'hdr->good_bytes' always being initialised to a large value, which
    is not always done correctly by callers.
    When this happens, applications may end up missing important errors.

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

    Trond Myklebust
     
  • commit 18e3b739fdc826481c6a1335ce0c5b19b3d415da upstream.

    ---Steps to Reproduce--

    # cat /etc/exports
    /nfs/referal *(rw,insecure,no_subtree_check,no_root_squash,crossmnt)
    /nfs/old *(ro,insecure,subtree_check,root_squash,crossmnt)

    # mount -t nfs nfs-server:/nfs/ /mnt/
    # ll /mnt/*/

    # cat /etc/exports
    /nfs/referal *(rw,insecure,no_subtree_check,no_root_squash,crossmnt,refer=/nfs/old/@nfs-server)
    /nfs/old *(ro,insecure,subtree_check,root_squash,crossmnt)
    # service nfs restart

    # ll /mnt/*/ --->>>>> oops here

    [ 5123.102925] BUG: unable to handle kernel NULL pointer dereference at (null)
    [ 5123.103363] IP: [] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
    [ 5123.103752] PGD 587b9067 PUD 3cbf5067 PMD 0
    [ 5123.104131] Oops: 0000 [#1]
    [ 5123.104529] Modules linked in: nfsv4(OE) nfs(OE) fscache(E) nfsd(OE) xfs libcrc32c iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi coretemp crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel ppdev vmw_balloon parport_pc parport i2c_piix4 shpchp auth_rpcgss nfs_acl vmw_vmci lockd grace sunrpc vmwgfx drm_kms_helper ttm drm mptspi serio_raw scsi_transport_spi e1000 mptscsih mptbase ata_generic pata_acpi [last unloaded: nfsd]
    [ 5123.105887] CPU: 0 PID: 15853 Comm: ::1-manager Tainted: G OE 4.2.0-rc6+ #214
    [ 5123.106358] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/20/2014
    [ 5123.106860] task: ffff88007620f300 ti: ffff88005877c000 task.ti: ffff88005877c000
    [ 5123.107363] RIP: 0010:[] [] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
    [ 5123.107909] RSP: 0018:ffff88005877fdb8 EFLAGS: 00010246
    [ 5123.108435] RAX: ffff880053f3bc00 RBX: ffff88006ce6c908 RCX: ffff880053a0d240
    [ 5123.108968] RDX: ffffea0000e6d940 RSI: ffff8800399a0000 RDI: ffff88006ce6c908
    [ 5123.109503] RBP: ffff88005877fe28 R08: ffffffff81c708a0 R09: 0000000000000000
    [ 5123.110045] R10: 00000000000001a2 R11: ffff88003ba7f5c8 R12: ffff880054c55800
    [ 5123.110618] R13: 0000000000000000 R14: ffff880053a0d240 R15: ffff880053a0d240
    [ 5123.111169] FS: 0000000000000000(0000) GS:ffffffff81c27000(0000) knlGS:0000000000000000
    [ 5123.111726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 5123.112286] CR2: 0000000000000000 CR3: 0000000054cac000 CR4: 00000000001406f0
    [ 5123.112888] Stack:
    [ 5123.113458] ffffea0000e6d940 ffff8800399a0000 00000000000167d0 0000000000000000
    [ 5123.114049] 0000000000000000 0000000000000000 0000000000000000 00000000a7ec82c6
    [ 5123.114662] ffff88005877fe18 ffffea0000e6d940 ffff8800399a0000 ffff880054c55800
    [ 5123.115264] Call Trace:
    [ 5123.115868] [] nfs4_try_migration+0xbb/0x220 [nfsv4]
    [ 5123.116487] [] nfs4_run_state_manager+0x4ab/0x7b0 [nfsv4]
    [ 5123.117104] [] ? nfs4_do_reclaim+0x510/0x510 [nfsv4]
    [ 5123.117813] [] kthread+0xd7/0xf0
    [ 5123.118456] [] ? kthread_worker_fn+0x160/0x160
    [ 5123.119108] [] ret_from_fork+0x3f/0x70
    [ 5123.119723] [] ? kthread_worker_fn+0x160/0x160
    [ 5123.120329] Code: 4c 8b 6a 58 74 17 eb 52 48 8d 55 a8 89 c6 4c 89 e7 e8 4a b5 ff ff 8b 45 b0 85 c0 74 1c 4c 89 f9 48 8b 55 90 48 8b 75 98 48 89 df ff 55 00 3d e8 d8 ff ff 41 89 c6 74 cf 48 8b 4d c8 65 48 33
    [ 5123.121643] RIP [] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
    [ 5123.122308] RSP
    [ 5123.122942] CR2: 0000000000000000

    Fixes: ec011fe847 ("NFS: Introduce a vector of migration recovery ops")
    Signed-off-by: Kinglong Mee
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     
  • commit 6f536936b79bd4b5cea8fb0e5b8b0bce8cd1ea4a upstream.

    - Switch back to using list_for_each_entry(). Fixes an incorrect test
    for list NULL termination.
    - Do not assume that lists are sorted.
    - Finally, consider an existing entry to match if it consists of a subset
    of the addresses in the new entry.

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

    Trond Myklebust
     
  • commit 7c2dad99d60c86ec686b3bfdcb787c450a7ea89f upstream.

    Chuck reports seeing cases where a GETATTR that happens to race
    with an asynchronous WRITE is overriding the file size, despite
    the attribute barrier being set by the writeback code.

    The culprit turns out to be the check in nfs_ctime_need_update(),
    which sees that the ctime is newer than the cached ctime, and
    assumes that it is safe to override the attribute barrier.
    This patch removes that override, and ensures that attribute
    barriers are always respected.

    Reported-by: Chuck Lever
    Fixes: a08a8cd375db9 ("NFS: Add attribute update barriers to NFS writebacks")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.

    It is unusual to combine the open flags O_RDONLY and O_EXCL, but
    it appears that libre-office does just that.

    [pid 3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
    [pid 3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL

    NFSv4 takes O_EXCL as a sign that a setattr command should be sent,
    probably to reset the timestamps.

    When it was an O_RDONLY open, the SETATTR command does not
    identify any actual attributes to change.
    If no delegation was provided to the open, the SETATTR uses the
    all-zeros stateid and the request is accepted (at least by the
    Linux NFS server - no harm, no foul).

    If a read-delegation was provided, this is used in the SETATTR
    request, and a Netapp filer will justifiably claim
    NFS4ERR_BAD_STATEID, which the Linux client takes as a sign
    to retry - indefinitely.

    So only treat O_EXCL specially if O_CREAT was also given.

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

    NeilBrown
     
  • commit 3fcbbd244ed1d20dc0eb7d48d729503992fa9b7d upstream.

    It's possible that a DELEGRETURN could race with (e.g.) client expiry,
    in which case we could end up putting the delegation hash reference more
    than once.

    Have unhash_delegation_locked return a bool that indicates whether it
    was already unhashed. In the case of destroy_delegation we only
    conditionally put the hash reference if that returns true.

    The other callers of unhash_delegation_locked call it while walking
    list_heads that shouldn't yet be detached. If we find that it doesn't
    return true in those cases, then throw a WARN_ON as that indicates that
    we have a partially hashed delegation, and that something is likely very
    wrong.

    Tested-by: Andrew W Elble
    Tested-by: Anna Schumaker
    Signed-off-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     
  • commit e85687393f3ee0a77ccca016f903d1558bb69258 upstream.

    When an open or lock stateid is hashed, we take an extra reference to
    it. When we unhash it, we drop that reference. The code however does
    not properly account for the case where we have two callers concurrently
    trying to unhash the stateid. This can lead to list corruption and the
    hash reference being put more than once.

    Fix this by having unhash_ol_stateid use list_del_init on the st_perfile
    list_head, and then testing to see if that list_head is empty before
    releasing the hash reference. This means that some of the unhashing
    wrappers now become bool return functions so we can test to see whether
    the stateid was unhashed before we put the reference.

    Reported-by: Andrew W Elble
    Tested-by: Andrew W Elble
    Reported-by: Anna Schumaker
    Tested-by: Anna Schumaker
    Signed-off-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     
  • commit 6896f15aabde505b35888039af93d1d182a0108a upstream.

    Currently we'll respond correctly to a request for either
    FS_LAYOUT_TYPES or LAYOUT_TYPES, but not to a request for both
    attributes simultaneously.

    Signed-off-by: Kinglong Mee
    Reviewed-by: Christoph Hellwig
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    Kinglong Mee
     
  • commit 2b83d3de4c18af49800e0b26ae013db4fcf43a4a upstream.

    pNFS writes don't return attributes, however that doesn't mean that we
    should ignore the fact that they may be extending the file. This patch
    ensures that if a write is seen to extend the file, then we always set
    an attribute barrier, and update the cached file size.

    Signed-off-by: Trond Myklebust
    Cc: Peng Tao
    Signed-off-by: Greg Kroah-Hartman

    Trond Myklebust
     
  • commit 1f9b8c8fbc9a4d029760b16f477b9d15500e3a34 upstream.

    While we are committing a transaction, it's possible the previous one is
    still finishing its commit and therefore we wait for it to finish first.
    However we were not checking if that previous transaction ended up getting
    aborted after we waited for it to commit, so we ended up committing the
    current transaction which can lead to fs corruption because the new
    superblock can point to trees that have had one or more nodes/leafs that
    were never durably persisted.
    The following sequence diagram exemplifies how this is possible:

    CPU 0 CPU 1

    transaction N starts

    (...)

    btrfs_commit_transaction(N)

    cur_trans->state = TRANS_STATE_COMMIT_START;
    (...)
    cur_trans->state = TRANS_STATE_COMMIT_DOING;
    (...)

    cur_trans->state = TRANS_STATE_UNBLOCKED;
    root->fs_info->running_transaction = NULL;

    btrfs_start_transaction()
    --> starts transaction N + 1

    btrfs_write_and_wait_transaction(trans, root);
    --> starts writing all new or COWed ebs created
    at transaction N

    creates some new ebs, COWs some
    existing ebs but doesn't COW or
    deletes eb X

    btrfs_commit_transaction(N + 1)
    (...)
    cur_trans->state = TRANS_STATE_COMMIT_START;
    (...)
    wait_for_commit(root, prev_trans);
    --> prev_trans == transaction N

    btrfs_write_and_wait_transaction() continues
    writing ebs
    --> fails writing eb X, we abort transaction N
    and set bit BTRFS_FS_STATE_ERROR on
    fs_info->fs_state, so no new transactions
    can start after setting that bit

    cleanup_transaction()
    btrfs_cleanup_one_transaction()
    wakes up task at CPU 1

    continues, doesn't abort because
    cur_trans->aborted (transaction N + 1)
    is zero, and no checks for bit
    BTRFS_FS_STATE_ERROR in fs_info->fs_state
    are made

    btrfs_write_and_wait_transaction(trans, root);
    --> succeeds, no errors during writeback

    write_ctree_super(trans, root, 0);
    --> succeeds
    --> we have now a superblock that points us
    to some root that uses eb X, which was
    never written to disk

    In this scenario future attempts to read eb X from disk results in an
    error message like "parent transid verify failed on X wanted Y found Z".

    So fix this by aborting the current transaction if after waiting for the
    previous transaction we verify that it was aborted.

    Signed-off-by: Filipe Manana
    Reviewed-by: Josef Bacik
    Reviewed-by: Liu Bo
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Filipe Manana
     
  • commit c99235fa3ef833c3c23926085f2bb68851c8460a upstream.

    There was a race condition where during cleanup/release operation
    on-going streaming would cause a kernel panic because the hardware
    module was disabled prematurely with IRQ still pending.

    Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver support for AM437X")

    Signed-off-by: Benoit Parrot
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Benoit Parrot
     
  • commit f47c9045643f91e76d8a9030828b9fe1cf4a6bcf upstream.

    Upon a S_FMT the input/requested frame size and pixel format is
    overwritten by the current sub-device settings.
    Fix this so application can actually set the frame size and format.

    Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver support for AM437X")

    Signed-off-by: Benoit Parrot
    Acked-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Benoit Parrot
     
  • commit 9d39f05490115bf145e5ea03c0b7ec9d3d015b01 upstream.

    Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
    modified the media controller link setup notification API and updated the
    OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
    turning power on after setting the link instead of before. This results in
    sub-devices not being powered down in some cases when they should be. Fix
    it.

    Fixes: 813f5c0ac5cc [media] media: Change media device link_notify behaviour

    Signed-off-by: Sakari Ailus
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus
     
  • commit a66b0c41ad277ae62a3ae6ac430a71882f899557 upstream.

    The input_dev is already gone when the rc device is being unregistered
    so checking for its presence only means that no remove uevent will be
    generated.

    Signed-off-by: David Härdeman
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    David Härdeman
     
  • commit 2f064f3485cd29633ad1b3cfb00cc519509a3d72 upstream.

    Commit c48a11c7ad26 ("netvm: propagate page->pfmemalloc to skb") added
    checks for page->pfmemalloc to __skb_fill_page_desc():

    if (page->pfmemalloc && !page->mapping)
    skb->pfmemalloc = true;

    It assumes page->mapping == NULL implies that page->pfmemalloc can be
    trusted. However, __delete_from_page_cache() can set set page->mapping
    to NULL and leave page->index value alone. Due to being in union, a
    non-zero page->index will be interpreted as true page->pfmemalloc.

    So the assumption is invalid if the networking code can see such a page.
    And it seems it can. We have encountered this with a NFS over loopback
    setup when such a page is attached to a new skbuf. There is no copying
    going on in this case so the page confuses __skb_fill_page_desc which
    interprets the index as pfmemalloc flag and the network stack drops
    packets that have been allocated using the reserves unless they are to
    be queued on sockets handling the swapping which is the case here and
    that leads to hangs when the nfs client waits for a response from the
    server which has been dropped and thus never arrive.

    The struct page is already heavily packed so rather than finding another
    hole to put it in, let's do a trick instead. We can reuse the index
    again but define it to an impossible value (-1UL). This is the page
    index so it should never see the value that large. Replace all direct
    users of page->pfmemalloc by page_is_pfmemalloc which will hide this
    nastiness from unspoiled eyes.

    The information will get lost if somebody wants to use page->index
    obviously but that was the case before and the original code expected
    that the information should be persisted somewhere else if that is
    really needed (e.g. what SLAB and SLUB do).

    [akpm@linux-foundation.org: fix blooper in slub]
    Fixes: c48a11c7ad26 ("netvm: propagate page->pfmemalloc to skb")
    Signed-off-by: Michal Hocko
    Debugged-by: Vlastimil Babka
    Debugged-by: Jiri Bohac
    Cc: Eric Dumazet
    Cc: David Miller
    Acked-by: Mel Gorman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Michal Hocko
     
  • commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream.

    The variable pmd_idx is not initialized for the first iteration of the
    for loop.

    Assign the proper value which indexes the start address.

    Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once'
    Signed-off-by: Minfei Huang
    Cc: tony.luck@intel.com
    Cc: wangnan0@huawei.com
    Cc: david.vrabel@citrix.com
    Reviewed-by: yinghai@kernel.org
    Link: http://lkml.kernel.org/r/1436703522-29552-1-git-send-email-mhuang@redhat.com
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Minfei Huang
     
  • commit 04697858d89e4bf2650364f8d6956e2554e8ef88 upstream.

    Tony Luck found on his setup, if memory block size 512M will cause crash
    during booting.

    BUG: unable to handle kernel paging request at ffffea0074000020
    IP: get_nid_for_pfn+0x17/0x40
    PGD 128ffcb067 PUD 128ffc9067 PMD 0
    Oops: 0000 [#1] SMP
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc8 #1
    ...
    Call Trace:
    ? register_mem_sect_under_node+0x66/0xe0
    register_one_node+0x17b/0x240
    ? pci_iommu_alloc+0x6e/0x6e
    topology_init+0x3c/0x95
    do_one_initcall+0xcd/0x1f0

    The system has non continuous RAM address:
    BIOS-e820: [mem 0x0000001300000000-0x0000001cffffffff] usable
    BIOS-e820: [mem 0x0000001d70000000-0x0000001ec7ffefff] usable
    BIOS-e820: [mem 0x0000001f00000000-0x0000002bffffffff] usable
    BIOS-e820: [mem 0x0000002c18000000-0x0000002d6fffefff] usable
    BIOS-e820: [mem 0x0000002e00000000-0x00000039ffffffff] usable

    So there are start sections in memory block not present. For example:

    memory block : [0x2c18000000, 0x2c20000000) 512M

    first three sections are not present.

    The current register_mem_sect_under_node() assume first section is
    present, but memory block section number range [start_section_nr,
    end_section_nr] would include not present section.

    For arch that support vmemmap, we don't setup memmap for struct page
    area within not present sections area.

    So skip the pfn range that belong to absent section.

    [akpm@linux-foundation.org: simplification]
    [rientjes@google.com: more simplification]
    Fixes: bdee237c0343 ("x86: mm: Use 2GB memory block size on large memory x86-64 systems")
    Fixes: 982792c782ef ("x86, mm: probe memory block size for generic x86 64bit")
    Signed-off-by: Yinghai Lu
    Signed-off-by: David Rientjes
    Reported-by: Tony Luck
    Tested-by: Tony Luck
    Cc: Greg KH
    Cc: Ingo Molnar
    Tested-by: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Yinghai Lu
     
  • commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.

    With the radeon driver loaded the HP Compaq dc5750
    Small Form Factor machine fails to resume from suspend.
    Adding a quirk similar to other devices avoids
    the problem and the system resumes properly.

    Signed-off-by: Jeffery Miller
    Signed-off-by: Alex Deucher
    Signed-off-by: Greg Kroah-Hartman

    Jeffery Miller
     
  • commit 4c17a6d56bb0cad3066a714e94f7185a24b40f49 upstream.

    This might lead to local privilege escalation (code execution as
    kernel) for systems where the following conditions are met:

    - CONFIG_CIFS_SMB2 and CONFIG_CIFS_POSIX are enabled
    - a cifs filesystem is mounted where:
    - the mount option "vers" was used and set to a value >=2.0
    - the attacker has write access to at least one file on the filesystem

    To attack this, an attacker would have to guess the target_tcon
    pointer (but guessing wrong doesn't cause a crash, it just returns an
    error code) and win a narrow race.

    Signed-off-by: Jann Horn
    Signed-off-by: Steve French
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     
  • commit 36b35d5d807b7e57aff7d08e63de8b17731ee211 upstream.

    If we had secondary hash flag set, we ended up modifying hash value in
    the updatepp code path. Hence with a failed updatepp we will be using
    a wrong hash value for the following hash insert. Fix this by
    recomputing hash before insert.

    Without this patch we can end up with using wrong slot number in linux
    pte. That can result in us missing an hash pte update or invalidate
    which can cause memory corruption or even machine check.

    Fixes: 6d492ecc6489 ("powerpc/THP: Add code to handle HPTE faults for hugepages")
    Signed-off-by: Aneesh Kumar K.V
    Reviewed-by: Paul Mackerras
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Aneesh Kumar K.V
     
  • commit 655471f54c2e395ba29ae4156ba0f49928177cc1 upstream.

    The kernel does it, not the boot wrapper, which breaks with some
    cross compilers that still default to ABI v1.

    Fixes: 147c05168fc8 ("powerpc/boot: Add support for 64bit little endian wrapper")
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Herrenschmidt
     
  • commit 2d6f0600b2cd755959527230ef5a6fba97bb762a upstream.

    vmx-crypto driver make use of some VSX instructions which are
    only available if VSX is enabled. Running in cases where VSX
    are not enabled vmx-crypto fails in a VSX exception.

    In order to fix this enable_kernel_vsx() was added to turn on
    VSX instructions for vmx-crypto.

    Signed-off-by: Leonidas S. Barbosa
    Signed-off-by: Herbert Xu
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Leonidas Da Silva Barbosa
     
  • commit 72cd7b44bc99376b3f3c93cedcd052663fcdf705 upstream.

    enable_kernel_vsx() function was commented since anything was using
    it. However, vmx-crypto driver uses VSX instructions which are
    only available if VSX is enable. Otherwise it rises an exception oops.

    This patch uncomment enable_kernel_vsx() routine and makes it available.

    Signed-off-by: Leonidas S. Barbosa
    Signed-off-by: Herbert Xu
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Leonidas Da Silva Barbosa
     
  • commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.

    The EPOW interrupt handler uses rtas_get_sensor(), which in turn
    uses rtas_busy_delay() to wait for RTAS becoming ready in case it
    is necessary. But rtas_busy_delay() is annotated with might_sleep()
    and thus may not be used by interrupts handlers like the EPOW handler!
    This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
    enabled:

    BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496
    in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
    CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
    Call Trace:
    [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable)
    [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180
    [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0
    [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0
    [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450
    [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300
    [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0
    [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260
    [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80
    [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200
    [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24
    [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110
    [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180

    Fix this issue by introducing a new rtas_get_sensor_fast() function
    that does not use rtas_busy_delay() - and thus can only be used for
    sensors that do not cause a BUSY condition - known as "fast" sensors.

    The EPOW sensor is defined to be "fast" in sPAPR - mpe.

    Fixes: 587f83e8dd50 ("powerpc/pseries: Use rtas_get_sensor in RAS code")
    Signed-off-by: Thomas Huth
    Reviewed-by: Nathan Fontenot
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Thomas Huth
     
  • commit 74b5037baa2011a2799e2c43adde7d171b072f9e upstream.

    The powerpc kernel can be built to have either a 4K PAGE_SIZE or a 64K
    PAGE_SIZE.

    However when built with a 4K PAGE_SIZE there is an additional config
    option which can be enabled, PPC_HAS_HASH_64K, which means the kernel
    also knows how to hash a 64K page even though the base PAGE_SIZE is 4K.

    This is used in one obscure configuration, to support 64K pages for SPU
    local store on the Cell processor when the rest of the kernel is using
    4K pages.

    In this configuration, pte_pagesize_index() is defined to just pass
    through its arguments to get_slice_psize(). However pte_pagesize_index()
    is called for both user and kernel addresses, whereas get_slice_psize()
    only knows how to handle user addresses.

    This has been broken forever, however until recently it happened to
    work. That was because in get_slice_psize() the large kernel address
    would cause the right shift of the slice mask to return zero.

    However in commit 7aa0727f3302 ("powerpc/mm: Increase the slice range to
    64TB"), the get_slice_psize() code was changed so that instead of a
    right shift we do an array lookup based on the address. When passed a
    kernel address this means we index way off the end of the slice array
    and return random junk.

    That is only fatal if we happen to hit something non-zero, but when we
    do return a non-zero value we confuse the MMU code and eventually cause
    a check stop.

    This fix is ugly, but simple. When we're called for a kernel address we
    return 4K, which is always correct in this configuration, otherwise we
    use the slice mask.

    Fixes: 7aa0727f3302 ("powerpc/mm: Increase the slice range to 64TB")
    Reported-by: Cyril Bur
    Signed-off-by: Michael Ellerman
    Reviewed-by: Aneesh Kumar K.V
    Signed-off-by: Greg Kroah-Hartman

    Michael Ellerman
     
  • commit 259800135c654a098d9f0adfdd3d1f20eef1f231 upstream.

    The config space of some PCI devices can't be accessed when their
    PEs are in frozen state. Otherwise, fenced PHB might be seen.
    Those PEs are identified with flag EEH_PE_CFG_RESTRICTED, meaing
    EEH_PE_CFG_BLOCKED is set automatically when the PE is put to
    frozen state (EEH_PE_ISOLATED). eeh_slot_error_detail() restores
    PCI device BARs with eeh_pe_restore_bars(), which then calls
    eeh_ops->restore_config() to reinitialize the PCI device in
    (OPAL) firmware. eeh_ops->restore_config() produces PCI config
    access that causes fenced PHB. The problem was reported on below
    adapter:

    0001:01:00.0 0200: 14e4:168e (rev 10)
    0001:01:00.0 Ethernet controller: Broadcom Corporation \
    NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)

    This fixes the issue by skipping eeh_pe_restore_bars() in
    eeh_slot_error_detail() when EEH_PE_CFG_BLOCKED is set for the PE.

    Fixes: b6541db1 ("powerpc/eeh: Block PCI config access upon frozen PE")
    Reported-by: Manvanthara B. Puttashankar
    Signed-off-by: Gavin Shan
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Gavin Shan
     
  • commit e642d11bdbfe8eb10116ab3959a2b5d75efda832 upstream.

    In the complete hotplug case, EEH PEs are supposed to be released
    and set to NULL. Normally, this is done by eeh_remove_device(),
    which is called from pcibios_release_device().

    However, if something is holding a kref to the device, it will not
    be released, and the PE will remain. eeh_add_device_late() has
    a check for this which will explictly destroy the PE in this case.

    This check in eeh_add_device_late() occurs after a call to
    eeh_ops->probe(). On PowerNV, probe is a pointer to pnv_eeh_probe(),
    which will exit without probing if there is an existing PE.

    This means that on PowerNV, devices with outstanding krefs will not
    be rediscovered by EEH correctly after a complete hotplug. This is
    affecting CXL (CAPI) devices in the field.

    Put the probe after the kref check so that the PE is destroyed
    and affected devices are correctly rediscovered by EEH.

    Fixes: d91dafc02f42 ("powerpc/eeh: Delay probing EEH device during hotplug")
    Cc: Gavin Shan
    Signed-off-by: Daniel Axtens
    Acked-by: Gavin Shan
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Daniel Axtens
     
  • commit 590c7567a2895f939525ead57b0334c6d47986f0 upstream.

    Commit cca87d30 ("powerpc/pci: Refactor pci_dn") introduced pdn
    list for SRIOV VFs. It means the pdn is be put into the child list
    of its parent pdn when the pdn is created. When doing PCI hot
    unplugging on pSeries, the PCI device node as well as its pdn are
    released through procfs entry "powerpc/ofdt". Some one else grabs
    the memory chunk of the pdn and update it accordingly. At the same
    time, the pdn is still tracked in the child list of parent pdn. It
    leads to corrupted child list in the parent pdn.

    This fixes above issue by removing the pdn from the child list of
    its parent pdn when the device node is detached from the system.
    Note the pdn is free'd when the device node is released if the
    device node is dynamic one. Otherwise, the device node as well
    as the pdn won't be released.

    Fixes: cca87d30 ("powerpc/pci: Refactor pci_dn")
    Reported-by: Santwana Samantray
    Signed-off-by: Gavin Shan
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Gavin Shan
     
  • commit 1ab36387ea4face01aac3560b396b1e2ce07c4ff upstream.

    Not all gpio banks are necessarily enabled, in the current code this can
    lead to null pointer dereferences.

    [ 51.130000] Unable to handle kernel NULL pointer dereference at virtual address 00000058
    [ 51.130000] pgd = dee04000
    [ 51.130000] [00000058] *pgd=3f66d831, *pte=00000000, *ppte=00000000
    [ 51.140000] Internal error: Oops: 17 [#1] ARM
    [ 51.140000] Modules linked in:
    [ 51.140000] CPU: 0 PID: 1664 Comm: cat Not tainted 4.1.1+ #6
    [ 51.140000] Hardware name: Atmel SAMA5
    [ 51.140000] task: df6dd880 ti: dec60000 task.ti: dec60000
    [ 51.140000] PC is at at91_pinconf_get+0xb4/0x200
    [ 51.140000] LR is at at91_pinconf_get+0xb4/0x200
    [ 51.140000] pc : [] lr : [] psr: 600f0013
    sp : dec61e48 ip : 600f0013 fp : df522538
    [ 51.140000] r10: df52250c r9 : 00000058 r8 : 00000068
    [ 51.140000] r7 : 00000000 r6 : df53c910 r5 : 00000000 r4 : dec61e7c
    [ 51.140000] r3 : 00000000 r2 : c06746d4 r1 : 00000000 r0 : 00000003
    [ 51.140000] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 51.140000] Control: 10c53c7d Table: 3ee04059 DAC: 00000015
    [ 51.140000] Process cat (pid: 1664, stack limit = 0xdec60208)
    [ 51.140000] Stack: (0xdec61e48 to 0xdec62000)
    [ 51.140000] 1e40: 00000358 00000000 df522500 ded15f80 c05a9d08 ded15f80
    [ 51.140000] 1e60: 0000048c 00000061 df522500 ded15f80 c05a9d08 c01e7304 ded15f80 00000000
    [ 51.140000] 1e80: c01e6008 00000060 0000048c c01e6034 c01e5f6c ded15f80 dec61ec0 00000000
    [ 51.140000] 1ea0: 00020000 ded6f280 dec61f80 00000001 00000001 c00ae0b8 b6e80000 ded15fb0
    [ 51.140000] 1ec0: 00000000 00000000 df4bc974 00000055 00000800 ded6f280 b6e80000 ded6f280
    [ 51.140000] 1ee0: ded6f280 00020000 b6e80000 00000000 00020000 c0090dec c0671e1c dec61fb0
    [ 51.140000] 1f00: b6f8b510 00000001 00004201 c000924c 00000000 00000003 00000003 00000000
    [ 51.140000] 1f20: df4bc940 00022000 00000022 c066e188 b6e7f000 c00836f4 000b6e7f ded6f280
    [ 51.140000] 1f40: ded6f280 b6e80000 dec61f80 ded6f280 00020000 c0091508 00000000 00000003
    [ 51.140000] 1f60: 00022000 00000000 00000000 ded6f280 ded6f280 00020000 b6e80000 c0091d9c
    [ 51.140000] 1f80: 00000000 00000000 ffffffff 00020000 00020000 b6e80000 00000003 c000f124
    [ 51.140000] 1fa0: dec60000 c000efa0 00020000 00020000 00000003 b6e80000 00020000 000271c4
    [ 51.140000] 1fc0: 00020000 00020000 b6e80000 00000003 7fffe000 00000000 00000000 00020000
    [ 51.140000] 1fe0: 00000000 bef50b64 00013835 b6f29c76 400f0030 00000003 00000000 00000000
    [ 51.140000] [] (at91_pinconf_get) from [] (at91_pinconf_dbg_show+0x18/0x2c0)
    [ 51.140000] [] (at91_pinconf_dbg_show) from [] (pinconf_pins_show+0xc8/0xf8)
    [ 51.140000] [] (pinconf_pins_show) from [] (seq_read+0x1a0/0x464)
    [ 51.140000] [] (seq_read) from [] (__vfs_read+0x20/0xd0)
    [ 51.140000] [] (__vfs_read) from [] (vfs_read+0x7c/0x108)
    [ 51.140000] [] (vfs_read) from [] (SyS_read+0x40/0x94)
    [ 51.140000] [] (SyS_read) from [] (ret_fast_syscall+0x0/0x3c)
    [ 51.140000] Code: eb010ec2 e30a0d08 e34c005a eb0ae5a7 (e5993000)
    [ 51.150000] ---[ end trace fb3c370da3ea4794 ]---

    Fixes: a0b957f306fa ("pinctrl: at91: allow to have disabled gpio bank")
    Signed-off-by: David Dueck
    Acked-by: Ludovic Desroches
    Acked-by: Alexandre Belloni
    Acked-by: Nicolas Ferre
    Cc: Boris Brezillon
    Cc: Jean-Christophe PLAGNIOL-VILLARD
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    David Dueck
     
  • commit 467e1436ba85f78b8c4610c4549eb255a8211c42 upstream.

    The M3800 is very minor workstation variant of the XPS 15 which has
    already been patched for this issue. I figured it's probably more
    important for this version of the laptop to be patched than the
    regular XPS as Dell sells is pre-configured with Ubuntu to be used as
    a Linux workstation. I have tested the patch on my the hardware on
    Linux 4.2.0.

    Signed-off-by: Niranjan Sivakumar
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Niranjan Sivakumar
     
  • commit 1adecc6755e1e4193b5618ddb2e107f6d6e88f4b upstream.

    Dell laptop has a series model to use the same codec but different subsystem ID.
    At the same time they happens the white noise by login screen and headphone;
    for fixing them together, I only can add these IDs to FIXUP function ALC292_FIXUP_DISABLE_AAMIX,
    then try to solve such the similar issues.

    Codec: Realtek ALC3235
    Vendor Id: 0x10ec0293
    Subsystem Id: 0x102806dd
    Subsystem Id: 0x102806df
    Subsystem Id: 0x102806e0

    BugLink: https://bugs.launchpad.net/bugs/1492132
    Signed-off-by: Woodrow Shen
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Woodrow Shen
     
  • commit a161574e200ae63a5042120e0d8c36830e81bde3 upstream.

    It turned out that the machine has a bass speaker, so take a correct
    fixup entry.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai