14 Oct, 2013

40 commits

  • commit 117aad1e9e4d97448d1df3f84b08bd65811e6d6a upstream.

    Isolated balloon pages can wrongly end up in LRU lists when
    migrate_pages() finishes its round without draining all the isolated
    page list.

    The same issue can happen when reclaim_clean_pages_from_list() tries to
    reclaim pages from an isolated page list, before migration, in the CMA
    path. Such balloon page leak opens a race window against LRU lists
    shrinkers that leads us to the following kernel panic:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
    IP: [] shrink_page_list+0x24e/0x897
    PGD 3cda2067 PUD 3d713067 PMD 0
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 340 Comm: kswapd0 Not tainted 3.12.0-rc1-22626-g4367597 #87
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    RIP: shrink_page_list+0x24e/0x897
    RSP: 0000:ffff88003da499b8 EFLAGS: 00010286
    RAX: 0000000000000000 RBX: ffff88003e82bd60 RCX: 00000000000657d5
    RDX: 0000000000000000 RSI: 000000000000031f RDI: ffff88003e82bd40
    RBP: ffff88003da49ab0 R08: 0000000000000001 R09: 0000000081121a45
    R10: ffffffff81121a45 R11: ffff88003c4a9a28 R12: ffff88003e82bd40
    R13: ffff88003da0e800 R14: 0000000000000001 R15: ffff88003da49d58
    FS: 0000000000000000(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000067d9000 CR3: 000000003ace5000 CR4: 00000000000407b0
    Call Trace:
    shrink_inactive_list+0x240/0x3de
    shrink_lruvec+0x3e0/0x566
    __shrink_zone+0x94/0x178
    shrink_zone+0x3a/0x82
    balance_pgdat+0x32a/0x4c2
    kswapd+0x2f0/0x372
    kthread+0xa2/0xaa
    ret_from_fork+0x7c/0xb0
    Code: 80 7d 8f 01 48 83 95 68 ff ff ff 00 4c 89 e7 e8 5a 7b 00 00 48 85 c0 49 89 c5 75 08 80 7d 8f 00 74 3e eb 31 48 8b 80 18 01 00 00 8b 74 0d 48 8b 78 30 be 02 00 00 00 ff d2 eb
    RIP [] shrink_page_list+0x24e/0x897
    RSP
    CR2: 0000000000000028
    ---[ end trace 703d2451af6ffbfd ]---
    Kernel panic - not syncing: Fatal exception

    This patch fixes the issue, by assuring the proper tests are made at
    putback_movable_pages() & reclaim_clean_pages_from_list() to avoid
    isolated balloon pages being wrongly reinserted in LRU lists.

    [akpm@linux-foundation.org: clarify awkward comment text]
    Signed-off-by: Rafael Aquini
    Reported-by: Luiz Capitulino
    Tested-by: Luiz Capitulino
    Cc: Mel Gorman
    Cc: Rik van Riel
    Cc: Hugh Dickins
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Rafael Aquini
     
  • commit 1e43692cdb7cc445d6347d8a5207d9cef0c71434 upstream.

    Added USB ID for Corega WLUSB2GTST USB adapter.

    Reported-by: Joerg Kalisch
    Signed-off-by: Christian Lamparter
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Christian Lamparter
     
  • commit 60ce314d1750fef843e9db70050e09e49f838b69 upstream.

    The private array at the end of the rtl_priv struct is not aligned.
    On ARM architecture, this causes an alignment trap and is fixed by aligning
    that array with __align(sizeof(void *)). That should properly align that
    space according to the requirements of all architectures.

    Reported-by: Jason Andrews
    Tested-by: Jason Andrews
    Signed-off-by: Larry Finger
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Larry Finger
     
  • commit c807f64340932e19f0d2ac9b30c8381e1f60663a upstream.

    The SRP specification requires:

    "Response data shall be provided in any SRP_RSP response that is sent in
    response to an SRP_TSK_MGMT request (see 6.7). The information in the
    RSP_CODE field (see table 24) shall indicate the completion status of
    the task management function."

    So fix this to avoid the SRP initiator interprets task management functions
    that succeeded as failed.

    Signed-off-by: Jack Wang
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Jack Wang
     
  • commit 0b41d6ca616ddeb3b6c0a80e8770b6f53cd42806 upstream.

    This patch fixes a bug where ib_destroy_cm_id() was incorrectly being called
    after srpt_destroy_ch_ib() had destroyed the active QP.

    This would result in the following failed SRP_LOGIN_REQ messages:

    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff1762bd, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 1 (guid=0xfe80000000000000:0x2c903009f8f41)
    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff1758f9, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 2 (guid=0xfe80000000000000:0x2c903009f8f42)
    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff175941, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 2 (guid=0xfe80000000000000:0x2c90300a3cfb2)
    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff176299, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 1 (guid=0xfe80000000000000:0x2c90300a3cfb1)
    mlx4_core 0000:84:00.0: command 0x19 failed: fw status = 0x9
    rejected SRP_LOGIN_REQ because creating a new RDMA channel failed.
    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff176299, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 1 (guid=0xfe80000000000000:0x2c90300a3cfb1)
    mlx4_core 0000:84:00.0: command 0x19 failed: fw status = 0x9
    rejected SRP_LOGIN_REQ because creating a new RDMA channel failed.
    Received SRP_LOGIN_REQ with i_port_id 0x0:0x2590ffff176299, t_port_id 0x2c903009f8f40:0x2c903009f8f40 and it_iu_len 260 on port 1 (guid=0xfe80000000000000:0x2c90300a3cfb1)

    Reported-by: Navin Ahuja
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Bellinger
     
  • commit a9fbf4d591da6cd1d3eaab826c7c15f77fc8f6a3 upstream.

    Commit d0380e6c3c0f6edb986d8798a23acfaf33d5df23 (early_printk:
    consolidate random copies of identical code) added in 3.10 introduced
    a check for con->index == -1 in early_console_register().

    Initialize index to -1 for the xenboot console so earlyprintk=xen
    works again.

    Signed-off-by: David Vrabel
    Cc: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    David Vrabel
     
  • commit eb2addd4044b4b2ce77693bde5bc810536dd96ee upstream.

    Hi,

    my Huawei 3G modem has an embedded Smart Card reader which causes
    trouble when the modem is being detected (a bunch of " (ttyUSBx):
    open blocked by driver for more than 7 seconds!" in messages.log). This
    trivial patch corrects the problem for me. The modem identifies itself
    as "12d1:1406 Huawei Technologies Co., Ltd. E1750" in lsusb although the
    description on the body says "Model E173u-1"

    Signed-off-by: Michal Malý
    Cc: Bjørn Mork
    Signed-off-by: Greg Kroah-Hartman

    Michal Malý
     
  • commit b7be1522def9a9988b67afd0be999c50a96394b5 upstream.

    For pcie8897, the hs_cfg cancel command (0xe5) times out when host
    comes out of suspend. This is caused by an incompleted host sleep
    handshake between driver and firmware.

    Like SDIO interface, PCIe also needs to go through firmware power
    save events to complete the handshake for host sleep configuration.
    Only USB interface doesn't require power save events for hs_cfg.

    Signed-off-by: Bing Zhao
    Signed-off-by: Amitkumar Karwar
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Bing Zhao
     
  • commit bd1c6142edce787b8ac1be15635f845aa9905333 upstream.

    Bug 60815 - Interface hangs in mwifiex_usb
    https://bugzilla.kernel.org/show_bug.cgi?id=60815

    We have 4 bytes of interface header for packets delivered to SDIO
    and PCIe, but not for USB interface.

    In Tx AMSDU case, currently 4 bytes of garbage data is unnecessarily
    appended for USB packets. This sometimes leads to a firmware hang,
    because it may not interpret the data packet correctly.

    Problem is fixed by removing this redundant headroom for USB.

    Tested-by: Dmitry Khromov
    Signed-off-by: Amitkumar Karwar
    Signed-off-by: Bing Zhao
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Amitkumar Karwar
     
  • commit 346ece0b7ba2730b4d633b9e371fe55488803102 upstream.

    Bug 60815 - Interface hangs in mwifiex_usb
    https://bugzilla.kernel.org/show_bug.cgi?id=60815

    [ 2.883807] BUG: unable to handle kernel NULL pointer dereference
    at 0000000000000048
    [ 2.883813] IP: [] pfifo_fast_enqueue+0x90/0x90

    [ 2.883834] CPU: 1 PID: 3220 Comm: kworker/u8:90 Not tainted
    3.11.1-monotone-l0 #6
    [ 2.883834] Hardware name: Microsoft Corporation Surface with
    Windows 8 Pro/Surface with Windows 8 Pro,
    BIOS 1.03.0450 03/29/2013

    On Surface Pro, suspend to ram gives a NULL pointer dereference in
    pfifo_fast_enqueue(). The stack trace reveals that the offending
    call is clearing carrier in mwifiex_usb suspend handler.

    Since commit 1499d9f "mwifiex: don't drop carrier flag over suspend"
    has removed the carrier flag handling over suspend/resume in SDIO
    and PCIe drivers, I'm removing it in USB driver too. This also fixes
    the bug for Surface Pro.

    Tested-by: Dmitry Khromov
    Signed-off-by: Bing Zhao
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Bing Zhao
     
  • commit 52b26a3e1bb3e065c32b3febdac1e1f117d88e15 upstream.

    - Fix an Oops when nfs4_ds_connect() returns an error.
    - Always check the device status after waiting for a connect to complete.

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

    Trond Myklebust
     
  • commit 677a31565692d596ef42ea589b53ba289abf4713 upstream.

    The `insn_bits` handler `ni_65xx_dio_insn_bits()` has a `for` loop that
    currently writes (optionally) and reads back up to 5 "ports" consisting
    of 8 channels each. It reads up to 32 1-bit channels but can only read
    and write a whole port at once - it needs to handle up to 5 ports as the
    first channel it reads might not be aligned on a port boundary. It
    breaks out of the loop early if the next port it handles is beyond the
    final port on the card. It also breaks out early on the 5th port in the
    loop if the first channel was aligned. Unfortunately, it doesn't check
    that the current port it is dealing with belongs to the comedi subdevice
    the `insn_bits` handler is acting on. That's a bug.

    Redo the `for` loop to terminate after the final port belonging to the
    subdevice, changing the loop variable in the process to simplify things
    a bit. The `for` loop could now try and handle more than 5 ports if the
    subdevice has more than 40 channels, but the test `if (bitshift >= 32)`
    ensures it will break out early after 4 or 5 ports (depending on whether
    the first channel is aligned on a port boundary). (`bitshift` will be
    between -7 and 7 inclusive on the first iteration, increasing by 8 for
    each subsequent operation.)

    Signed-off-by: Ian Abbott
    Signed-off-by: Greg Kroah-Hartman

    Ian Abbott
     
  • commit 83b2944fd2532b92db099cb3ada12df32a05b368 upstream.

    The "force" parameter in __blk_queue_bounce was being ignored, which
    means that stable page snapshots are not always happening (on ext3).
    This of course leads to DIF disks reporting checksum errors, so fix this
    regression.

    The regression was introduced in commit 6bc454d15004 ("bounce: Refactor
    __blk_queue_bounce to not use bi_io_vec")

    Reported-by: Mel Gorman
    Signed-off-by: Darrick J. Wong
    Cc: Kent Overstreet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Darrick J. Wong
     
  • [ Upstream commit 26794942461f438a6bc725ec7294b08a6bd782c4 ]

    The include/asm-generic/hugetlb.h stubs that just vector huge_pte_*()
    calls to the pte_*() implementations won't work in certain situations.

    x86 and sparc, for example, return "unsigned long" from the bit
    checks, and just go "return pte_val(pte) & PTE_BIT_FOO;"

    But since huge_pte_*() returns 'int', if any high bits on 64-bit are
    relevant, they get chopped off.

    The net effect is that we can loop forever trying to COW a huge page,
    because the huge_pte_write() check signals false all the time.

    Reported-by: Gurudas Pai
    Tested-by: Gurudas Pai
    Signed-off-by: David S. Miller
    Acked-by: David Rientjes
    Signed-off-by: Greg Kroah-Hartman

    David Miller
     
  • [ Upstream commit 7a3b0f89e3fea680f93932691ca41a68eee7ab5e ]

    Pass 1 in %o1 to indicate that syscall_trace accounts exit.

    Signed-off-by: Kirill Tkhai
    CC: David Miller
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kirill Tkhai
     
  • [ Upstream commit ab2abda6377723e0d5fbbfe5f5aa16a5523344d1 ]

    (From v1 to v2: changed comment)

    On the way linux_sparc_syscall32->linux_syscall_trace32->goto 2f,
    register %o5 doesn't clear its second 32-bit.

    Fix that.

    Signed-off-by: Kirill Tkhai
    CC: David Miller
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kirill Tkhai
     
  • [ Upstream commit 63d499662aeec1864ec36d042aca8184ea6a938e ]

    Reported-by: Kirill Tkhai
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller
     
  • [ Upstream commit 20928bd3f08afb036c096d9559d581926b895918 ]

    The length argument to strlcpy was still wrong. It could overflow the end of
    full_boot_str by 5 bytes. Instead of strcat and strlcpy, just use snprint.

    Reported-by: Brad Spengler
    Signed-off-by: Kees Cook
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook
     
  • [ Upstream commit 2bd161a605f1f84a5fc8a4fe8410113a94f79355 ]

    Commit 117a0c5fc9c2d06045bd217385b2b39ea426b5a6 ("sparc: kernel: using
    strlcpy() instead of strcpy()") added a bug to ldom_reboot in
    arch/sparc/kernel/ds.c

    - strcpy(full_boot_str + strlen("boot "), boot_command);
    + strlcpy(full_boot_str + strlen("boot "), boot_command,
    + sizeof(full_boot_str + strlen("boot ")));

    That last sizeof() expression evaluates to sizeof(size_t) which is
    not what was intended.

    Also even the corrected:

    sizeof(full_boot_str) + strlen("boot ")

    is not right as the destination buffer length is just plain
    "sizeof(full_boot_str)" and that's what the final argument
    should be.

    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller
     
  • [ Upstream commit 61d9b9355b0d427bd1e732bd54628ff9103e496f ]

    The functions

    __down_read
    __down_read_trylock
    __down_write
    __down_write_trylock
    __up_read
    __up_write
    __downgrade_write

    are implemented inline, so remove corresponding EXPORT_SYMBOLs
    (They lead to compile errors on RT kernel).

    Signed-off-by: Kirill Tkhai
    CC: David Miller
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kirill Tkhai
     
  • [ Upstream commit 1c2696cdaad84580545a2e9c0879ff597880b1a9 ]

    1)Use kvmap_itlb_longpath instead of kvmap_dtlb_longpath.

    2)Handle page #0 only, don't handle page #1: bleu -> blu

    (KERNBASE is 0x400000, so #1 does not exist too. But everything
    is possible in the future. Fix to not to have problems later.)

    3)Remove unused kvmap_itlb_nonlinear.

    Signed-off-by: Kirill Tkhai
    CC: David Miller
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Kirill Tkhai
     
  • [ Upstream commit 21af8107f27878813d0364733c0b08813c2c192a ]

    Meelis Roos reports a crash in esp_free_lun_tag() in the presense
    of a disk which has died.

    The issue is that when we issue an autosense command, we do so by
    hijacking the original command that caused the check-condition.

    When we do so we clear out the ent->tag[] array when we issue it via
    find_and_prep_issuable_command(). This is so that the autosense
    command is forced to be issued non-tagged.

    That is problematic, because it is the value of ent->tag[] which
    determines whether we issued the original scsi command as tagged
    vs. non-tagged (see esp_alloc_lun_tag()).

    And that, in turn, is what trips up the sanity checks in
    esp_free_lun_tag(). That function needs the original ->tag[] values
    in order to free up the tag slot properly.

    Fix this by remembering the original command's tag values, and
    having esp_alloc_lun_tag() and esp_free_lun_tag() use them.

    Reported-by: Meelis Roos
    Tested-by: Meelis Roos
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    David S. Miller
     
  • commit 7f42ec3941560f0902fe3671e36f2c20ffd3af0a upstream.

    Many NILFS2 users were reported about strange file system corruption
    (for example):

    NILFS: bad btree node (blocknr=185027): level = 0, flags = 0x0, nchildren = 768
    NILFS error (device sda4): nilfs_bmap_last_key: broken bmap (inode number=11540)

    But such error messages are consequence of file system's issue that takes
    place more earlier. Fortunately, Jerome Poulin
    and Anton Eliasson were reported about another
    issue not so recently. These reports describe the issue with segctor
    thread's crash:

    BUG: unable to handle kernel paging request at 0000000000004c83
    IP: nilfs_end_page_io+0x12/0xd0 [nilfs2]

    Call Trace:
    nilfs_segctor_do_construct+0xf25/0x1b20 [nilfs2]
    nilfs_segctor_construct+0x17b/0x290 [nilfs2]
    nilfs_segctor_thread+0x122/0x3b0 [nilfs2]
    kthread+0xc0/0xd0
    ret_from_fork+0x7c/0xb0

    These two issues have one reason. This reason can raise third issue
    too. Third issue results in hanging of segctor thread with eating of
    100% CPU.

    REPRODUCING PATH:

    One of the possible way or the issue reproducing was described by
    Jermoe me Poulin :

    1. init S to get to single user mode.
    2. sysrq+E to make sure only my shell is running
    3. start network-manager to get my wifi connection up
    4. login as root and launch "screen"
    5. cd /boot/log/nilfs which is a ext3 mount point and can log when NILFS dies.
    6. lscp | xz -9e > lscp.txt.xz
    7. mount my snapshot using mount -o cp=3360839,ro /dev/vgUbuntu/root /mnt/nilfs
    8. start a screen to dump /proc/kmsg to text file since rsyslog is killed
    9. start a screen and launch strace -f -o find-cat.log -t find
    /mnt/nilfs -type f -exec cat {} > /dev/null \;
    10. start a screen and launch strace -f -o apt-get.log -t apt-get update
    11. launch the last command again as it did not crash the first time
    12. apt-get crashes
    13. ps aux > ps-aux-crashed.log
    13. sysrq+W
    14. sysrq+E wait for everything to terminate
    15. sysrq+SUSB

    Simplified way of the issue reproducing is starting kernel compilation
    task and "apt-get update" in parallel.

    REPRODUCIBILITY:

    The issue is reproduced not stable [60% - 80%]. It is very important to
    have proper environment for the issue reproducing. The critical
    conditions for successful reproducing:

    (1) It should have big modified file by mmap() way.

    (2) This file should have the count of dirty blocks are greater that
    several segments in size (for example, two or three) from time to time
    during processing.

    (3) It should be intensive background activity of files modification
    in another thread.

    INVESTIGATION:

    First of all, it is possible to see that the reason of crash is not valid
    page address:

    NILFS [nilfs_segctor_complete_write]:2100 bh->b_count 0, bh->b_blocknr 13895680, bh->b_size 13897727, bh->b_page 0000000000001a82
    NILFS [nilfs_segctor_complete_write]:2101 segbuf->sb_segnum 6783

    Moreover, value of b_page (0x1a82) is 6786. This value looks like segment
    number. And b_blocknr with b_size values look like block numbers. So,
    buffer_head's pointer points on not proper address value.

    Detailed investigation of the issue is discovered such picture:

    [-----------------------------SEGMENT 6783-------------------------------]
    NILFS [nilfs_segctor_do_construct]:2310 nilfs_segctor_begin_construction
    NILFS [nilfs_segctor_do_construct]:2321 nilfs_segctor_collect
    NILFS [nilfs_segctor_do_construct]:2336 nilfs_segctor_assign
    NILFS [nilfs_segctor_do_construct]:2367 nilfs_segctor_update_segusage
    NILFS [nilfs_segctor_do_construct]:2371 nilfs_segctor_prepare_write
    NILFS [nilfs_segctor_do_construct]:2376 nilfs_add_checksums_on_logs
    NILFS [nilfs_segctor_do_construct]:2381 nilfs_segctor_write
    NILFS [nilfs_segbuf_submit_bio]:464 bio->bi_sector 111149024, segbuf->sb_segnum 6783

    [-----------------------------SEGMENT 6784-------------------------------]
    NILFS [nilfs_segctor_do_construct]:2310 nilfs_segctor_begin_construction
    NILFS [nilfs_segctor_do_construct]:2321 nilfs_segctor_collect
    NILFS [nilfs_lookup_dirty_data_buffers]:782 bh->b_count 1, bh->b_page ffffea000709b000, page->index 0, i_ino 1033103, i_size 25165824
    NILFS [nilfs_lookup_dirty_data_buffers]:783 bh->b_assoc_buffers.next ffff8802174a6798, bh->b_assoc_buffers.prev ffff880221cffee8
    NILFS [nilfs_segctor_do_construct]:2336 nilfs_segctor_assign
    NILFS [nilfs_segctor_do_construct]:2367 nilfs_segctor_update_segusage
    NILFS [nilfs_segctor_do_construct]:2371 nilfs_segctor_prepare_write
    NILFS [nilfs_segctor_do_construct]:2376 nilfs_add_checksums_on_logs
    NILFS [nilfs_segctor_do_construct]:2381 nilfs_segctor_write
    NILFS [nilfs_segbuf_submit_bh]:575 bh->b_count 1, bh->b_page ffffea000709b000, page->index 0, i_ino 1033103, i_size 25165824
    NILFS [nilfs_segbuf_submit_bh]:576 segbuf->sb_segnum 6784
    NILFS [nilfs_segbuf_submit_bh]:577 bh->b_assoc_buffers.next ffff880218a0d5f8, bh->b_assoc_buffers.prev ffff880218bcdf50
    NILFS [nilfs_segbuf_submit_bio]:464 bio->bi_sector 111150080, segbuf->sb_segnum 6784, segbuf->sb_nbio 0
    [----------] ditto
    NILFS [nilfs_segbuf_submit_bio]:464 bio->bi_sector 111164416, segbuf->sb_segnum 6784, segbuf->sb_nbio 15

    [-----------------------------SEGMENT 6785-------------------------------]
    NILFS [nilfs_segctor_do_construct]:2310 nilfs_segctor_begin_construction
    NILFS [nilfs_segctor_do_construct]:2321 nilfs_segctor_collect
    NILFS [nilfs_lookup_dirty_data_buffers]:782 bh->b_count 2, bh->b_page ffffea000709b000, page->index 0, i_ino 1033103, i_size 25165824
    NILFS [nilfs_lookup_dirty_data_buffers]:783 bh->b_assoc_buffers.next ffff880219277e80, bh->b_assoc_buffers.prev ffff880221cffc88
    NILFS [nilfs_segctor_do_construct]:2367 nilfs_segctor_update_segusage
    NILFS [nilfs_segctor_do_construct]:2371 nilfs_segctor_prepare_write
    NILFS [nilfs_segctor_do_construct]:2376 nilfs_add_checksums_on_logs
    NILFS [nilfs_segctor_do_construct]:2381 nilfs_segctor_write
    NILFS [nilfs_segbuf_submit_bh]:575 bh->b_count 2, bh->b_page ffffea000709b000, page->index 0, i_ino 1033103, i_size 25165824
    NILFS [nilfs_segbuf_submit_bh]:576 segbuf->sb_segnum 6785
    NILFS [nilfs_segbuf_submit_bh]:577 bh->b_assoc_buffers.next ffff880218a0d5f8, bh->b_assoc_buffers.prev ffff880222cc7ee8
    NILFS [nilfs_segbuf_submit_bio]:464 bio->bi_sector 111165440, segbuf->sb_segnum 6785, segbuf->sb_nbio 0
    [----------] ditto
    NILFS [nilfs_segbuf_submit_bio]:464 bio->bi_sector 111177728, segbuf->sb_segnum 6785, segbuf->sb_nbio 12

    NILFS [nilfs_segctor_do_construct]:2399 nilfs_segctor_wait
    NILFS [nilfs_segbuf_wait]:676 segbuf->sb_segnum 6783
    NILFS [nilfs_segbuf_wait]:676 segbuf->sb_segnum 6784
    NILFS [nilfs_segbuf_wait]:676 segbuf->sb_segnum 6785

    NILFS [nilfs_segctor_complete_write]:2100 bh->b_count 0, bh->b_blocknr 13895680, bh->b_size 13897727, bh->b_page 0000000000001a82

    BUG: unable to handle kernel paging request at 0000000000001a82
    IP: [] nilfs_end_page_io+0x12/0xd0 [nilfs2]

    Usually, for every segment we collect dirty files in list. Then, dirty
    blocks are gathered for every dirty file, prepared for write and
    submitted by means of nilfs_segbuf_submit_bh() call. Finally, it takes
    place complete write phase after calling nilfs_end_bio_write() on the
    block layer. Buffers/pages are marked as not dirty on final phase and
    processed files removed from the list of dirty files.

    It is possible to see that we had three prepare_write and submit_bio
    phases before segbuf_wait and complete_write phase. Moreover, segments
    compete between each other for dirty blocks because on every iteration
    of segments processing dirty buffer_heads are added in several lists of
    payload_buffers:

    [SEGMENT 6784]: bh->b_assoc_buffers.next ffff880218a0d5f8, bh->b_assoc_buffers.prev ffff880218bcdf50
    [SEGMENT 6785]: bh->b_assoc_buffers.next ffff880218a0d5f8, bh->b_assoc_buffers.prev ffff880222cc7ee8

    The next pointer is the same but prev pointer has changed. It means
    that buffer_head has next pointer from one list but prev pointer from
    another. Such modification can be made several times. And, finally, it
    can be resulted in various issues: (1) segctor hanging, (2) segctor
    crashing, (3) file system metadata corruption.

    FIX:
    This patch adds:

    (1) setting of BH_Async_Write flag in nilfs_segctor_prepare_write()
    for every proccessed dirty block;

    (2) checking of BH_Async_Write flag in
    nilfs_lookup_dirty_data_buffers() and
    nilfs_lookup_dirty_node_buffers();

    (3) clearing of BH_Async_Write flag in nilfs_segctor_complete_write(),
    nilfs_abort_logs(), nilfs_forget_buffer(), nilfs_clear_dirty_page().

    Reported-by: Jerome Poulin
    Reported-by: Anton Eliasson
    Cc: Paul Fertser
    Cc: ARAI Shun-ichi
    Cc: Piotr Szymaniak
    Cc: Juan Barry Manuel Canham
    Cc: Zahid Chowdhury
    Cc: Elmer Zhang
    Cc: Kenneth Langga
    Signed-off-by: Vyacheslav Dubeyko
    Acked-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vyacheslav Dubeyko
     
  • commit bf5430360ebe4b2d0c51d91f782e649107b502eb upstream.

    We need to let the setup stage complete cleanly even when the HCI device
    is rfkilled. Otherwise the HCI device will stay in an undefined state
    and never get notified to user space through mgmt (even when it gets
    unblocked through rfkill).

    This patch makes sure that hci_dev_open() can be called in the HCI_SETUP
    stage, that blocking the device doesn't abort the setup stage, and that
    the device gets proper powered down as soon as the setup stage completes
    in case it was blocked meanwhile.

    The bug that this patch fixed can be very easily reproduced using e.g.
    the rfkill command line too. By running "rfkill block all" before
    inserting a Bluetooth dongle the resulting HCI device goes into a state
    where it is never announced over mgmt, not even when "rfkill unblock all"
    is run.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Johan Hedberg
     
  • commit 5e130367d43ff22836bbae380d197d600fe8ddbb upstream.

    This makes it more convenient to check for rfkill (no need to check for
    dev->rfkill before calling rfkill_blocked()) and also avoids potential
    races if the RFKILL state needs to be checked from within the rfkill
    callback.

    Signed-off-by: Johan Hedberg
    Acked-by: Marcel Holtmann
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Johan Hedberg
     
  • commit 38a172bef8c93ecbfd69715fd88396988e4073fd upstream.

    Yet another vendor specific ID for this chipset; this one for the ASUS
    USB-BT400 Bluetooth 4.0 adapter.

    T: Bus=03 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 6 Spd=12 MxCh= 0
    D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0b05 ProdID=17cb Rev=01.12
    S: Manufacturer=Broadcom Corp
    S: Product=BCM20702A0
    S: SerialNumber=000272C64400
    C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=100mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: Raphael Kubo da Costa
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Raphael Kubo da Costa
     
  • commit 0a3658cccdf5326ea508efeb1879b0e2508bb0c3 upstream.

    usb device info:

    T: Bus=06 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 15 Spd=12 MxCh= 0
    D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0cf3 ProdID=e005 Rev= 0.02
    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
    E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
    E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
    E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms

    Signed-off-by: Peng Chen
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Peng Chen
     
  • commit 89cbb4da0abee2f39d75f67f9fd57f7410c8b65c upstream.

    This patch fixes the connection encryption key size information when
    the host is playing the peripheral role. We should set conn->enc_key_
    size in hci_le_ltk_request_evt, otherwise it is left uninitialized.

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Andre Guedes
     
  • commit f8776218e8546397be64ad2bc0ebf4748522d6e3 upstream.

    While playing the peripheral role, the host gets a LE Long Term Key
    Request Event from the controller when a connection is established
    with a bonded device. The host then informs the LTK which should be
    used for the connection. Once the link is encrypted, the host gets
    an Encryption Change Event.

    Therefore we should set conn->pending_sec_level instead of conn->
    sec_level in hci_le_ltk_request_evt. This way, conn->sec_level is
    properly updated in hci_encrypt_change_evt.

    Moreover, since we have a LTK associated to the device, we have at
    least BT_SECURITY_MEDIUM security level.

    Signed-off-by: Andre Guedes
    Signed-off-by: Gustavo Padovan
    Signed-off-by: Greg Kroah-Hartman

    Andre Guedes
     
  • commit db4efbbeb457b6f9f4d8c4b090d1170d12f026e1 upstream.

    The driver uses platform_driver_probe() to obtain platform data
    if any. However, that function is placed in the .init section so
    it must be called upon driver module initialization.

    The problem was reported by Fenguang Wu resulting in a kernel
    oops because the .init section was already freed.

    [ 48.966342] Switched to clocksource tsc
    [ 48.970002] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
    [ 48.970851] BUG: unable to handle kernel paging request at ffffffff82196446
    [ 48.970957] IP: [] classes_init+0x26/0x26
    [ 48.970957] PGD 1e76067 PUD 1e77063 PMD f388063 PTE 8000000002196163
    [ 48.970957] Oops: 0011 [#1]
    [ 48.970957] CPU: 0 PID: 17 Comm: kworker/0:1 Not tainted 3.11.0-rc7-00444-gc52dd7f #23
    [ 48.970957] Workqueue: events brcmf_driver_init
    [ 48.970957] task: ffff8800001d2000 ti: ffff8800001d4000 task.ti: ffff8800001d4000
    [ 48.970957] RIP: 0010:[] [] classes_init+0x26/0x26
    [ 48.970957] RSP: 0000:ffff8800001d5d40 EFLAGS: 00000286
    [ 48.970957] RAX: 0000000000000001 RBX: ffffffff820c5620 RCX: 0000000000000000
    [ 48.970957] RDX: 0000000000000001 RSI: ffffffff816f7380 RDI: ffffffff820c56c0
    [ 48.970957] RBP: ffff8800001d5d50 R08: ffff8800001d2508 R09: 0000000000000002
    [ 48.970957] R10: 0000000000000000 R11: 0001f7ce298c5620 R12: ffff8800001c76b0
    [ 48.970957] R13: ffffffff81e91d40 R14: 0000000000000000 R15: ffff88000e0ce300
    [ 48.970957] FS: 0000000000000000(0000) GS:ffffffff81e84000(0000) knlGS:0000000000000000
    [ 48.970957] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [ 48.970957] CR2: ffffffff82196446 CR3: 0000000001e75000 CR4: 00000000000006b0
    [ 48.970957] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 48.970957] DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000
    [ 48.970957] Stack:
    [ 48.970957] ffffffff816f7df8 ffffffff820c5620 ffff8800001d5d60 ffffffff816eeec9
    [ 48.970957] ffff8800001d5de0 ffffffff81073dc5 ffffffff81073d68 ffff8800001d5db8
    [ 48.970957] 0000000000000086 ffffffff820c5620 ffffffff824f7fd0 0000000000000000
    [ 48.970957] Call Trace:
    [ 48.970957] [] ? brcmf_sdio_init+0x18/0x70
    [ 48.970957] [] brcmf_driver_init+0x9/0x10
    [ 48.970957] [] process_one_work+0x1d5/0x480
    [ 48.970957] [] ? process_one_work+0x178/0x480
    [ 48.970957] [] worker_thread+0x118/0x3a0
    [ 48.970957] [] ? process_one_work+0x480/0x480
    [ 48.970957] [] kthread+0xe7/0xf0
    [ 48.970957] [] ? finish_task_switch.constprop.57+0x37/0xd0
    [ 48.970957] [] ? __kthread_parkme+0x80/0x80
    [ 48.970957] [] ret_from_fork+0x7a/0xb0
    [ 48.970957] [] ? __kthread_parkme+0x80/0x80
    [ 48.970957] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
    cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
    [ 48.970957] RIP [] classes_init+0x26/0x26
    [ 48.970957] RSP
    [ 48.970957] CR2: ffffffff82196446
    [ 48.970957] ---[ end trace 62980817cd525f14 ]---

    Reported-by: Fengguang Wu
    Reviewed-by: Hante Meuleman
    Reviewed-by: Pieter-Paul Giesberts
    Tested-by: Fengguang Wu
    Signed-off-by: Arend van Spriel
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Arend van Spriel
     
  • commit 0ab08f576b9e6a6b689fc6b4e632079b978e619b upstream.

    A former patch introducing FUSE_I_SIZE_UNSTABLE flag provided detailed
    description of races between ftruncate and anyone who can extend i_size:

    > 1. As in the previous scenario fuse_dentry_revalidate() discovered that i_size
    > changed (due to our own fuse_do_setattr()) and is going to call
    > truncate_pagecache() for some 'new_size' it believes valid right now. But by
    > the time that particular truncate_pagecache() is called ...
    > 2. fuse_do_setattr() returns (either having called truncate_pagecache() or
    > not -- it doesn't matter).
    > 3. The file is extended either by write(2) or ftruncate(2) or fallocate(2).
    > 4. mmap-ed write makes a page in the extended region dirty.

    This patch adds necessary bits to fuse_file_fallocate() to protect from that
    race.

    Signed-off-by: Maxim Patlasov
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Maxim Patlasov
     
  • commit bde52788bdb755b9e4b75db6c434f30e32a0ca0b upstream.

    The patch fixes a race between mmap-ed write and fallocate(PUNCH_HOLE):

    1) An user makes a page dirty via mmap-ed write.
    2) The user performs fallocate(2) with mode == PUNCH_HOLE|KEEP_SIZE
    and covering the page.
    3) Before truncate_pagecache_range call from fuse_file_fallocate,
    the page goes to write-back. The page is fully processed by fuse_writepage
    (including end_page_writeback on the page), but fuse_flush_writepages did
    nothing because fi->writectr < 0.
    4) truncate_pagecache_range is called and fuse_file_fallocate is finishing
    by calling fuse_release_nowrite. The latter triggers processing queued
    write-back request which will write stale data to the hole soon.

    Changed in v2 (thanks to Brian for suggestion):
    - Do not truncate page cache until FUSE_FALLOCATE succeeded. Otherwise,
    we can end up in returning -ENOTSUPP while user data is already punched
    from page cache. Use filemap_write_and_wait_range() instead.
    Changed in v3 (thanks to Miklos for suggestion):
    - fuse_wait_on_writeback() is prone to livelocks; use fuse_set_nowrite()
    instead. So far as we need a dirty-page barrier only, fuse_sync_writes()
    should be enough.
    - rebased to for-linus branch of fuse.git

    Signed-off-by: Maxim Patlasov
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Greg Kroah-Hartman

    Maxim Patlasov
     
  • commit 8f21bd0090052e740944f9397e2be5ac7957ded7 upstream.

    The csum_partial_copy_generic() function saves the PowerPC non-volatile
    r14, r15, and r16 registers for the main checksum-and-copy loop.
    Unfortunately, it fails to restore them upon error exit from this loop,
    which results in silent corruption of these registers in the presumably
    rare event of an access exception within that loop.

    This commit therefore restores these register on error exit from the loop.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Paul E. McKenney
     
  • commit d1211af3049f4c9c1d8d4eb8f8098cc4f4f0d0c7 upstream.

    arch/powerpc/kernel/sysfs.c exports PURR with write permission.
    This may be valid for kernel in phyp mode. But writing to
    the file in guest mode causes crash due to a priviledge violation

    Signed-off-by: Madhavan Srinivasan
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Madhavan Srinivasan
     
  • commit d9813c3681a36774b254c0cdc9cce53c9e22c756 upstream.

    The csum_partial_copy_generic() uses register r7 to adjust the remaining
    bytes to process. Unfortunately, r7 also holds a parameter, namely the
    address of the flag to set in case of access exceptions while reading
    the source buffer. Lacking a quantum implementation of PowerPC, this
    commit instead uses register r9 to do the adjusting, leaving r7's
    pointer uncorrupted.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Paul E. McKenney
     
  • commit e82b89a6f19bae73fb064d1b3dd91fcefbb478f4 upstream.

    modalias_show() should return an empty string on error, not -ENODEV.

    This causes the following false and annoying error:

    > find /sys/devices -name modalias -print0 | xargs -0 cat >/dev/null
    cat: /sys/devices/vio/4000/modalias: No such device
    cat: /sys/devices/vio/4001/modalias: No such device
    cat: /sys/devices/vio/4002/modalias: No such device
    cat: /sys/devices/vio/4004/modalias: No such device
    cat: /sys/devices/vio/modalias: No such device

    Signed-off-by: Prarit Bhargava
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Prarit Bhargava
     
  • commit e9bdc3d6143d1c4b8d8ce5231fc958268331f983 upstream.

    When we do a treclaim or trecheckpoint we end up running with userspace
    PPR and DSCR values. Currently we don't do anything special to avoid
    running with user values which could cause a severe performance
    degradation.

    This patch moves the PPR and DSCR save and restore around treclaim and
    trecheckpoint so that we run with user values for a much shorter period.
    More care is taken with the PPR as it's impact is greater than the DSCR.

    This is similar to user exceptions, where we run HTM_MEDIUM early to
    ensure that we don't run with a userspace PPR values in the kernel.

    Signed-off-by: Michael Neuling
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Michael Neuling
     
  • commit a53b27b3abeef406de92a2bb0ceb6fb4c3fb8fc4 upstream.

    Commit 4df4899 "Add power8 EBB support" included a bug in the handling
    of the FAB_CRESP_MATCH and FAB_TYPE_MATCH fields.

    These values are pulled out of the event code using EVENT_THR_CTL_SHIFT,
    however we were then or'ing that value directly into MMCR1.

    This meant we were failing to set the FAB fields correctly, and also
    potentially corrupting the value for PMC4SEL. Leading to no counts for
    the FAB events and incorrect counts for PMC4.

    The fix is simply to shift left the FAB value correctly before or'ing it
    with MMCR1.

    Reported-by: Sooraj Ravindran Nair
    Signed-off-by: Michael Ellerman
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Michael Ellerman
     
  • commit 1cf389df090194a0976dc867b7fffe99d9d490cb upstream.

    Under heavy (DLPAR?) stress, we tripped this panic() in
    arch/powerpc/kernel/iommu.c::iommu_init_table():

    page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz));
    if (!page)
    panic("iommu_init_table: Can't allocate %ld bytes\n", sz);

    Before the panic() we got a page allocation failure for an order-2
    allocation. There appears to be memory free, but perhaps not in the
    ATOMIC context. I looked through all the call-sites of
    iommu_init_table() and didn't see any obvious reason to need an ATOMIC
    allocation. Most call-sites in fact have an explicit GFP_KERNEL
    allocation shortly before the call to iommu_init_table(), indicating we
    are not in an atomic context. There is some indirection for some paths,
    but I didn't see any locks indicating that GFP_KERNEL is inappropriate.

    With this change under the same conditions, we have not been able to
    reproduce the panic.

    Signed-off-by: Nishanth Aravamudan
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Greg Kroah-Hartman

    Nishanth Aravamudan
     
  • commit d63733aed90b432e5cc489ddfa28e342f91b4652 upstream.

    If the user passes an invalid value it leads to an info leak when we
    print the error message or it could oops. This is called with user
    supplied data from snd_ctl_elem_write().

    Signed-off-by: Dan Carpenter
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter