24 Oct, 2020

1 commit


05 Sep, 2020

1 commit


03 Sep, 2020

1 commit

  • All three generations of Sandisk SSDs lock up hard intermittently.
    Experiments showed that disabling NCQ lowered the failure rate significantly
    and the kernel has been disabling NCQ for some models of SD7's and 8's,
    which is obviously undesirable.

    Karthik worked with Sandisk to root cause the hard lockups to trim commands
    larger than 128M. This patch implements ATA_HORKAGE_MAX_TRIM_128M which
    limits max trim size to 128M and applies it to all three generations of
    Sandisk SSDs.

    Signed-off-by: Tejun Heo
    Cc: Karthik Shivaram
    Cc: stable@vger.kernel.org
    Signed-off-by: Jens Axboe

    Tejun Heo
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

05 Jun, 2020

1 commit

  • BUG: KASAN: use-after-free in ata_scsi_mode_select_xlat+0x10bd/0x10f0
    drivers/ata/libata-scsi.c:4045
    Read of size 1 at addr ffff88803b8cd003 by task syz-executor.6/12621

    CPU: 1 PID: 12621 Comm: syz-executor.6 Not tainted 4.19.95 #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
    1.10.2-1ubuntu1 04/01/2014
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0xac/0xee lib/dump_stack.c:118
    print_address_description+0x60/0x223 mm/kasan/report.c:253
    kasan_report_error mm/kasan/report.c:351 [inline]
    kasan_report mm/kasan/report.c:409 [inline]
    kasan_report.cold+0xae/0x2d8 mm/kasan/report.c:393
    ata_scsi_mode_select_xlat+0x10bd/0x10f0 drivers/ata/libata-scsi.c:4045
    ata_scsi_translate+0x2da/0x680 drivers/ata/libata-scsi.c:2035
    __ata_scsi_queuecmd drivers/ata/libata-scsi.c:4360 [inline]
    ata_scsi_queuecmd+0x2e4/0x790 drivers/ata/libata-scsi.c:4409
    scsi_dispatch_cmd+0x2ee/0x6c0 drivers/scsi/scsi_lib.c:1867
    scsi_queue_rq+0xfd7/0x1990 drivers/scsi/scsi_lib.c:2170
    blk_mq_dispatch_rq_list+0x1e1/0x19a0 block/blk-mq.c:1186
    blk_mq_do_dispatch_sched+0x147/0x3d0 block/blk-mq-sched.c:108
    blk_mq_sched_dispatch_requests+0x427/0x680 block/blk-mq-sched.c:204
    __blk_mq_run_hw_queue+0xbc/0x200 block/blk-mq.c:1308
    __blk_mq_delay_run_hw_queue+0x3c0/0x460 block/blk-mq.c:1376
    blk_mq_run_hw_queue+0x152/0x310 block/blk-mq.c:1413
    blk_mq_sched_insert_request+0x337/0x6c0 block/blk-mq-sched.c:397
    blk_execute_rq_nowait+0x124/0x320 block/blk-exec.c:64
    blk_execute_rq+0xc5/0x112 block/blk-exec.c:101
    sg_scsi_ioctl+0x3b0/0x6a0 block/scsi_ioctl.c:507
    sg_ioctl+0xd37/0x23f0 drivers/scsi/sg.c:1106
    vfs_ioctl fs/ioctl.c:46 [inline]
    file_ioctl fs/ioctl.c:501 [inline]
    do_vfs_ioctl+0xae6/0x1030 fs/ioctl.c:688
    ksys_ioctl+0x76/0xa0 fs/ioctl.c:705
    __do_sys_ioctl fs/ioctl.c:712 [inline]
    __se_sys_ioctl fs/ioctl.c:710 [inline]
    __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
    do_syscall_64+0xa0/0x2e0 arch/x86/entry/common.c:293
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x45c479
    Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89
    f7 48
    89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff
    ff 0f
    83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007fb0e9602c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007fb0e96036d4 RCX: 000000000045c479
    RDX: 0000000020000040 RSI: 0000000000000001 RDI: 0000000000000003
    RBP: 000000000076bfc0 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
    R13: 000000000000046d R14: 00000000004c6e1a R15: 000000000076bfcc

    Allocated by task 12577:
    set_track mm/kasan/kasan.c:460 [inline]
    kasan_kmalloc mm/kasan/kasan.c:553 [inline]
    kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
    __kmalloc+0xf3/0x1e0 mm/slub.c:3749
    kmalloc include/linux/slab.h:520 [inline]
    load_elf_phdrs+0x118/0x1b0 fs/binfmt_elf.c:441
    load_elf_binary+0x2de/0x4610 fs/binfmt_elf.c:737
    search_binary_handler fs/exec.c:1654 [inline]
    search_binary_handler+0x15c/0x4e0 fs/exec.c:1632
    exec_binprm fs/exec.c:1696 [inline]
    __do_execve_file.isra.0+0xf52/0x1a90 fs/exec.c:1820
    do_execveat_common fs/exec.c:1866 [inline]
    do_execve fs/exec.c:1883 [inline]
    __do_sys_execve fs/exec.c:1964 [inline]
    __se_sys_execve fs/exec.c:1959 [inline]
    __x64_sys_execve+0x8a/0xb0 fs/exec.c:1959
    do_syscall_64+0xa0/0x2e0 arch/x86/entry/common.c:293
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Freed by task 12577:
    set_track mm/kasan/kasan.c:460 [inline]
    __kasan_slab_free+0x129/0x170 mm/kasan/kasan.c:521
    slab_free_hook mm/slub.c:1370 [inline]
    slab_free_freelist_hook mm/slub.c:1397 [inline]
    slab_free mm/slub.c:2952 [inline]
    kfree+0x8b/0x1a0 mm/slub.c:3904
    load_elf_binary+0x1be7/0x4610 fs/binfmt_elf.c:1118
    search_binary_handler fs/exec.c:1654 [inline]
    search_binary_handler+0x15c/0x4e0 fs/exec.c:1632
    exec_binprm fs/exec.c:1696 [inline]
    __do_execve_file.isra.0+0xf52/0x1a90 fs/exec.c:1820
    do_execveat_common fs/exec.c:1866 [inline]
    do_execve fs/exec.c:1883 [inline]
    __do_sys_execve fs/exec.c:1964 [inline]
    __se_sys_execve fs/exec.c:1959 [inline]
    __x64_sys_execve+0x8a/0xb0 fs/exec.c:1959
    do_syscall_64+0xa0/0x2e0 arch/x86/entry/common.c:293
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    The buggy address belongs to the object at ffff88803b8ccf00
    which belongs to the cache kmalloc-512 of size 512
    The buggy address is located 259 bytes inside of
    512-byte region [ffff88803b8ccf00, ffff88803b8cd100)
    The buggy address belongs to the page:
    page:ffffea0000ee3300 count:1 mapcount:0 mapping:ffff88806cc03080
    index:0xffff88803b8cc780 compound_mapcount: 0
    flags: 0x100000000008100(slab|head)
    raw: 0100000000008100 ffffea0001104080 0000000200000002 ffff88806cc03080
    raw: ffff88803b8cc780 00000000800c000b 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff88803b8ccf00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88803b8ccf80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff88803b8cd000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff88803b8cd080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88803b8cd100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

    You can refer to "https://www.lkml.org/lkml/2019/1/17/474" reproduce
    this error.

    The exception code is "bd_len = p[3];", "p" value is ffff88803b8cd000
    which belongs to the cache kmalloc-512 of size 512. The "page_address(sg_page(scsi_sglist(scmd)))"
    maybe from sg_scsi_ioctl function "buffer" which allocated by kzalloc, so "buffer"
    may not page aligned.
    This also looks completely buggy on highmem systems and really needs to use a
    kmap_atomic. --Christoph Hellwig
    To address above bugs, Paolo Bonzini advise to simpler to just make a char array
    of size CACHE_MPAGE_LEN+8+8+4-2(or just 64 to make it easy), use sg_copy_to_buffer
    to copy from the sglist into the buffer, and workthere.

    Signed-off-by: Ye Bin
    Signed-off-by: Jens Axboe

    Ye Bin
     

23 Apr, 2020

2 commits

  • There are only two callers of blk_rq_map_sg/__blk_rq_map_sg that set
    the dma_pad value in the queue. Move the handling into those callers
    instead of burdening the common code, and move the ->extra_len field
    from struct request to struct scsi_cmnd.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Don't burden the common block code with with specifics of the libata DMA
    draining mechanism. Instead move most of the code to the scsi midlayer.

    That also means the nr_phys_segments adjustments in the blk-mq fast path
    can go away entirely, given that SCSI never looks at nr_phys_segments
    after mapping the request to a scatterlist.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

27 Mar, 2020

8 commits

  • * un-inline:
    - ata_scsi_dump_cdb()
    - __ata_scsi_queuecmd()

    * un-static:
    - ata_scsi_sdev_config()
    - ata_scsi_dev_config()
    - ata_scsi_dump_cdb()
    - __ata_scsi_queuecmd()

    * move ata_sas_*() to libata-sata.c:

    * add static inlines for CONFIG_SATA_HOST=n case for
    ata_sas_{allocate,free}_tag()

    Code size savings on m68k arch using (modified) atari_defconfig:

    text data bss dec hex filename
    before:
    19137 23 576 19736 4d18 drivers/ata/libata-scsi.o
    after:
    18330 23 576 18929 49f1 drivers/ata/libata-scsi.o

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • Start separating SATA specific code from libata-scsi.c:

    * un-static ata_scsi_find_dev()

    * move following code to libata-sata.c:
    - SATA only sysfs device attributes handling
    - __ata_change_queue_depth()
    - ata_scsi_change_queue_depth()

    * cover with CONFIG_SATA_HOST ifdef SATA only sysfs device
    attributes handling code and ATA_SHT_NCQ() macro in

    Code size savings on m68k arch using (modified) atari_defconfig:

    text data bss dec hex filename
    before:
    20702 105 576 21383 5387 drivers/ata/libata-scsi.o
    after:
    19137 23 576 19736 4d18 drivers/ata/libata-scsi.o

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • Remove EXPORT_SYMBOL_GPL()s for functions used only by
    the core libata code.

    Code size savings on m68k arch using (modified) atari_defconfig:

    text data bss dec hex filename
    before:
    39838 573 40 40451 9e03 drivers/ata/libata-core.o
    21071 105 576 21752 54f8 drivers/ata/libata-scsi.o
    17519 18 0 17537 4481 drivers/ata/libata-eh.o
    after:
    39688 573 40 40301 9d6d drivers/ata/libata-core.o
    21040 105 576 21721 54d9 drivers/ata/libata-scsi.o
    17405 18 0 17423 440f drivers/ata/libata-eh.o

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • Move EXPORT_SYMBOL_GPL()s close to exported code like it is
    done in other kernel subsystems. As a nice side effect this
    results in the removal of few ifdefs.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • Currently the maximum required size of the ata_scsi_rbuf[] is
    576 bytes in ata_scsiop_inq_89() so modify ATA_SCSI_RBUF_SIZE
    define accordingly.

    Code size savings on m68k arch using (modified) atari_defconfig:

    text data bss dec hex filename
    before:
    20782 105 4096 24983 6197 drivers/ata/libata-scsi.o
    after:
    20782 105 576 21463 53d7 drivers/ata/libata-scsi.o

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • Initialize rbuf[] directly instead of using ata_tf_to_fis(). This
    results in simpler and smaller code. It also allows separating
    ata_tf_to_fis() into SATA specific libata part in the future.

    Code size savings on m68k arch using (modified) atari_defconfig:

    text data bss dec hex filename
    before:
    20824 105 4096 25025 61c1 drivers/ata/libata-scsi.o
    after:
    20782 105 4096 24983 6197 drivers/ata/libata-scsi.o

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • There is no point in exposing ncq_enable_prio sysfs attribute for
    devices on PATA and non-NCQ capable SATA hosts so:

    * remove dev_attr_ncq_prio_enable from ata_common_sdev_attrs[]

    * add ata_ncq_sdev_attrs[]

    * update ATA_NCQ_SHT() macro to use ata_ncq_sdev_attrs[]

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     
  • In commit 7634ccd2da97 ("libata: maintainership update") from 2018
    Jens has officially taken over libata maintainership from Tejun so
    remove stale information from core libata code.

    Acked-by: Tejun Heo
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     

26 Mar, 2020

2 commits

  • When we spawn a SCSI device from an ATA device in libata-scsi
    the SCSI device had no relation to the device tree.

    The DT binding allows us to define port nodes under a
    PATA (IDE) or SATA host controller, so we can have proper device
    nodes for these devices.

    If OF is enabled, walk the children of the host controller node
    to see if there is a valid device tree node to assign. The reg
    is used to match to ID 0 for the master device and ID 1 for the
    slave device.

    The corresponding device tree bindings have been accepted by
    the device tree maintainers.

    Cc: Chris Healy
    Cc: Martin K. Petersen
    Cc: Bart Van Assche
    Reviewed-by: Guenter Roeck
    Signed-off-by: Linus Walleij
    Signed-off-by: Jens Axboe

    Linus Walleij
     
  • If the call to scsi_add_host_with_dma() in ata_scsi_add_hosts() fails,
    then we may get use-after-free KASAN warns:

    ==================================================================
    BUG: KASAN: use-after-free in kobject_put+0x24/0x180
    Read of size 1 at addr ffff0026b8c80364 by task swapper/0/1
    CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 5.6.0-rc3-00004-g5a71b206ea82-dirty #1765
    Hardware name: Huawei TaiShan 200 (Model 2280)/BC82AMDD, BIOS 2280-V2 CS V3.B160.01 02/24/2020
    Call trace:
    dump_backtrace+0x0/0x298
    show_stack+0x14/0x20
    dump_stack+0x118/0x190
    print_address_description.isra.9+0x6c/0x3b8
    __kasan_report+0x134/0x23c
    kasan_report+0xc/0x18
    __asan_load1+0x5c/0x68
    kobject_put+0x24/0x180
    put_device+0x10/0x20
    scsi_host_put+0x10/0x18
    ata_devres_release+0x74/0xb0
    release_nodes+0x2d0/0x470
    devres_release_all+0x50/0x78
    really_probe+0x2d4/0x560
    driver_probe_device+0x7c/0x148
    device_driver_attach+0x94/0xa0
    __driver_attach+0xa8/0x110
    bus_for_each_dev+0xe8/0x158
    driver_attach+0x30/0x40
    bus_add_driver+0x220/0x2e0
    driver_register+0xbc/0x1d0
    __pci_register_driver+0xbc/0xd0
    ahci_pci_driver_init+0x20/0x28
    do_one_initcall+0xf0/0x608
    kernel_init_freeable+0x31c/0x384
    kernel_init+0x10/0x118
    ret_from_fork+0x10/0x18

    Allocated by task 5:
    save_stack+0x28/0xc8
    __kasan_kmalloc.isra.8+0xbc/0xd8
    kasan_kmalloc+0xc/0x18
    __kmalloc+0x1a8/0x280
    scsi_host_alloc+0x44/0x678
    ata_scsi_add_hosts+0x74/0x268
    ata_host_register+0x228/0x488
    ahci_host_activate+0x1c4/0x2a8
    ahci_init_one+0xd18/0x1298
    local_pci_probe+0x74/0xf0
    work_for_cpu_fn+0x2c/0x48
    process_one_work+0x488/0xc08
    worker_thread+0x330/0x5d0
    kthread+0x1c8/0x1d0
    ret_from_fork+0x10/0x18

    Freed by task 5:
    save_stack+0x28/0xc8
    __kasan_slab_free+0x118/0x180
    kasan_slab_free+0x10/0x18
    slab_free_freelist_hook+0xa4/0x1a0
    kfree+0xd4/0x3a0
    scsi_host_dev_release+0x100/0x148
    device_release+0x7c/0xe0
    kobject_put+0xb0/0x180
    put_device+0x10/0x20
    scsi_host_put+0x10/0x18
    ata_scsi_add_hosts+0x210/0x268
    ata_host_register+0x228/0x488
    ahci_host_activate+0x1c4/0x2a8
    ahci_init_one+0xd18/0x1298
    local_pci_probe+0x74/0xf0
    work_for_cpu_fn+0x2c/0x48
    process_one_work+0x488/0xc08
    worker_thread+0x330/0x5d0
    kthread+0x1c8/0x1d0
    ret_from_fork+0x10/0x18

    There is also refcount issue, as well:
    WARNING: CPU: 1 PID: 1 at lib/refcount.c:28 refcount_warn_saturate+0xf8/0x170

    The issue is that we make an erroneous extra call to scsi_host_put()
    for that host:

    So in ahci_init_one()->ata_host_alloc_pinfo()->ata_host_alloc(), we setup
    a device release method - ata_devres_release() - which intends to release
    the SCSI hosts:

    static void ata_devres_release(struct device *gendev, void *res)
    {
    ...
    for (i = 0; i < host->n_ports; i++) {
    struct ata_port *ap = host->ports[i];

    if (!ap)
    continue;

    if (ap->scsi_host)
    scsi_host_put(ap->scsi_host);

    }
    ...
    }

    However in the ata_scsi_add_hosts() error path, we also call
    scsi_host_put() for the SCSI hosts.

    Fix by removing the the scsi_host_put() calls in ata_scsi_add_hosts() and
    leave this to ata_devres_release().

    Fixes: f31871951b38 ("libata: separate out ata_host_alloc() and ata_host_register()")
    Signed-off-by: John Garry
    Signed-off-by: Jens Axboe

    John Garry
     

03 Jan, 2020

1 commit

  • The ata_sas_scsi_ioctl() function implements a number of HDIO_* commands
    for SCSI devices, it is used by all libata drivers as well as a few
    drivers that support SAS attached SATA drives.

    The only command that is not safe for compat ioctls here is
    HDIO_GET_32BIT. Change the implementation to check for in_compat_syscall()
    in order to do both cases correctly, and change all callers to use it
    as both native and compat callback pointers, including the indirect
    callers through sas_ioctl and ata_scsi_ioctl.

    Reviewed-by: Ben Hutchings
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

06 Oct, 2019

1 commit


08 Aug, 2019

1 commit

  • For passthrough requests, libata-scsi takes what the user passes in
    as gospel. This can be problematic if the user fills in the CDB
    incorrectly. One example of that is in request sizes. For read/write
    commands, the CDB contains fields describing the transfer length of
    the request. These should match with the SG_IO header fields, but
    libata-scsi currently does no validation of that.

    Check that the number of blocks in the CDB for passthrough requests
    matches what was mapped into the request. If the CDB asks for more
    data then the validated SG_IO header fields, error it.

    Reported-by: Krishna Ram Prakash R
    Reviewed-by: Kees Cook
    Signed-off-by: Jens Axboe

    Jens Axboe
     

21 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 or at your option any
    later version this program is distributed in the hope that it will
    be useful but without any warranty without even the implied warranty
    of merchantability or fitness for a particular purpose see the gnu
    general public license for more details you should have received a
    copy of the gnu general public license along with this program see
    the file copying if not write to the free software foundation 675
    mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 52 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Jilayne Lovejoy
    Reviewed-by: Steve Winslow
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190519154042.342335923@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

10 Mar, 2019

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly update of the usual drivers: arcmsr, qla2xxx, lpfc,
    hisi_sas, target/iscsi and target/core.

    Additionally Christoph refactored gdth as part of the dma changes. The
    major mid-layer change this time is the removal of bidi commands and
    with them the whole of the osd/exofs driver and filesystem. This is a
    major simplification for block and mq in particular"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (240 commits)
    scsi: cxgb4i: validate tcp sequence number only if chip version pf
    scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
    scsi: mpt3sas: Add missing breaks in switch statements
    scsi: aacraid: Fix missing break in switch statement
    scsi: kill command serial number
    scsi: csiostor: drop serial_number usage
    scsi: mvumi: use request tag instead of serial_number
    scsi: dpt_i2o: remove serial number usage
    scsi: st: osst: Remove negative constant left-shifts
    scsi: ufs-bsg: Allow reading descriptors
    scsi: ufs: Allow reading descriptor via raw upiu
    scsi: ufs-bsg: Change the calling convention for write descriptor
    scsi: ufs: Remove unused device quirks
    Revert "scsi: ufs: disable vccq if it's not needed by UFS device"
    scsi: megaraid_sas: Remove a bunch of set but not used variables
    scsi: clean obsolete return values of eh_timed_out
    scsi: sd: Optimal I/O size should be a multiple of physical block size
    scsi: MAINTAINERS: SCSI initiator and target tweaks
    scsi: fcoe: make use of fip_mode enum complete
    ...

    Linus Torvalds
     

09 Mar, 2019

1 commit

  • Pull block layer updates from Jens Axboe:
    "Not a huge amount of changes in this round, the biggest one is that we
    finally have Mings multi-page bvec support merged. Apart from that,
    this pull request contains:

    - Small series that avoids quiescing the queue for sysfs changes that
    match what we currently have (Aleksei)

    - Series of bcache fixes (via Coly)

    - Series of lightnvm fixes (via Mathias)

    - NVMe pull request from Christoph. Nothing major, just SPDX/license
    cleanups, RR mp policy (Hannes), and little fixes (Bart,
    Chaitanya).

    - BFQ series (Paolo)

    - Save blk-mq cpu -> hw queue mapping, removing a pointer indirection
    for the fast path (Jianchao)

    - fops->iopoll() added for async IO polling, this is a feature that
    the upcoming io_uring interface will use (Christoph, me)

    - Partition scan loop fixes (Dongli)

    - mtip32xx conversion from managed resource API (Christoph)

    - cdrom registration race fix (Guenter)

    - MD pull from Song, two minor fixes.

    - Various documentation fixes (Marcos)

    - Multi-page bvec feature. This brings a lot of nice improvements
    with it, like more efficient splitting, larger IOs can be supported
    without growing the bvec table size, and so on. (Ming)

    - Various little fixes to core and drivers"

    * tag 'for-5.1/block-20190302' of git://git.kernel.dk/linux-block: (117 commits)
    block: fix updating bio's front segment size
    block: Replace function name in string with __func__
    nbd: propagate genlmsg_reply return code
    floppy: remove set but not used variable 'q'
    null_blk: fix checking for REQ_FUA
    block: fix NULL pointer dereference in register_disk
    fs: fix guard_bio_eod to check for real EOD errors
    blk-mq: use HCTX_TYPE_DEFAULT but not 0 to index blk_mq_tag_set->map
    block: optimize bvec iteration in bvec_iter_advance
    block: introduce mp_bvec_for_each_page() for iterating over page
    block: optimize blk_bio_segment_split for single-page bvec
    block: optimize __blk_segment_map_sg() for single-page bvec
    block: introduce bvec_nth_page()
    iomap: wire up the iopoll method
    block: add bio_set_polled() helper
    block: wire up block device iopoll method
    fs: add an iopoll method to struct file_operations
    loop: set GENHD_FL_NO_PART_SCAN after blkdev_reread_part()
    loop: do not print warn message if partition scan is successful
    block: bounce: make sure that bvec table is updated
    ...

    Linus Torvalds
     

10 Feb, 2019

2 commits


09 Feb, 2019

1 commit

  • Clang warns several times in the scsi subsystem (trimmed for brevity):

    drivers/scsi/hpsa.c:6209:7: warning: overflow converting case value to
    switch condition type (2147762695 to 18446744071562347015) [-Wswitch]
    case CCISS_GETBUSTYPES:
    ^
    drivers/scsi/hpsa.c:6208:7: warning: overflow converting case value to
    switch condition type (2147762694 to 18446744071562347014) [-Wswitch]
    case CCISS_GETHEARTBEAT:
    ^

    The root cause is that the _IOC macro can generate really large numbers,
    which don't fit into type 'int', which is used for the cmd parameter in
    the ioctls in scsi_host_template. My research into how GCC and Clang are
    handling this at a low level didn't prove fruitful. However, looking at
    the rest of the kernel tree, all ioctls use an 'unsigned int' for the
    cmd parameter, which will fit all of the _IOC values in the scsi/ata
    subsystems.

    Make that change because none of the ioctls expect a negative value for
    any command, it brings the ioctls inline with the reset of the kernel,
    and it removes ambiguity, which is never good when dealing with compilers.

    Link: https://github.com/ClangBuiltLinux/linux/issues/85
    Link: https://github.com/ClangBuiltLinux/linux/issues/154
    Link: https://github.com/ClangBuiltLinux/linux/issues/157
    Signed-off-by: Nathan Chancellor
    Acked-by: Bradley Grove
    Acked-by: Don Brace
    Reviewed-by: Bart Van Assche
    Tested-by: Nick Desaulniers
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Nathan Chancellor
     

30 Aug, 2018

1 commit


25 Aug, 2018

1 commit

  • Pull libata updates from Tejun Heo:
    "Nothing too interesting. Mostly ahci and ahci_platform changes, many
    around power management"

    * 'for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (22 commits)
    ata: ahci_platform: enable to get and control reset
    ata: libahci_platform: add reset control support
    ata: add an extra argument to ahci_platform_get_resources()
    ata: sata_rcar: Add r8a77965 support
    ata: sata_rcar: exclude setting of PHY registers in Gen3
    ata: sata_rcar: really mask all interrupts on Gen2 and later
    Revert "ata: ahci_platform: allow disabling of hotplug to save power"
    ata: libahci: Allow reconfigure of DEVSLP register
    ata: libahci: Correct setting of DEVSLP register
    ata: ahci: Enable DEVSLP by default on x86 with SLP_S0
    ata: ahci: Support state with min power but Partial low power state
    Revert "ata: ahci_platform: convert kcalloc to devm_kcalloc"
    ata: sata_rcar: Add rudimentary Runtime PM support
    ata: sata_rcar: Provide a short-hand for &pdev->dev
    ata: Only output sg element mapped number in verbose debug
    ata: Guard ata_scsi_dump_cdb() by ATA_VERBOSE_DEBUG
    ata: ahci_platform: convert kcalloc to devm_kcalloc
    ata: ahci_platform: convert kzallloc to kcalloc
    ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown
    libata: remove ata_sff_data_xfer_noirq()
    ...

    Linus Torvalds
     

06 Aug, 2018

1 commit


03 Aug, 2018

1 commit

  • To support future compile-time sizeof() checks that will be able to
    validate the length of sense buffers, this removes the only dynamically
    allocated sense buffers in the tree by putting the 96 byte sense buffers
    on the stack.

    Reviewed-by: Christoph Hellwig
    Acked-by: Tejun Heo
    Signed-off-by: Kees Cook
    Signed-off-by: Jens Axboe

    Kees Cook
     

30 Jul, 2018

1 commit

  • Currently when min_power policy is selected, the partial low power state
    is not entered and link will try aggressively enter to only slumber state.
    Add a new policy which still enable DEVSLP but also try to enter partial
    low power state. This policy is presented as "min_power_with_partial".

    For information the difference between partial and slumber
    Partial – PHY logic is powered up, and in a reduced power state. The link
    PM exit latency to active state maximum is 10 ns.
    Slumber – PHY logic is powered up, and in a reduced power state. The link
    PM exit latency to active state maximum is 10 ms.
    Devslp – PHY logic is powered down. The link PM exit latency from this
    state to active state maximum is 20 ms, unless otherwise specified by
    DETO.

    Suggested-and-reviewed-by: Hans de Goede
    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Tejun Heo

    Srinivas Pandruvada
     

13 Jul, 2018

1 commit


02 Jul, 2018

2 commits

  • If the ALL bit is set in the ZBC_OUT command, the command zone ID field
    (block) should be ignored.

    Reported-by: David Butterfield
    Signed-off-by: Damien Le Moal
    Cc: stable@vger.kernel.org
    Signed-off-by: Tejun Heo

    Damien Le Moal
     
  • The block (LBA) specified must not exceed the last addressable LBA,
    which is dev->nr_sectors - 1. So fix the correct check is
    "if (block >= dev->n_sectors)" and not "if (block > dev->n_sectords)".

    Additionally, the asc/ascq to return for an LBA that is not a zone start
    LBA should be ILLEGAL REQUEST, regardless if the bad LBA is out of
    range.

    Reported-by: David Butterfield
    Signed-off-by: Damien Le Moal
    Cc: stable@vger.kernel.org
    Signed-off-by: Tejun Heo

    Damien Le Moal
     

11 Jun, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates to the usual drivers: ufs, qedf, mpt3sas, lpfc,
    xfcp, hisi_sas, cxlflash, qla2xxx.

    In the absence of Nic, we're also taking target updates which are
    mostly minor except for the tcmu refactor.

    The only real core change to worry about is the removal of high page
    bouncing (in sas, storvsc and iscsi). This has been well tested and no
    problems have shown up so far"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (268 commits)
    scsi: lpfc: update driver version to 12.0.0.4
    scsi: lpfc: Fix port initialization failure.
    scsi: lpfc: Fix 16gb hbas failing cq create.
    scsi: lpfc: Fix crash in blk_mq layer when executing modprobe -r lpfc
    scsi: lpfc: correct oversubscription of nvme io requests for an adapter
    scsi: lpfc: Fix MDS diagnostics failure (Rx < Tx)
    scsi: hisi_sas: Mark PHY as in reset for nexus reset
    scsi: hisi_sas: Fix return value when get_free_slot() failed
    scsi: hisi_sas: Terminate STP reject quickly for v2 hw
    scsi: hisi_sas: Add v2 hw force PHY function for internal ATA command
    scsi: hisi_sas: Include TMF elements in struct hisi_sas_slot
    scsi: hisi_sas: Try wait commands before before controller reset
    scsi: hisi_sas: Init disks after controller reset
    scsi: hisi_sas: Create a scsi_host_template per HW module
    scsi: hisi_sas: Reset disks when discovered
    scsi: hisi_sas: Add LED feature for v3 hw
    scsi: hisi_sas: Change common allocation mode of device id
    scsi: hisi_sas: change slot index allocation mode
    scsi: hisi_sas: Introduce hisi_sas_phy_set_linkrate()
    scsi: hisi_sas: fix a typo in hisi_sas_task_prep()
    ...

    Linus Torvalds
     

12 May, 2018

3 commits


11 May, 2018

1 commit

  • Currently, libata ignores requests RQF_QUIET flag and print error
    messages for failed commands, regardless if this flag is set in the
    command request. Fix this by introducing the ata_eh_quiet() function and
    using this function in ata_eh_link_autopsy() to determine if the EH
    context should be quiet. This works by counting the number of failed
    commands and the number of commands with the quiet flag set. If both
    numbers are equal, the the EH context can be set to quiet and all error
    messages suppressed. Otherwise, only the error messages for the failed
    commands are suppressed and the link Emask and irq_stat messages printed.

    Signed-off-by: Damien Le Moal
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Tejun Heo

    Damien Le Moal