30 May, 2018

1 commit

  • [ Upstream commit 2bbea6e117357d17842114c65e9a9cf2d13ae8a3 ]

    when mounting an ISO filesystem sometimes (very rarely)
    the system hangs because of a race condition between two tasks.

    PID: 6766 TASK: ffff88007b2a6dd0 CPU: 0 COMMAND: "mount"
    #0 [ffff880078447ae0] __schedule at ffffffff8168d605
    #1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49
    #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995
    #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
    #4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod]
    #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50
    #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3
    #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs]
    #8 [ffff880078447da8] mount_bdev at ffffffff81202570
    #9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
    #10 [ffff880078447e28] mount_fs at ffffffff81202d09
    #11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f
    #12 [ffff880078447ea8] do_mount at ffffffff81220fee
    #13 [ffff880078447f28] sys_mount at ffffffff812218d6
    #14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
    RIP: 00007fd9ea914e9a RSP: 00007ffd5d9bf648 RFLAGS: 00010246
    RAX: 00000000000000a5 RBX: ffffffff81698c49 RCX: 0000000000000010
    RDX: 00007fd9ec2bc210 RSI: 00007fd9ec2bc290 RDI: 00007fd9ec2bcf30
    RBP: 0000000000000000 R8: 0000000000000000 R9: 0000000000000010
    R10: 00000000c0ed0001 R11: 0000000000000206 R12: 00007fd9ec2bc040
    R13: 00007fd9eb6b2380 R14: 00007fd9ec2bc210 R15: 00007fd9ec2bcf30
    ORIG_RAX: 00000000000000a5 CS: 0033 SS: 002b

    This task was trying to mount the cdrom. It allocated and configured a
    super_block struct and owned the write-lock for the super_block->s_umount
    rwsem. While exclusively owning the s_umount lock, it called
    sr_block_ioctl and waited to acquire the global sr_mutex lock.

    PID: 6785 TASK: ffff880078720fb0 CPU: 0 COMMAND: "systemd-udevd"
    #0 [ffff880078417898] __schedule at ffffffff8168d605
    #1 [ffff880078417900] schedule at ffffffff8168dc59
    #2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605
    #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838
    #4 [ffff8800784179d0] down_read at ffffffff8168cde0
    #5 [ffff8800784179e8] get_super at ffffffff81201cc7
    #6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de
    #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
    #8 [ffff880078417a88] check_disk_change at ffffffff8123ab50
    #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
    #10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod]
    #11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
    #12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
    #13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
    #14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7
    #15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
    #16 [ffff880078417d00] do_last at ffffffff8120d53d
    #17 [ffff880078417db0] path_openat at ffffffff8120e6b2
    #18 [ffff880078417e48] do_filp_open at ffffffff8121082b
    #19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
    #20 [ffff880078417f70] sys_open at ffffffff811fde4e
    #21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
    RIP: 00007f29438b0c20 RSP: 00007ffc76624b78 RFLAGS: 00010246
    RAX: 0000000000000002 RBX: ffffffff81698c49 RCX: 0000000000000000
    RDX: 00007f2944a5fa70 RSI: 00000000000a0800 RDI: 00007f2944a5fa70
    RBP: 00007f2944a5f540 R8: 0000000000000000 R9: 0000000000000020
    R10: 00007f2943614c40 R11: 0000000000000246 R12: ffffffff811fde4e
    R13: ffff880078417f78 R14: 000000000000000c R15: 00007f2944a4b010
    ORIG_RAX: 0000000000000002 CS: 0033 SS: 002b

    This task tried to open the cdrom device, the sr_block_open function
    acquired the global sr_mutex lock. The call to check_disk_change()
    then saw an event flag indicating a possible media change and tried
    to flush any cached data for the device.
    As part of the flush, it tried to acquire the super_block->s_umount
    lock associated with the cdrom device.
    This was the same super_block as created and locked by the previous task.

    The first task acquires the s_umount lock and then the sr_mutex_lock;
    the second task acquires the sr_mutex_lock and then the s_umount lock.

    This patch fixes the issue by moving check_disk_change() out of
    cdrom_open() and let the caller take care of it.

    Signed-off-by: Maurizio Lombardi
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Maurizio Lombardi
     

17 Dec, 2017

1 commit

  • [ Upstream commit 8dc7a31fbce5e2dbbacd83d910da37105181b054 ]

    Compile ide-atapi failed with defining macro "DEBUG"
    ...
    |drivers/ide/ide-atapi.c:285:52: error: 'struct request' has
    no member named 'cmd'; did you mean 'csd'?
    | debug_log("%s: rq->cmd[0]: 0x%x\n", __func__, rq->cmd[0]);
    ...

    Since we split the scsi_request out of struct request, it missed
    do the same thing on debug_log

    Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")

    Signed-off-by: Hongxu Jia
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hongxu Jia
     

08 Nov, 2017

1 commit

  • The 0day bot reports the below failure which happens occasionally, with
    their randconfig testing (once every ~100 boots). The Code points at
    the private pointer ->driver_data being NULL, which hints at a race of
    sorts where the private driver_data descriptor has disappeared by the
    time we get to run the workqueue.

    So let's check that pointer before we continue with issuing the command
    to the drive.

    This fix is of the brown paper bag nature but considering that IDE is
    long deprecated, let's do that so that random testing which happens to
    enable CONFIG_IDE during randconfig builds, doesn't fail because of
    this.

    Besides, failing the TEST_UNIT_READY command because the drive private
    data is gone is something which we could simply do anyway, to denote
    that there was a problem communicating with the device.

    BUG: unable to handle kernel NULL pointer dereference at 000001c0
    IP: cdrom_check_status
    *pde = 00000000
    Oops: 0000 [#1] SMP
    CPU: 1 PID: 155 Comm: kworker/1:2 Not tainted 4.14.0-rc8 #127
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
    Workqueue: events_freezable_power_ disk_events_workfn
    task: 4fe90980 task.stack: 507ac000
    EIP: cdrom_check_status+0x2c/0x90
    EFLAGS: 00210246 CPU: 1
    EAX: 00000000 EBX: 4fefec00 ECX: 00000000 EDX: 00000000
    ESI: 00000003 EDI: ffffffff EBP: 467a9340 ESP: 507aded0
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    CR0: 80050033 CR2: 000001c0 CR3: 06e0f000 CR4: 00000690
    Call Trace:
    ? ide_cdrom_check_events_real
    ? cdrom_check_events
    ? disk_check_events
    ? process_one_work
    ? process_one_work
    ? worker_thread
    ? kthread
    ? process_one_work
    ? __kthread_create_on_node
    ? ret_from_fork
    Code: 53 83 ec 14 89 c3 89 d1 be 03 00 00 00 65 a1 14 00 00 00 89 44 24 10 31 c0 8b 43 18 c7 44 24 04 00 00 00 00 c7 04 24 00 00 00 00 80 c0 01 00 00 c7 44 24 08 00 00 00 00 83 e0 03 c7 44 24 0c
    EIP: cdrom_check_status+0x2c/0x90 SS:ESP: 0068:507aded0
    CR2: 00000000000001c0
    ---[ end trace 2410e586dd8f88b2 ]---

    Reported-and-tested-by: Fengguang Wu
    Signed-off-by: Borislav Petkov
    Cc: "David S. Miller"
    Cc: Jens Axboe
    Cc: Bart Van Assche
    Signed-off-by: Linus Torvalds

    Borislav Petkov
     

03 Nov, 2017

1 commit

  • …el/git/gregkh/driver-core

    Pull initial SPDX identifiers from Greg KH:
    "License cleanup: add SPDX license identifiers to some files

    Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the
    'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
    binding shorthand, which can be used instead of the full boiler plate
    text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart
    and Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset
    of the use cases:

    - file had no licensing information it it.

    - file was a */uapi/* one with no licensing information in it,

    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to
    license had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied
    to a file was done in a spreadsheet of side by side results from of
    the output of two independent scanners (ScanCode & Windriver)
    producing SPDX tag:value files created by Philippe Ombredanne.
    Philippe prepared the base worksheet, and did an initial spot review
    of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537
    files assessed. Kate Stewart did a file by file comparison of the
    scanner results in the spreadsheet to determine which SPDX license
    identifier(s) to be applied to the file. She confirmed any
    determination that was not immediately clear with lawyers working with
    the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:

    - Files considered eligible had to be source code files.

    - Make and config files were included as candidates if they contained
    >5 lines of source

    - File already had some variant of a license header in it (even if <5
    lines).

    All documentation files were explicitly excluded.

    The following heuristics were used to determine which SPDX license
    identifiers to apply.

    - when both scanners couldn't find any license traces, file was
    considered to have no license information in it, and the top level
    COPYING file license applied.

    For non */uapi/* files that summary was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 11139

    and resulted in the first patch in this series.

    If that file was a */uapi/* path one, it was "GPL-2.0 WITH
    Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
    was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 WITH Linux-syscall-note 930

    and resulted in the second patch in this series.

    - if a file had some form of licensing information in it, and was one
    of the */uapi/* ones, it was denoted with the Linux-syscall-note if
    any GPL family license was found in the file or had no licensing in
    it (per prior point). Results summary:

    SPDX license identifier # files
    ---------------------------------------------------|------
    GPL-2.0 WITH Linux-syscall-note 270
    GPL-2.0+ WITH Linux-syscall-note 169
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
    LGPL-2.1+ WITH Linux-syscall-note 15
    GPL-1.0+ WITH Linux-syscall-note 14
    ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
    LGPL-2.0+ WITH Linux-syscall-note 4
    LGPL-2.1 WITH Linux-syscall-note 3
    ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
    ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

    and that resulted in the third patch in this series.

    - when the two scanners agreed on the detected license(s), that
    became the concluded license(s).

    - when there was disagreement between the two scanners (one detected
    a license but the other didn't, or they both detected different
    licenses) a manual inspection of the file occurred.

    - In most cases a manual inspection of the information in the file
    resulted in a clear resolution of the license that should apply
    (and which scanner probably needed to revisit its heuristics).

    - When it was not immediately clear, the license identifier was
    confirmed with lawyers working with the Linux Foundation.

    - If there was any question as to the appropriate license identifier,
    the file was flagged for further research and to be revisited later
    in time.

    In total, over 70 hours of logged manual review was done on the
    spreadsheet to determine the SPDX license identifiers to apply to the
    source files by Kate, Philippe, Thomas and, in some cases,
    confirmation by lawyers working with the Linux Foundation.

    Kate also obtained a third independent scan of the 4.13 code base from
    FOSSology, and compared selected files where the other two scanners
    disagreed against that SPDX file, to see if there was new insights.
    The Windriver scanner is based on an older version of FOSSology in
    part, so they are related.

    Thomas did random spot checks in about 500 files from the spreadsheets
    for the uapi headers and agreed with SPDX license identifier in the
    files he inspected. For the non-uapi files Thomas did random spot
    checks in about 15000 files.

    In initial set of patches against 4.14-rc6, 3 files were found to have
    copy/paste license identifier errors, and have been fixed to reflect
    the correct identifier.

    Additionally Philippe spent 10 hours this week doing a detailed manual
    inspection and review of the 12,461 patched files from the initial
    patch version early this week with:

    - a full scancode scan run, collecting the matched texts, detected
    license ids and scores

    - reviewing anything where there was a license detected (about 500+
    files) to ensure that the applied SPDX license was correct

    - reviewing anything where there was no detection but the patch
    license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
    applied SPDX license was correct

    This produced a worksheet with 20 files needing minor correction. This
    worksheet was then exported into 3 different .csv files for the
    different types of files to be modified.

    These .csv files were then reviewed by Greg. Thomas wrote a script to
    parse the csv files and add the proper SPDX tag to the file, in the
    format that the file expected. This script was further refined by Greg
    based on the output to detect more types of files automatically and to
    distinguish between header and source .c files (which need different
    comment types.) Finally Greg ran the script using the .csv files to
    generate the patches.

    Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
    Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

    * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    License cleanup: add SPDX license identifier to uapi header files with a license
    License cleanup: add SPDX license identifier to uapi header files with no license
    License cleanup: add SPDX GPL-2.0 license identifier to files with no license

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 Nov, 2017

1 commit

  • Since we split the scsi_request out of struct request, while the
    standard prep_rq_fn builds 10 byte cmds, it missed to invoke
    scsi_req_init() to initialize certain fields of a scsi_request
    structure (.__cmd[], .cmd, .cmd_len and .sense_len but no other
    members of struct scsi_request).

    An example panic on virtual machines (qemu/virtualbox) to boot
    from IDE cdrom:
    ...
    [ 8.754381] Call Trace:
    [ 8.755419] blk_peek_request+0x182/0x2e0
    [ 8.755863] blk_fetch_request+0x1c/0x40
    [ 8.756148] ? ktime_get+0x40/0xa0
    [ 8.756385] do_ide_request+0x37d/0x660
    [ 8.756704] ? cfq_group_service_tree_add+0x98/0xc0
    [ 8.757011] ? cfq_service_tree_add+0x1e5/0x2c0
    [ 8.757313] ? ktime_get+0x40/0xa0
    [ 8.757544] __blk_run_queue+0x3d/0x60
    [ 8.757837] queue_unplugged+0x2f/0xc0
    [ 8.758088] blk_flush_plug_list+0x1f4/0x240
    [ 8.758362] blk_finish_plug+0x2c/0x40
    ...
    [ 8.770906] RIP: ide_cdrom_prep_fn+0x63/0x180 RSP: ffff92aec018bae8
    [ 8.772329] ---[ end trace 6408481e551a85c9 ]---
    ...

    Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")

    Signed-off-by: Hongxu Jia
    Signed-off-by: Jens Axboe

    Hongxu Jia
     

04 Oct, 2017

3 commits

  • We used to assign IRQs for all devices at boot-time, before any drivers
    claimed devices. The following commits:

    30fdfb929e82 ("PCI: Add a call to pci_assign_irq() in pci_device_probe()")
    0e4c2eeb758a ("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")

    changed this so we now call pci_assign_irq() from pci_device_probe() when
    we call a driver's probe method.

    The ide_scan_pcibus() path (enabled by CONFIG_IDEPCI_PCIBUS_ORDER) bypasses
    pci_device_probe() so it can guarantee devices are claimed in order of PCI
    bus address. It calls the driver's probe method directly, so it misses the
    pci_assign_irq() call (and other PCI initialization functions), which
    causes failures like this:

    ide0: disabled, no IRQ
    ide0: failed to initialize IDE interface
    ide0: disabling port
    cmd64x 0000:00:02.0: IDE controller (0x1095:0x0646 rev 0x07)
    CMD64x_IDE 0000:00:02.0: BAR 0: can't reserve [io 0x8050-0x8057]
    cmd64x 0000:00:02.0: can't reserve resources
    CMD64x_IDE: probe of 0000:00:02.0 failed with error -16
    ide_generic: please use "probe_mask=0x3f" module parameter for probing
    all legacy ISA IDE ports
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x94/0xd0
    sysfs: cannot create duplicate filename '/class/ide_port/ide0'
    ...

    Trace:
    [] sysfs_warn_dup+0x94/0xd0
    [] warn_slowpath_fmt+0x58/0x70
    [] sysfs_warn_dup+0x94/0xd0
    [] kernfs_path_from_node+0x30/0x60
    [] kernfs_put+0x16c/0x2c0
    [] kernfs_put+0x16c/0x2c0
    [] sysfs_do_create_link_sd.isra.2+0x100/0x120
    [] device_add+0x2a4/0x7c0
    [] device_create_groups_vargs+0x14c/0x170
    [] device_create_groups_vargs+0x98/0x170
    [] device_create+0x50/0x70
    [] ide_host_register+0x48c/0xa00
    [] ide_host_register+0x450/0xa00
    [] device_register+0x20/0x50
    [] ide_host_register+0x450/0xa00
    [] ide_host_add+0x64/0xe0
    [] kobject_uevent_env+0x16c/0x710
    [] do_one_initcall+0x68/0x260
    [] kernel_init+0x1c/0x1a0
    ...
    ---[ end trace 24a70433c3e4d374 ]---
    ide0: disabling port

    Fix the IRQ allocation issue by calling pci_assign_irq() from
    ide_scan_pcidev() before probing the IDE PCI drivers, so that IRQs for a
    given PCI device are allocated for the IDE PCI drivers to use them for
    device configuration.

    Fixes: 30fdfb929e82 ("PCI: Add a call to pci_assign_irq() in pci_device_probe()")
    Fixes: 0e4c2eeb758a ("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
    Link: http://lkml.kernel.org/r/32ec730f-c1b0-5584-cd35-f8a809122b96@roeck-us.net
    Reported-by: Guenter Roeck
    Tested-by: Guenter Roeck
    Signed-off-by: Lorenzo Pieralisi
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Acked-by: David S. Miller
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner

    Lorenzo Pieralisi
     
  • Recent pci_assign_irq() changes uncovered a problem with missing freeing of
    PCI BARs on PCI IDE host initialization failure:

    ide0: disabled, no IRQ
    ide0: failed to initialize IDE interface
    ide0: disabling port
    cmd64x 0000:00:02.0: IDE controller (0x1095:0x0646 rev 0x07)
    CMD64x_IDE 0000:00:02.0: BAR 0: can't reserve [io 0x8050-0x8057]
    cmd64x 0000:00:02.0: can't reserve resources
    CMD64x_IDE: probe of 0000:00:02.0 failed with error -16

    Fix the problem by adding missing freeing of PCI BARs to
    ide_setup_pci_controller() and ide_pci_init_two().

    Fixes: 30fdfb929e82 ("PCI: Add a call to pci_assign_irq() in pci_device_probe()")
    Fixes: 0e4c2eeb758a ("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
    Link: http://lkml.kernel.org/r/32ec730f-c1b0-5584-cd35-f8a809122b96@roeck-us.net
    Reported-by: Guenter Roeck
    Tested-by: Guenter Roeck
    Signed-off-by: Bartlomiej Zolnierkiewicz
    [bhelgaas: add Fixes:]
    Signed-off-by: Bjorn Helgaas
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner

    Bartlomiej Zolnierkiewicz
     
  • Recent pci_assign_irq() changes uncovered a problem with missing freeing of
    ide_port class instance on hwif_init() failure in ide_host_register():

    ide0: disabled, no IRQ
    ide0: failed to initialize IDE interface
    ide0: disabling port
    cmd64x 0000:00:02.0: IDE controller (0x1095:0x0646 rev 0x07)
    CMD64x_IDE 0000:00:02.0: BAR 0: can't reserve [io 0x8050-0x8057]
    cmd64x 0000:00:02.0: can't reserve resources
    CMD64x_IDE: probe of 0000:00:02.0 failed with error -16
    ide_generic: please use "probe_mask=0x3f" module parameter for probing all legacy ISA IDE ports
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x94/0xd0
    sysfs: cannot create duplicate filename '/class/ide_port/ide0'
    ...

    Trace:
    [] __warn+0x160/0x190
    [] sysfs_warn_dup+0x94/0xd0
    [] warn_slowpath_fmt+0x58/0x70
    [] sysfs_warn_dup+0x94/0xd0
    [] kernfs_path_from_node+0x30/0x60
    [] kernfs_put+0x16c/0x2c0
    [] kernfs_put+0x16c/0x2c0
    [] sysfs_do_create_link_sd.isra.2+0x100/0x120
    [] device_add+0x2a4/0x7c0
    [] device_create_groups_vargs+0x14c/0x170
    [] device_create_groups_vargs+0x98/0x170
    [] device_create+0x50/0x70
    [] ide_host_register+0x48c/0xa00
    [] ide_host_register+0x450/0xa00
    [] device_register+0x20/0x50
    [] ide_host_register+0x450/0xa00
    [] ide_host_add+0x64/0xe0
    [] kobject_uevent_env+0x16c/0x710
    [] do_one_initcall+0x68/0x260
    [] kernel_init+0x1c/0x1a0
    [] kernel_init+0x0/0x1a0
    [] ret_from_kernel_thread+0x18/0x20
    [] kernel_init+0x0/0x1a0

    ---[ end trace 24a70433c3e4d374 ]---
    ide0: disabling port

    Fix the problem by adding missing code to ide_host_register().

    Fixes: 30fdfb929e82 ("PCI: Add a call to pci_assign_irq() in pci_device_probe()")
    Fixes: 0e4c2eeb758a ("alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
    Link: http://lkml.kernel.org/r/32ec730f-c1b0-5584-cd35-f8a809122b96@roeck-us.net
    Reported-by: Guenter Roeck
    Tested-by: Guenter Roeck
    Signed-off-by: Bartlomiej Zolnierkiewicz
    [bhelgaas: add Fixes:]
    Signed-off-by: Bjorn Helgaas
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner

    Bartlomiej Zolnierkiewicz
     

08 Sep, 2017

1 commit

  • Pull block layer updates from Jens Axboe:
    "This is the first pull request for 4.14, containing most of the code
    changes. It's a quiet series this round, which I think we needed after
    the churn of the last few series. This contains:

    - Fix for a registration race in loop, from Anton Volkov.

    - Overflow complaint fix from Arnd for DAC960.

    - Series of drbd changes from the usual suspects.

    - Conversion of the stec/skd driver to blk-mq. From Bart.

    - A few BFQ improvements/fixes from Paolo.

    - CFQ improvement from Ritesh, allowing idling for group idle.

    - A few fixes found by Dan's smatch, courtesy of Dan.

    - A warning fixup for a race between changing the IO scheduler and
    device remova. From David Jeffery.

    - A few nbd fixes from Josef.

    - Support for cgroup info in blktrace, from Shaohua.

    - Also from Shaohua, new features in the null_blk driver to allow it
    to actually hold data, among other things.

    - Various corner cases and error handling fixes from Weiping Zhang.

    - Improvements to the IO stats tracking for blk-mq from me. Can
    drastically improve performance for fast devices and/or big
    machines.

    - Series from Christoph removing bi_bdev as being needed for IO
    submission, in preparation for nvme multipathing code.

    - Series from Bart, including various cleanups and fixes for switch
    fall through case complaints"

    * 'for-4.14/block' of git://git.kernel.dk/linux-block: (162 commits)
    kernfs: checking for IS_ERR() instead of NULL
    drbd: remove BIOSET_NEED_RESCUER flag from drbd_{md_,}io_bio_set
    drbd: Fix allyesconfig build, fix recent commit
    drbd: switch from kmalloc() to kmalloc_array()
    drbd: abort drbd_start_resync if there is no connection
    drbd: move global variables to drbd namespace and make some static
    drbd: rename "usermode_helper" to "drbd_usermode_helper"
    drbd: fix race between handshake and admin disconnect/down
    drbd: fix potential deadlock when trying to detach during handshake
    drbd: A single dot should be put into a sequence.
    drbd: fix rmmod cleanup, remove _all_ debugfs entries
    drbd: Use setup_timer() instead of init_timer() to simplify the code.
    drbd: fix potential get_ldev/put_ldev refcount imbalance during attach
    drbd: new disk-option disable-write-same
    drbd: Fix resource role for newly created resources in events2
    drbd: mark symbols static where possible
    drbd: Send P_NEG_ACK upon write error in protocol != C
    drbd: add explicit plugging when submitting batches
    drbd: change list_for_each_safe to while(list_first_entry_or_null)
    drbd: introduce drbd_recv_header_maybe_unplug
    ...

    Linus Torvalds
     

01 Sep, 2017

1 commit

  • Now that we have a custom printf format specifier, convert users of
    full_name to use %pOF instead. This is preparation to remove storing
    of the full path string for each node.

    Signed-off-by: Rob Herring
    Cc: "David S. Miller"
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: linux-ide@vger.kernel.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Acked-by: David S. Miller
    Signed-off-by: Michael Ellerman

    Rob Herring
     

18 Aug, 2017

1 commit


21 Jul, 2017

1 commit

  • gcc-7 warns about the result of a constant multiplication used as
    a boolean:

    drivers/ide/ide-timings.c: In function 'ide_timing_quantize':
    drivers/ide/ide-timings.c:112:24: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
    q->setup = EZ(t->setup * 1000, T);

    This slightly rearranges the macro to simplify the code and avoid
    the warning at the same time.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

21 Jun, 2017

2 commits

  • Since scsi_req_init() works on a struct scsi_request, change the
    argument type into struct scsi_request *.

    Signed-off-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Bart Van Assche
     
  • Instead of explicitly calling scsi_req_init() after blk_get_request(),
    call that function from inside blk_get_request(). Add an
    .initialize_rq_fn() callback function to the block drivers that need
    it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
    because it is too small to keep it as a separate function. Keep the
    scsi_req_init() call in ide_prep_sense() because it follows a
    blk_rq_init() call.

    References: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
    Signed-off-by: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Omar Sandoval
    Cc: Nicholas Bellinger
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

09 Jun, 2017

1 commit

  • Currently we use nornal Linux errno values in the block layer, and while
    we accept any error a few have overloaded magic meanings. This patch
    instead introduces a new blk_status_t value that holds block layer specific
    status codes and explicitly explains their meaning. Helpers to convert from
    and to the previous special meanings are provided for now, but I suspect
    we want to get rid of them in the long run - those drivers that have a
    errno input (e.g. networking) usually get errnos that don't know about
    the special block layer overloads, and similarly returning them to userspace
    will usually return somethings that strictly speaking isn't correct
    for file system operations, but that's left as an exercise for later.

    For now the set of errors is a very limited set that closely corresponds
    to the previous overloaded errno values, but there is some low hanging
    fruite to improve it.

    blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
    typechecking, so that we can easily catch places passing the wrong values.

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

    Christoph Hellwig
     

02 Jun, 2017

1 commit

  • From the context where a SCSI command is submitted it is not always
    possible to figure out whether or not the queue the command is
    submitted to has struct scsi_request as the first member of its
    private data. Hence introduce the flag QUEUE_FLAG_SCSI_PASSTHROUGH.

    Signed-off-by: Bart Van Assche
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Cc: Omar Sandoval
    Cc: Don Brace
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

09 May, 2017

2 commits

  • The parisc architecture recently reimplemented the memcpy function and
    their reimplementation crashed when source and destination overlapped.

    The crash happened in the function ide_complete_cmd where memcpy is called
    with the same source and destination pointer. According to the C
    specification, memcpy behavior is undefined if the source and destination
    range overlaps. This patches fixes the undefined behavior.

    Signed-off-by: Mikulas Patocka
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: David S. Miller

    Mikulas Patocka
     
  • Use setup_timer() instead of init_timer() to simplify the code.

    Signed-off-by: Geliang Tang
    Signed-off-by: David S. Miller

    Geliang Tang
     

26 Apr, 2017

2 commits


21 Apr, 2017

2 commits

  • This passes on the scsi_cmnd result field to users of passthrough
    requests. Currently we abuse req->errors for this purpose, but that
    field will go away in its current form.

    Note that the old IDE code abuses the errors field in very creative
    ways and stores all kinds of different values in it. I didn't dare
    to touch this magic, so the abuses are brought forward 1:1.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Bart Van Assche
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • The function only returns -EIO if rq->errors is non-zero, which is not
    very useful and lets a large number of callers ignore the return value.

    Just let the callers figure out their error themselves.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: Bart Van Assche
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

02 Mar, 2017

2 commits


01 Mar, 2017

1 commit

  • Pull IDE updates from David Miller:
    "Just one actual change here this time around, adding some init data
    annotations. The other change was bogus and got reverted"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
    ide: palm_bk3710: add __initdata to palm_bk3710_port_info
    Revert "ide: Fix interface autodetection in legacy IDE driver (trial #2)"
    ide: Fix interface autodetection in legacy IDE driver (trial #2)

    Linus Torvalds
     

28 Feb, 2017

2 commits

  • Now that %z is standartised in C99 there is no reason to support %Z.
    Unlike %L it doesn't even make format strings smaller.

    Use BUILD_BUG_ON in a couple ATM drivers.

    In case anyone didn't notice lib/vsprintf.o is about half of SLUB which
    is in my opinion is quite an achievement. Hopefully this patch inspires
    someone else to trim vsprintf.c more.

    Link: http://lkml.kernel.org/r/20170103230126.GA30170@avx2
    Signed-off-by: Alexey Dobriyan
    Cc: Andy Shevchenko
    Cc: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • The object palm_bk3710_port_info of type ide_port_info is never
    referenced anywhere after initialization by palm_bk3710_probe. It is
    also passed as a parameter to ide_host_add which is called from the init
    function but this call doesn't store the object reference anywhere, and
    it only dereferences the values of the fields. Therefore add __initdata
    to its declaration.

    Signed-off-by: Bhumika Goyal
    Signed-off-by: David S. Miller

    Bhumika Goyal
     

18 Feb, 2017

1 commit


14 Feb, 2017

1 commit

  • Since function tables are a common target for attackers, it's best to keep
    them in read-only memory. As such, this makes the CDROM device ops tables
    const. This drops additionally n_minors, since it isn't used meaningfully,
    and sets the only user of cdrom_dummy_generic_packet explicitly so the
    variables can all be const.

    Inspired by similar changes in grsecurity/PaX.

    Signed-off-by: Kees Cook
    Acked-by: David S. Miller
    Signed-off-by: Jens Axboe

    Kees Cook
     

01 Feb, 2017

3 commits

  • Instead of keeping two levels of indirection for requests types, fold it
    all into the operations. The little caveat here is that previously
    cmd_type only applied to struct request, while the request and bio op
    fields were set to plain REQ_OP_READ/WRITE even for passthrough
    operations.

    Instead this patch adds new REQ_OP_* for SCSI passthrough and driver
    private requests, althought it has to add two for each so that we
    can communicate the data in/out nature of the request.

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

    Christoph Hellwig
     
  • Currently the legacy ide driver defines several request types of it's own,
    which is in the way of removing that field entirely.

    Instead add a type field to struct ide_request and use that to distinguish
    the different types of IDE-internal requests.

    It's a bit of a mess, but so is the surrounding code..

    Signed-off-by: Christoph Hellwig
    Acked-by: David S. Miller
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • We only need this code to support scsi, ide, cciss and virtio. And at
    least for virtio it's a deprecated feature to start with.

    This should shrink the kernel size for embedded device that only use,
    say eMMC a bit.

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

    Christoph Hellwig
     

28 Jan, 2017

1 commit

  • And require all drivers that want to support BLOCK_PC to allocate it
    as the first thing of their private data. To support this the legacy
    IDE and BSG code is switched to set cmd_size on their queues to let
    the block layer allocate the additional space.

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

    Christoph Hellwig
     

10 Jan, 2017

1 commit


27 Dec, 2016

1 commit

  • This humble patch was sent one or two months before, and had no actions,
    except for a colleague reply which friendly pointed out some formatting
    problems (which were solved in a second message).

    It relates to an old code, the legacy IDE driver, but the bug it
    addresses is real. The code, although rarely used, is
    still there to be compiled if one chooses to do so (like me).

    Also, the fix has a very low risk of present collateral effects IMHO.
    It is already compiled and tested in some embedded machines.

    So, again IMHO, it is worth be fixed.

    This email is a second trial with it. I hope it can help the one or two
    guys out there which are still running the legacy IDE driver and
    haven't noticed the former email.

    Fixes: 20df429dd667 ("ide-generic: handle probing of legacy io-ports v5")
    Signed-off-by: Luiz Carlos Ramos
    Signed-off-by: David S. Miller

    lramos.prof@yahoo.com.br
     

25 Dec, 2016

1 commit


28 Oct, 2016

1 commit

  • A lot of the REQ_* flags are only used on struct requests, and only of
    use to the block layer and a few drivers that dig into struct request
    internals.

    This patch adds a new req_flags_t rq_flags field to struct request for
    them, and thus dramatically shrinks the number of common requests. It
    also removes the unfortunate situation where we have to fit the fields
    from the same enum into 32 bits for struct bio and 64 bits for
    struct request.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Shaun Tancheff
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

30 Jul, 2016

1 commit

  • Pull IDE updates from David Miller:
    "Just a couple small bug fixes, nothing overly exciting in here"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
    ide: missing break statement in set_timings_mdma()
    ide: hpt366: fix incorrect mask when checking at cmd_high_time
    ide-tape: fix misprint in failure handling in idetape_init()
    cmd640: add __init attribute

    Linus Torvalds
     

28 Jul, 2016

1 commit

  • Pull LED updates from Jacek Anaszewski:
    "New LED class driver:
    - LED driver for TI LP3952 6-Channel Color LED

    LED core improvements:
    - Only descend into leds directory when CONFIG_NEW_LEDS is set
    - Add no-op gpio_led_register_device when LED subsystem is disabled
    - MAINTAINERS: Add file patterns for led device tree bindings

    LED Trigger core improvements:
    - return error if invalid trigger name is provided via sysfs

    LED class drivers improvements
    - is31fl32xx: define complete i2c_device_id table
    - is31fl32xx: fix typo in id and match table names
    - leds-gpio: Set of_node for created LED devices
    - pca9532: Add device tree support

    Conversion of IDE trigger to common disk trigger:
    - leds: convert IDE trigger to common disk trigger
    - leds: documentation: 'ide-disk' to 'disk-activity'
    - unicore32: use the new LED disk activity trigger
    - parisc: use the new LED disk activity trigger
    - mips: use the new LED disk activity trigger
    - arm: use the new LED disk activity trigger
    - powerpc: use the new LED disk activity trigger"

    * tag 'leds_for_4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
    leds: is31fl32xx: define complete i2c_device_id table
    leds: is31fl32xx: fix typo in id and match table names
    leds: LED driver for TI LP3952 6-Channel Color LED
    leds: leds-gpio: Set of_node for created LED devices
    leds: triggers: return error if invalid trigger name is provided via sysfs
    leds: Only descend into leds directory when CONFIG_NEW_LEDS is set
    leds: Add no-op gpio_led_register_device when LED subsystem is disabled
    unicore32: use the new LED disk activity trigger
    parisc: use the new LED disk activity trigger
    mips: use the new LED disk activity trigger
    arm: use the new LED disk activity trigger
    powerpc: use the new LED disk activity trigger
    leds: documentation: 'ide-disk' to 'disk-activity'
    leds: convert IDE trigger to common disk trigger
    leds: pca9532: Add device tree support
    MAINTAINERS: Add file patterns for led device tree bindings

    Linus Torvalds