1. 08 Nov, 2017 7 commits
    • Dan Carpenter's avatar
      tcmu: Fix some memory corruption · 16b93277
      Dan Carpenter authored
      "udev->nl_reply_supported" is an int but on 64 bit arches we are writing
      8 bytes of data to it so it corrupts four bytes beyond the end of the
      struct.
      
      Fixes: b849b456 ("target: Add netlink command reply supported option for each device")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      16b93277
    • Nicholas Bellinger's avatar
      iscsi-target: Fix non-immediate TMR reference leak · 3fc9fb13
      Nicholas Bellinger authored
      This patch fixes a se_cmd->cmd_kref reference leak that can
      occur when a non immediate TMR is proceeded our of command
      sequence number order, and CMDSN_LOWER_THAN_EXP is returned
      by iscsit_sequence_cmd().
      
      To address this bug, call target_put_sess_cmd() during this
      special case following what iscsit_process_scsi_cmd() does
      upon CMDSN_LOWER_THAN_EXP.
      
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3fc9fb13
    • Nicholas Bellinger's avatar
      iscsi-target: Make TASK_REASSIGN use proper se_cmd->cmd_kref · ae072726
      Nicholas Bellinger authored
      Since commit 59b6986d fixed a potential NULL pointer dereference
      by allocating a se_tmr_req for ISCSI_TM_FUNC_TASK_REASSIGN, the
      se_tmr_req is currently leaked by iscsit_free_cmd() because no
      iscsi_cmd->se_cmd.se_tfo was associated.
      
      To address this, treat ISCSI_TM_FUNC_TASK_REASSIGN like any other
      TMR and call transport_init_se_cmd() + target_get_sess_cmd() to
      setup iscsi_cmd->se_cmd.se_tfo with se_cmd->cmd_kref of 2.
      
      This will ensure normal release operation once se_cmd->cmd_kref
      reaches zero and target_release_cmd_kref() is invoked, se_tmr_req
      will be released via existing target_free_cmd_mem() and
      core_tmr_release_req() code.
      Reported-by: default avatarDonald White <dew@datera.io>
      Cc: Donald White <dew@datera.io>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      ae072726
    • Nicholas Bellinger's avatar
      target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK · 1c21a480
      Nicholas Bellinger authored
      This patch fixes bug where early se_cmd exceptions that occur
      before backend execution can result in use-after-free if/when
      a subsequent ABORT_TASK occurs for the same tag.
      
      Since an early se_cmd exception will have had se_cmd added to
      se_session->sess_cmd_list via target_get_sess_cmd(), it will
      not have CMD_T_COMPLETE set by the usual target_complete_cmd()
      backend completion path.
      
      This causes a subsequent ABORT_TASK + __target_check_io_state()
      to signal ABORT_TASK should proceed.  As core_tmr_abort_task()
      executes, it will bring the outstanding se_cmd->cmd_kref count
      down to zero releasing se_cmd, after se_cmd has already been
      queued with error status into fabric driver response path code.
      
      To address this bug, introduce a CMD_T_PRE_EXECUTE bit that is
      set at target_get_sess_cmd() time, and cleared immediately before
      backend driver dispatch in target_execute_cmd() once CMD_T_ACTIVE
      is set.
      
      Then, check CMD_T_PRE_EXECUTE within __target_check_io_state() to
      determine when an early exception has occured, and avoid aborting
      this se_cmd since it will have already been queued into fabric
      driver response path code.
      Reported-by: default avatarDonald White <dew@datera.io>
      Cc: Donald White <dew@datera.io>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: stable@vger.kernel.org # 3.14+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      1c21a480
    • Nicholas Bellinger's avatar
      target: Fix quiese during transport_write_pending_qf endless loop · 9574a497
      Nicholas Bellinger authored
      This patch fixes a potential end-less loop during QUEUE_FULL,
      where cmd->se_tfo->write_pending() callback fails repeatedly
      but __transport_wait_for_tasks() has already been invoked to
      quiese the outstanding se_cmd descriptor.
      
      To address this bug, this patch adds a CMD_T_STOP|CMD_T_ABORTED
      check within transport_write_pending_qf() and invokes the
      existing se_cmd->t_transport_stop_comp to signal quiese
      completion back to __transport_wait_for_tasks().
      
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
      Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
      Cc: Potnuri Bharat Teja <bharat@chelsio.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: stable@vger.kernel.org # 4.11+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      9574a497
    • Nicholas Bellinger's avatar
      target: Fix caw_sem leak in transport_generic_request_failure · fd2f928b
      Nicholas Bellinger authored
      With the recent addition of transport_check_aborted_status() within
      transport_generic_request_failure() to avoid sending a SCSI status
      exception after CMD_T_ABORTED w/ TAS=1 has occured, it introduced
      a COMPARE_AND_WRITE early failure regression.
      
      Namely when COMPARE_AND_WRITE fails and se_device->caw_sem has
      been taken by sbc_compare_and_write(), if the new check for
      transport_check_aborted_status() returns true and exits,
      cmd->transport_complete_callback() -> compare_and_write_post()
      is skipped never releasing se_device->caw_sem.
      
      This regression was originally introduced by:
      
        commit e3b88ee9
        Author: Bart Van Assche <bart.vanassche@sandisk.com>
        Date:   Tue Feb 14 16:25:45 2017 -0800
      
            target: Fix handling of aborted failed commands
      
      To address this bug, move the transport_check_aborted_status()
      call after transport_complete_task_attr() and
      cmd->transport_complete_callback().
      
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Bart Van Assche <bart.vanassche@sandisk.com>
      Cc: stable@vger.kernel.org # 4.11+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      fd2f928b
    • Nicholas Bellinger's avatar
      target: Fix QUEUE_FULL + SCSI task attribute handling · 1c79df1f
      Nicholas Bellinger authored
      This patch fixes a bug during QUEUE_FULL where transport_complete_qf()
      calls transport_complete_task_attr() after it's already been invoked
      by target_complete_ok_work() or transport_generic_request_failure()
      during initial completion, preceeding QUEUE_FULL.
      
      This will result in se_device->simple_cmds, se_device->dev_cur_ordered_id
      and/or se_device->dev_ordered_sync being updated multiple times for
      a single se_cmd.
      
      To address this bug, clear SCF_TASK_ATTR_SET after the first call
      to transport_complete_task_attr(), and avoid updating SCSI task
      attribute related counters for any subsequent calls.
      
      Also, when a se_cmd is deferred due to ordered tags and executed
      via target_restart_delayed_cmds(), set CMD_T_SENT before execution
      matching what target_execute_cmd() does.
      
      Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
      Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: stable@vger.kernel.org # 4.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      1c79df1f
  2. 04 Nov, 2017 27 commits
  3. 23 Oct, 2017 4 commits
    • Linus Torvalds's avatar
      Linux 4.14-rc6 · bb176f67
      Linus Torvalds authored
      bb176f67
    • Linus Torvalds's avatar
      Merge tag 'staging-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · dd9d064e
      Linus Torvalds authored
      Pull staging and IIO fixes from Greg KH:
       "Here are a small number of patches to resolve some reported IIO and a
        staging driver problem. Nothing major here, full details are in the
        shortlog below.
      
        All have been in linux-next with no reported issues"
      
      * tag 'staging-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: bcm2835-audio: Fix memory corruption
        iio: adc: at91-sama5d2_adc: fix probe error on missing trigger property
        iio: adc: dln2-adc: fix build error
        iio: dummy: events: Add missing break
        staging: iio: ade7759: fix signed extension bug on shift of a u8
        iio: pressure: zpa2326: Remove always-true check which confuses gcc
        iio: proximity: as3935: noise detection + threshold changes
      dd9d064e
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 17e7637f
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are four small fixes for 4.14-rc6.
      
        Three of them are binder driver fixes for reported issues, and the
        last one is a hyperv driver bugfix. Nothing major, but good fixes to
        get into 4.14-final.
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        android: binder: Fix null ptr dereference in debug msg
        android: binder: Don't get mm from task
        vmbus: hvsock: add proper sync for vmbus_hvsock_device_unregister()
        binder: call poll_wait() unconditionally.
      17e7637f
    • Linus Torvalds's avatar
      Merge tag 'usb-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 58059921
      Linus Torvalds authored
      Pull USB/PHY fixes from Greg KH:
       "Here are a small number of USB and PHY driver fixes for 4.14-rc6
      
        There is the usual musb and xhci fixes in here, as well as some needed
        phy patches. Also is a nasty regression fix for usbfs that has started
        to hit a lot of people using virtual machines.
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (26 commits)
        usb: hub: Allow reset retry for USB2 devices on connect bounce
        USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()
        MAINTAINERS: fix git tree url for musb module
        usb: quirks: add quirk for WORLDE MINI MIDI keyboard
        usb: musb: sunxi: Explicitly release USB PHY on exit
        usb: musb: Check for host-mode using is_host_active() on reset interrupt
        usb: musb: musb_cppi41: Configure the number of channels for DA8xx
        usb: musb: musb_cppi41: Fix cppi41_set_dma_mode() for DA8xx
        usb: musb: musb_cppi41: Fix the address of teardown and autoreq registers
        USB: musb: fix late external abort on suspend
        USB: musb: fix session-bit runtime-PM quirk
        usb: cdc_acm: Add quirk for Elatec TWN3
        USB: devio: Revert "USB: devio: Don't corrupt user memory"
        usb: xhci: Handle error condition in xhci_stop_device()
        usb: xhci: Reset halted endpoint if trb is noop
        xhci: Cleanup current_cmd in xhci_cleanup_command_queue()
        xhci: Identify USB 3.1 capable hosts by their port protocol capability
        USB: serial: metro-usb: add MS7820 device id
        phy: rockchip-typec: Check for errors from tcphy_phy_init()
        phy: rockchip-typec: Don't set the aux voltage swing to 400 mV
        ...
      58059921
  4. 22 Oct, 2017 2 commits