24 Mar, 2019

1 commit

  • commit 32e36bfbcf31452a854263e7c7f32fbefc4b44d8 upstream.

    When using SCSI passthrough in combination with the iSCSI target driver
    then cmd->t_state_lock may be obtained from interrupt context. Hence, all
    code that obtains cmd->t_state_lock from thread context must disable
    interrupts first. This patch avoids that lockdep reports the following:

    WARNING: inconsistent lock state
    4.18.0-dbg+ #1 Not tainted
    --------------------------------
    inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
    iscsi_ttx/1800 [HC1[1]:SC0[2]:HE0:SE0] takes:
    000000006e7b0ceb (&(&cmd->t_state_lock)->rlock){?...}, at: target_complete_cmd+0x47/0x2c0 [target_core_mod]
    {HARDIRQ-ON-W} state was registered at:
    lock_acquire+0xd2/0x260
    _raw_spin_lock+0x32/0x50
    iscsit_close_connection+0x97e/0x1020 [iscsi_target_mod]
    iscsit_take_action_for_connection_exit+0x108/0x200 [iscsi_target_mod]
    iscsi_target_rx_thread+0x180/0x190 [iscsi_target_mod]
    kthread+0x1cf/0x1f0
    ret_from_fork+0x24/0x30
    irq event stamp: 1281
    hardirqs last enabled at (1279): [] __local_bh_enable_ip+0xa9/0x160
    hardirqs last disabled at (1281): [] interrupt_entry+0xb5/0xd0
    softirqs last enabled at (1278): [] lock_sock_nested+0x51/0xc0
    softirqs last disabled at (1280): [] ip6_finish_output2+0x124/0xe40 [ipv6]

    other info that might help us debug this:
    Possible unsafe locking scenario:

    CPU0
    ----
    lock(&(&cmd->t_state_lock)->rlock);

    lock(&(&cmd->t_state_lock)->rlock);

    Bart Van Assche
     

27 Feb, 2019

1 commit

  • [ Upstream commit a94a2572b97744d3a35a1996df0e5cf6b2461a4a ]

    Currently there is one cmd timeout timer and one qfull timer for each udev,
    and whenever any new command is coming in we will update the cmd timer or
    qfull timer. For some corner cases the timers are always working only for
    the ringbuffer's and full queue's newest cmd. That's to say the timer won't
    be fired even if one cmd has been stuck for a very long time and the
    deadline is reached.

    This fix will keep the cmd/qfull timers to be pended for the oldest cmd in
    ringbuffer and full queue, and will update them with the next cmd's
    deadline only when the old cmd's deadline is reached or removed from the
    ringbuffer and full queue.

    Signed-off-by: Xiubo Li
    Acked-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Xiubo Li
     

23 Feb, 2019

1 commit

  • commit 8b2db98e814a5ec45e8800fc22ca9000ae0a517b upstream.

    memory allocated by kmem_cache_alloc() should be freed using
    kmem_cache_free(), not kfree().

    Fixes: ad669505c4e9 ("scsi: target/core: Make sure that target_wait_for_sess_cmds() waits long enough")
    Signed-off-by: Wei Yongjun
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     

26 Jan, 2019

2 commits

  • [ Upstream commit ad669505c4e9db9af9faeb5c51aa399326a80d91 ]

    A session must only be released after all code that accesses the session
    structure has finished. Make sure that this is the case by introducing a
    new command counter per session that is only decremented after the
    .release_cmd() callback has finished. This patch fixes the following crash:

    BUG: KASAN: use-after-free in do_raw_spin_lock+0x1c/0x130
    Read of size 4 at addr ffff8801534b16e4 by task rmdir/14805
    CPU: 16 PID: 14805 Comm: rmdir Not tainted 4.18.0-rc2-dbg+ #5
    Call Trace:
    dump_stack+0xa4/0xf5
    print_address_description+0x6f/0x270
    kasan_report+0x241/0x360
    __asan_load4+0x78/0x80
    do_raw_spin_lock+0x1c/0x130
    _raw_spin_lock_irqsave+0x52/0x60
    srpt_set_ch_state+0x27/0x70 [ib_srpt]
    srpt_disconnect_ch+0x1b/0xc0 [ib_srpt]
    srpt_close_session+0xa8/0x260 [ib_srpt]
    target_shutdown_sessions+0x170/0x180 [target_core_mod]
    core_tpg_del_initiator_node_acl+0xf3/0x200 [target_core_mod]
    target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
    config_item_release+0x9c/0x110 [configfs]
    config_item_put+0x26/0x30 [configfs]
    configfs_rmdir+0x3b8/0x510 [configfs]
    vfs_rmdir+0xb3/0x1e0
    do_rmdir+0x262/0x2c0
    do_syscall_64+0x77/0x230
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Cc: Nicholas Bellinger
    Cc: Mike Christie
    Cc: Christoph Hellwig
    Cc: David Disseldorp
    Cc: Hannes Reinecke
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Bart Van Assche
     
  • [ Upstream commit 0de263577de5d5e052be5f4f93334e63cc8a7f0b ]

    spc5r17.pdf specifies:

    4.3.1 ASCII data field requirements
    ASCII data fields shall contain only ASCII printable characters (i.e.,
    code values 20h to 7Eh) and may be terminated with one or more ASCII null
    (00h) characters. ASCII data fields described as being left-aligned
    shall have any unused bytes at the end of the field (i.e., highest
    offset) and the unused bytes shall be filled with ASCII space characters
    (20h).

    LIO currently space-pads the T10 VENDOR IDENTIFICATION and PRODUCT
    IDENTIFICATION fields in the standard INQUIRY data. However, the PRODUCT
    REVISION LEVEL field in the standard INQUIRY data as well as the T10 VENDOR
    IDENTIFICATION field in the INQUIRY Device Identification VPD Page are
    zero-terminated/zero-padded.

    Fix this inconsistency by using space-padding for all of the above fields.

    Signed-off-by: David Disseldorp
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Bryant G. Ly
    Reviewed-by: Lee Duncan
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Roman Bolshakov
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    David Disseldorp
     

23 Jan, 2019

3 commits

  • [ Upstream commit ed076c55b359cc9982ca8b065bcc01675f7365f6 ]

    In case of arp failure call cxgbit_put_csk() to free csk.

    Signed-off-by: Varun Prakash
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Varun Prakash
     
  • [ Upstream commit 801df68d617e3cb831f531c99fa6003620e6b343 ]

    csk leak can happen if a new TCP connection gets established after
    cxgbit_accept_np() returns, to fix this leak free remaining csk in
    cxgbit_free_np().

    Signed-off-by: Varun Prakash
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Varun Prakash
     
  • This reverts commit c9cef2c71a89a2c926dae8151f9497e72f889315.

    A wrong commit message was used for the stable commit because of a human
    error (and duplicate commit subject lines).

    This patch reverts this error, and the following patches add the two
    upstream commits.

    Signed-off-by: Sasha Levin

    Sasha Levin
     

13 Jan, 2019

2 commits


14 Nov, 2018

1 commit

  • commit 38fe73cc2c96fbc9942b07220f2a4f1bab37392d upstream.

    With the addition of commit 00d909a10710 ("scsi: target: Make the session
    shutdown code also wait for commands that are being aborted") in v4.19-rc, it
    incorrectly assumes no signals will be pending for task_struct executing the
    normal session shutdown and I/O quiesce code-path.

    For example, iscsi-target and iser-target issue SIGINT to all kthreads as part
    of session shutdown. This has been the behaviour since day one.

    As-is when signals are pending with se_cmds active in se_sess->sess_cmd_list,
    wait_event_interruptible_lock_irq_timeout() returns a negative number and
    immediately kills the machine because of the do while (ret cmd_wait_comp) was able to be interrupted, so to
    address this for v4.19+ moving forward go ahead and use
    wait_event_lock_irq_timeout() instead so new code works with all fabric
    drivers.

    Also for commit 00d909a107, fix a minor regression in
    target_release_cmd_kref() to only wake_up the new se_sess->cmd_list_wq only
    when shutdown has actually been triggered via se_sess->sess_tearing_down.

    Fixes: 00d909a10710 ("scsi: target: Make the session shutdown code also wait for commands that are being aborted")
    Cc: # v4.19+
    Cc: Bart Van Assche
    Cc: Mike Christie
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Cc: Sagi Grimberg
    Cc: Bryant G. Ly
    Tested-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger
    Reviewed-by: Bryant G. Ly
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Bellinger
     

22 Sep, 2018

2 commits

  • Signed-off-by: Vincent Pelletier
    Reviewed-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Vincent Pelletier
     
  • This change has the following effects, in order of descreasing importance:

    1) Prevent a stack buffer overflow

    2) Do not append an unnecessary NULL to an anyway binary buffer, which
    is writing one byte past client_digest when caller is:
    chap_string_to_hex(client_digest, chap_r, strlen(chap_r));

    The latter was found by KASAN (see below) when input value hes expected size
    (32 hex chars), and further analysis revealed a stack buffer overflow can
    happen when network-received value is longer, allowing an unauthenticated
    remote attacker to smash up to 17 bytes after destination buffer (16 bytes
    attacker-controlled and one null). As switching to hex2bin requires
    specifying destination buffer length, and does not internally append any null,
    it solves both issues.

    This addresses CVE-2018-14633.

    Beyond this:

    - Validate received value length and check hex2bin accepted the input, to log
    this rejection reason instead of just failing authentication.

    - Only log received CHAP_R and CHAP_C values once they passed sanity checks.

    ==================================================================
    BUG: KASAN: stack-out-of-bounds in chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
    Write of size 1 at addr ffff8801090ef7c8 by task kworker/0:0/1021

    CPU: 0 PID: 1021 Comm: kworker/0:0 Tainted: G O 4.17.8kasan.sess.connops+ #2
    Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 05/19/2014
    Workqueue: events iscsi_target_do_login_rx [iscsi_target_mod]
    Call Trace:
    dump_stack+0x71/0xac
    print_address_description+0x65/0x22e
    ? chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
    kasan_report.cold.6+0x241/0x2fd
    chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
    chap_server_compute_md5.isra.2+0x2cb/0x860 [iscsi_target_mod]
    ? chap_binaryhex_to_asciihex.constprop.5+0x50/0x50 [iscsi_target_mod]
    ? ftrace_caller_op_ptr+0xe/0xe
    ? __orc_find+0x6f/0xc0
    ? unwind_next_frame+0x231/0x850
    ? kthread+0x1a0/0x1c0
    ? ret_from_fork+0x35/0x40
    ? ret_from_fork+0x35/0x40
    ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
    ? deref_stack_reg+0xd0/0xd0
    ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
    ? is_module_text_address+0xa/0x11
    ? kernel_text_address+0x4c/0x110
    ? __save_stack_trace+0x82/0x100
    ? ret_from_fork+0x35/0x40
    ? save_stack+0x8c/0xb0
    ? 0xffffffffc1660000
    ? iscsi_target_do_login+0x155/0x8d0 [iscsi_target_mod]
    ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
    ? process_one_work+0x35c/0x640
    ? worker_thread+0x66/0x5d0
    ? kthread+0x1a0/0x1c0
    ? ret_from_fork+0x35/0x40
    ? iscsi_update_param_value+0x80/0x80 [iscsi_target_mod]
    ? iscsit_release_cmd+0x170/0x170 [iscsi_target_mod]
    chap_main_loop+0x172/0x570 [iscsi_target_mod]
    ? chap_server_compute_md5.isra.2+0x860/0x860 [iscsi_target_mod]
    ? rx_data+0xd6/0x120 [iscsi_target_mod]
    ? iscsit_print_session_params+0xd0/0xd0 [iscsi_target_mod]
    ? cyc2ns_read_begin.part.2+0x90/0x90
    ? _raw_spin_lock_irqsave+0x25/0x50
    ? memcmp+0x45/0x70
    iscsi_target_do_login+0x875/0x8d0 [iscsi_target_mod]
    ? iscsi_target_check_first_request.isra.5+0x1a0/0x1a0 [iscsi_target_mod]
    ? del_timer+0xe0/0xe0
    ? memset+0x1f/0x40
    ? flush_sigqueue+0x29/0xd0
    iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
    ? iscsi_target_nego_release+0x80/0x80 [iscsi_target_mod]
    ? iscsi_target_restore_sock_callbacks+0x130/0x130 [iscsi_target_mod]
    process_one_work+0x35c/0x640
    worker_thread+0x66/0x5d0
    ? flush_rcu_work+0x40/0x40
    kthread+0x1a0/0x1c0
    ? kthread_bind+0x30/0x30
    ret_from_fork+0x35/0x40

    The buggy address belongs to the page:
    page:ffffea0004243bc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
    flags: 0x17fffc000000000()
    raw: 017fffc000000000 0000000000000000 0000000000000000 00000000ffffffff
    raw: ffffea0004243c20 ffffea0004243ba0 0000000000000000 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff8801090ef680: f2 f2 f2 f2 f2 f2 f2 01 f2 f2 f2 f2 f2 f2 f2 00
    ffff8801090ef700: f2 f2 f2 f2 f2 f2 f2 00 02 f2 f2 f2 f2 f2 f2 00
    >ffff8801090ef780: 00 f2 f2 f2 f2 f2 f2 00 00 f2 f2 f2 f2 f2 f2 00
    ^
    ffff8801090ef800: 00 f2 f2 f2 f2 f2 f2 00 00 00 00 02 f2 f2 f2 f2
    ffff8801090ef880: f2 f2 f2 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00
    ==================================================================

    Signed-off-by: Vincent Pelletier
    Reviewed-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Vincent Pelletier
     

12 Sep, 2018

1 commit

  • Fedora got a bug report of a crash with iSCSI:

    kernel BUG at include/linux/scatterlist.h:143!
    ...
    RIP: 0010:iscsit_do_crypto_hash_buf+0x154/0x180 [iscsi_target_mod]
    ...
    Call Trace:
    ? iscsi_target_tx_thread+0x200/0x200 [iscsi_target_mod]
    iscsit_get_rx_pdu+0x4cd/0xa90 [iscsi_target_mod]
    ? native_sched_clock+0x3e/0xa0
    ? iscsi_target_tx_thread+0x200/0x200 [iscsi_target_mod]
    iscsi_target_rx_thread+0x81/0xf0 [iscsi_target_mod]
    kthread+0x120/0x140
    ? kthread_create_worker_on_cpu+0x70/0x70
    ret_from_fork+0x3a/0x50

    This is a BUG_ON for using a stack buffer with a scatterlist. There
    are two cases that trigger this bug. Switch to using a dynamically
    allocated buffer for one case and do not assign a NULL buffer in
    another case.

    Signed-off-by: Laura Abbott
    Reviewed-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Laura Abbott
     

30 Aug, 2018

2 commits

  • If iscsi_login_init_conn fails it can free conn_ops.
    __iscsi_target_login_thread will then call iscsi_target_login_sess_out
    which will also free it.

    This fixes the problem by organizing conn allocation/setup into parts that
    are needed through the life of the conn and parts that are only needed for
    the login. The free functions then release what was allocated in the alloc
    functions.

    With this patch we have:

    iscsit_alloc_conn/iscsit_free_conn - allocs/frees the conn we need for the
    entire life of the conn.

    iscsi_login_init_conn/iscsi_target_nego_release - allocs/frees the parts
    of the conn that are only needed during login.

    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Fixes a use-after-free reported by KASAN when later
    iscsi_target_login_sess_out gets called and it tries to access
    conn->sess->se_sess:

    Disabling lock debugging due to kernel taint
    iSCSI Login timeout on Network Portal [::]:3260
    iSCSI Login negotiation failed.
    ==================================================================
    BUG: KASAN: use-after-free in
    iscsi_target_login_sess_out.cold.12+0x58/0xff [iscsi_target_mod]
    Read of size 8 at addr ffff880109d070c8 by task iscsi_np/980

    CPU: 1 PID: 980 Comm: iscsi_np Tainted: G O
    4.17.8kasan.sess.connops+ #4
    Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB,
    BIOS 5.6.5 05/19/2014
    Call Trace:
    dump_stack+0x71/0xac
    print_address_description+0x65/0x22e
    ? iscsi_target_login_sess_out.cold.12+0x58/0xff [iscsi_target_mod]
    kasan_report.cold.6+0x241/0x2fd
    iscsi_target_login_sess_out.cold.12+0x58/0xff [iscsi_target_mod]
    iscsi_target_login_thread+0x1086/0x1710 [iscsi_target_mod]
    ? __sched_text_start+0x8/0x8
    ? iscsi_target_login_sess_out+0x250/0x250 [iscsi_target_mod]
    ? __kthread_parkme+0xcc/0x100
    ? parse_args.cold.14+0xd3/0xd3
    ? iscsi_target_login_sess_out+0x250/0x250 [iscsi_target_mod]
    kthread+0x1a0/0x1c0
    ? kthread_bind+0x30/0x30
    ret_from_fork+0x35/0x40

    Allocated by task 980:
    kasan_kmalloc+0xbf/0xe0
    kmem_cache_alloc_trace+0x112/0x210
    iscsi_target_login_thread+0x816/0x1710 [iscsi_target_mod]
    kthread+0x1a0/0x1c0
    ret_from_fork+0x35/0x40

    Freed by task 980:
    __kasan_slab_free+0x125/0x170
    kfree+0x90/0x1d0
    iscsi_target_login_thread+0x1577/0x1710 [iscsi_target_mod]
    kthread+0x1a0/0x1c0
    ret_from_fork+0x35/0x40

    The buggy address belongs to the object at ffff880109d06f00
    which belongs to the cache kmalloc-512 of size 512
    The buggy address is located 456 bytes inside of
    512-byte region [ffff880109d06f00, ffff880109d07100)
    The buggy address belongs to the page:
    page:ffffea0004274180 count:1 mapcount:0 mapping:0000000000000000
    index:0x0 compound_mapcount: 0
    flags: 0x17fffc000008100(slab|head)
    raw: 017fffc000008100 0000000000000000 0000000000000000 00000001000c000c
    raw: dead000000000100 dead000000000200 ffff88011b002e00 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff880109d06f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff880109d07000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff880109d07080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff880109d07100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    ffff880109d07180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

    Signed-off-by: Vincent Pelletier
    [rebased against idr/ida changes and to handle ret review comments from Matthew]
    Signed-off-by: Mike Christie
    Cc: Matthew Wilcox
    Reviewed-by: Matthew Wilcox
    Signed-off-by: Martin K. Petersen

    Vincent Pelletier
     

28 Aug, 2018

1 commit


27 Aug, 2018

1 commit

  • Pull IDA updates from Matthew Wilcox:
    "A better IDA API:

    id = ida_alloc(ida, GFP_xxx);
    ida_free(ida, id);

    rather than the cumbersome ida_simple_get(), ida_simple_remove().

    The new IDA API is similar to ida_simple_get() but better named. The
    internal restructuring of the IDA code removes the bitmap
    preallocation nonsense.

    I hope the net -200 lines of code is convincing"

    * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits)
    ida: Change ida_get_new_above to return the id
    ida: Remove old API
    test_ida: check_ida_destroy and check_ida_alloc
    test_ida: Convert check_ida_conv to new API
    test_ida: Move ida_check_max
    test_ida: Move ida_check_leaf
    idr-test: Convert ida_check_nomem to new API
    ida: Start new test_ida module
    target/iscsi: Allocate session IDs from an IDA
    iscsi target: fix session creation failure handling
    drm/vmwgfx: Convert to new IDA API
    dmaengine: Convert to new IDA API
    ppc: Convert vas ID allocation to new IDA API
    media: Convert entity ID allocation to new IDA API
    ppc: Convert mmu context allocation to new IDA API
    Convert net_namespace to new IDA API
    cb710: Convert to new IDA API
    rsxx: Convert to new IDA API
    osd: Convert to new IDA API
    sd: Convert to new IDA API
    ...

    Linus Torvalds
     

22 Aug, 2018

2 commits

  • Since the session is never looked up by ID, we can use the more
    space-efficient IDA instead of the IDR.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • The problem is that iscsi_login_zero_tsih_s1 sets conn->sess early in
    iscsi_login_set_conn_values. If the function fails later like when we
    alloc the idr it does kfree(sess) and leaves the conn->sess pointer set.
    iscsi_login_zero_tsih_s1 then returns -Exyz and we then call
    iscsi_target_login_sess_out and access the freed memory.

    This patch has iscsi_login_zero_tsih_s1 either completely setup the
    session or completely tear it down, so later in
    iscsi_target_login_sess_out we can just check for it being set to the
    connection.

    Cc: stable@vger.kernel.org
    Fixes: 0957627a9960 ("iscsi-target: Fix sess allocation leak in...")
    Signed-off-by: Mike Christie
    Acked-by: Martin K. Petersen
    Signed-off-by: Matthew Wilcox

    Mike Christie
     

16 Aug, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
    hisi_sas, smartpqi, megaraid_sas, arcmsr.

    In addition, with the continuing absence of Nic we have target updates
    for tcmu and target core (all with reviews and acks).

    The biggest observable change is going to be that we're (again) trying
    to switch to mulitqueue as the default (a user can still override the
    setting on the kernel command line).

    Other major core stuff is the removal of the remaining Microchannel
    drivers, an update of the internal timers and some reworks of
    completion and result handling"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (203 commits)
    scsi: core: use blk_mq_run_hw_queues in scsi_kick_queue
    scsi: ufs: remove unnecessary query(DM) UPIU trace
    scsi: qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()
    scsi: aacraid: Spelling fix in comment
    scsi: mpt3sas: Fix calltrace observed while running IO & reset
    scsi: aic94xx: fix an error code in aic94xx_init()
    scsi: st: remove redundant pointer STbuffer
    scsi: qla2xxx: Update driver version to 10.00.00.08-k
    scsi: qla2xxx: Migrate NVME N2N handling into state machine
    scsi: qla2xxx: Save frame payload size from ICB
    scsi: qla2xxx: Fix stalled relogin
    scsi: qla2xxx: Fix race between switch cmd completion and timeout
    scsi: qla2xxx: Fix Management Server NPort handle reservation logic
    scsi: qla2xxx: Flush mailbox commands on chip reset
    scsi: qla2xxx: Fix unintended Logout
    scsi: qla2xxx: Fix session state stuck in Get Port DB
    scsi: qla2xxx: Fix redundant fc_rport registration
    scsi: qla2xxx: Silent erroneous message
    scsi: qla2xxx: Prevent sysfs access when chip is down
    scsi: qla2xxx: Add longer window for chip reset
    ...

    Linus Torvalds
     

15 Aug, 2018

1 commit

  • Pull block updates from Jens Axboe:
    "First pull request for this merge window, there will also be a
    followup request with some stragglers.

    This pull request contains:

    - Fix for a thundering heard issue in the wbt block code (Anchal
    Agarwal)

    - A few NVMe pull requests:
    * Improved tracepoints (Keith)
    * Larger inline data support for RDMA (Steve Wise)
    * RDMA setup/teardown fixes (Sagi)
    * Effects log suppor for NVMe target (Chaitanya Kulkarni)
    * Buffered IO suppor for NVMe target (Chaitanya Kulkarni)
    * TP4004 (ANA) support (Christoph)
    * Various NVMe fixes

    - Block io-latency controller support. Much needed support for
    properly containing block devices. (Josef)

    - Series improving how we handle sense information on the stack
    (Kees)

    - Lightnvm fixes and updates/improvements (Mathias/Javier et al)

    - Zoned device support for null_blk (Matias)

    - AIX partition fixes (Mauricio Faria de Oliveira)

    - DIF checksum code made generic (Max Gurtovoy)

    - Add support for discard in iostats (Michael Callahan / Tejun)

    - Set of updates for BFQ (Paolo)

    - Removal of async write support for bsg (Christoph)

    - Bio page dirtying and clone fixups (Christoph)

    - Set of bcache fix/changes (via Coly)

    - Series improving blk-mq queue setup/teardown speed (Ming)

    - Series improving merging performance on blk-mq (Ming)

    - Lots of other fixes and cleanups from a slew of folks"

    * tag 'for-4.19/block-20180812' of git://git.kernel.dk/linux-block: (190 commits)
    blkcg: Make blkg_root_lookup() work for queues in bypass mode
    bcache: fix error setting writeback_rate through sysfs interface
    null_blk: add lock drop/acquire annotation
    Blk-throttle: reduce tail io latency when iops limit is enforced
    block: paride: pd: mark expected switch fall-throughs
    block: Ensure that a request queue is dissociated from the cgroup controller
    block: Introduce blk_exit_queue()
    blkcg: Introduce blkg_root_lookup()
    block: Remove two superfluous #include directives
    blk-mq: count the hctx as active before allocating tag
    block: bvec_nr_vecs() returns value for wrong slab
    bcache: trivial - remove tailing backslash in macro BTREE_FLAG
    bcache: make the pr_err statement used for ENOENT only in sysfs_attatch section
    bcache: set max writeback rate when I/O request is idle
    bcache: add code comments for bset.c
    bcache: fix mistaken comments in request.c
    bcache: fix mistaken code comments in bcache.h
    bcache: add a comment in super.c
    bcache: avoid unncessary cache prefetch bch_btree_node_get()
    bcache: display rate debug parameters to 0 when writeback is not running
    ...

    Linus Torvalds
     

07 Aug, 2018

1 commit

  • The target loopback driver is a low-level driver for the SCSI subsystem,
    and as such needs to depend on it.

    Fixes: 8a39a047 ("target: don't depend on SCSI")
    Signed-off-by: Christoph Hellwig
    Reported-by: Randy Dunlap
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

03 Aug, 2018

9 commits

  • The core target code only needs code from scsi_common.c, which is now
    separately selectable.

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

    Christoph Hellwig
     
  • This converts drivers that were only calling transport_deregister_session
    to use target_remove_session. The calling of
    transport_deregister_session_configfs via target_remove_session for these
    types of drivers is ok, because they were not exporting info from fields
    like sess_acl_list, sess->se_tpg and sess->fabric_sess_ptr from configfs
    accessible functions, so they will see no difference.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Felipe Balbi
    Cc: Sebastian Andrzej Siewior
    Cc: Andrzej Pietrasiewicz
    Cc: Michael S. Tsirkin
    Cc: Juergen Gross
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This converts tcm_fc to use target_remove_session

    tcm_fc was calling transport_deregister_session_configfs then calling
    transport_deregister_session when commands have completed. It should be ok
    for it to call transport_deregister_session_configfs later via
    target_remove_session because transport_deregister_session_configfs only
    prevents access from configfs via tpg removal and its call to the
    close_session callback for that driver, and this is already protected by
    the ft_lport_lock and its port lookup handling.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Johannes Thumshirn
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This converts the drivers that called transport_deregister_session_configfs
    and then immediately called transport_deregister_session to use
    target_remove_session.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Chris Boot
    Cc: Bryant G. Ly
    Cc: Michael Cyr
    Cc:
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This adds a function to remove a session which should be used by drivers
    that use target_setup_session. The next patches will convert the target
    drivers to use this new function.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Chris Boot
    Cc: Bryant G. Ly
    Cc: Michael Cyr
    Cc:
    Cc: Johannes Thumshirn
    Cc: Felipe Balbi
    Cc: Sebastian Andrzej Siewior
    Cc: Andrzej Pietrasiewicz
    Cc: Michael S. Tsirkin
    Cc: Juergen Gross
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Rename target_alloc_session to target_setup_session to avoid confusion with
    the other transport session allocation function that only allocates the
    session and because the target_alloc_session does so much more. It
    allocates the session, sets up the nacl and registers the session.

    The next patch will then add a remove function to match the setup in this
    one, so it should make sense for all drivers, except iscsi, to just call
    those 2 functions to setup and remove a session.

    iscsi will continue to be the odd driver.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Chris Boot
    Cc: Bryant G. Ly
    Cc: Michael Cyr
    Cc:
    Cc: Johannes Thumshirn
    Cc: Felipe Balbi
    Cc: Sebastian Andrzej Siewior
    Cc: Andrzej Pietrasiewicz
    Cc: Michael S. Tsirkin
    Cc: Juergen Gross
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • transport_init_session_tags is only called from target_core_transport.c so
    make it static.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Just have iscsit_start_nopin_timer grab the lock and call
    __iscsit_start_nopin_timer.

    Signed-off-by: Mike Christie
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • When __transport_register_session is called from transport_register_session
    irqs will already have been disabled, so we do not want the unlock irq call
    to enable them until the higher level has done the final
    spin_unlock_irqrestore/ spin_unlock_irq.

    This has __transport_register_session use the save/restore call.

    Signed-off-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Mike Christie
     

31 Jul, 2018

8 commits

  • The cxgbit driver expects that __iscsit_free_cmd() is called before the
    target core frees the command page list. Since this patch breaks the
    cxgbit driver, revert it.

    Reported-by: Varun Prakash
    Fixes: ed88f055788a ("scsi: target/iscsi: Reduce number of __iscsit_free_cmd() callers")
    Signed-off-by: Bart Van Assche
    Cc: Varun Prakash
    Cc: Mike Christie
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Reviewed-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • We use unsigned long, size_t and u64 for dev_size. This has us standardize
    on u64.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Instead of doing strdup and kstrto* just use match_int for dev params.

    It will be ok to use int instead of unsigned long in tcmu_set_dev_attrib
    because that is only being used for max sectors and block size and the
    supported values for them are well under the max possible integer value.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This patch prevents a bug where data_bitmap is allocated in
    tcmu_configure_device, userspace changes the max_blocks setting, the device
    is mapped to a LUN, then we try to access the data_bitmap based on the new
    max_blocks limit which may now be out of range.

    To prevent this, we just check if data_bitmap has been setup. If it has
    then we fail the max_blocks update operation.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • The tcmu dev is added to the list of tcmu devices during configuration. At
    this time the tcmu setup has completed, but lio core has not completed its
    setup. The device is not yet usable so do not try to unmap blocks from it

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Do not allow userspace to block or reset the ring until the device has been
    configured. This will prevent the bug where userspace can write to those
    files and access mb_addr before it has been setup.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Use the lio core helper to check if the device is configured.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This just adds a helper function to check if a device is configured and it
    converts the target users to use it. The next patch will add a backend
    module user so those types of modules do not have to know the lio core
    details.

    Signed-off-by: Mike Christie
    Reviewed-by: Xiubo Li
    Signed-off-by: Martin K. Petersen

    Mike Christie