1. 30 Oct, 2015 37 commits
  2. 27 Oct, 2015 3 commits
    • Alan Stern's avatar
      SCSI: fix bug in scsi_dev_info_list matching · b704f70c
      Alan Stern authored
      The "compatible" matching algorithm used for looking up old-style
      blacklist entries in a scsi_dev_info_list is buggy.  The core of the
      algorithm looks like this:
      
      		if (memcmp(devinfo->vendor, vendor,
      			    min(max, strlen(devinfo->vendor))))
      			/* not a match */
      
      where max is the length of the device's vendor string after leading
      spaces have been removed but trailing spaces have not.  Because of the
      min() computation, either entry could be a proper substring of the
      other and the code would still think that they match.
      
      In the case originally reported, the device's vendor and product
      strings were "Inateck " and "                ".  These matched against
      the following entry in the global device list:
      
      	{"", "Scanner", "1.80", BLIST_NOLUN}
      
      because "" is a substring of "Inateck " and "" (the result of removing
      leading spaces from the device's product string) is a substring of
      "Scanner".  The mistaken match prevented the system from scanning and
      finding the device's second Logical Unit.
      
      This patch fixes the problem by making two changes.  First, the code
      for leading-space removal is hoisted out of the loop.  (This means it
      will sometimes run unnecessarily, but since a large percentage of all
      lookups involve the "compatible" entries in global device list, this
      should be an overall improvement.)  Second and more importantly, the
      patch removes trailing spaces and adds a check to verify that the two
      resulting strings are exactly the same length.  This prevents matches
      where one entry is a proper substring of the other.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarGiulio Bernardi <ugilio@gmail.com>
      Tested-by: default avatarGiulio Bernardi <ugilio@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      b704f70c
    • Alan Stern's avatar
      SCSI: refactor device-matching code in scsi_devinfo.c · c42b3654
      Alan Stern authored
      In drivers/scsi/scsi_devinfo.c, the scsi_dev_info_list_del_keyed() and
      scsi_get_device_flags_keyed() routines contain a large amount of
      duplicate code for finding vendor/product matches in a
      scsi_dev_info_list.  This patch factors out the duplicate code and
      puts it in a separate function, scsi_dev_info_list_find().
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Suggested-by: default avatarGiulio Bernardi <ugilio@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      c42b3654
    • Maurizio Lombardi's avatar
      fnic: check pci_map_single() return value · fd6ddfa4
      Maurizio Lombardi authored
      the kernel prints some warnings when compiled with CONFIG_DMA_API_DEBUG.
      This is because the fnic driver doesn't check the return value of
      pci_map_single().
      
      [   11.942770] scsi host12: fnic
      [   11.950811] ------------[ cut here ]------------
      [   11.950818] WARNING: at lib/dma-debug.c:937 check_unmap+0x47b/0x920()
      [   11.950821] fnic 0000:0c:00.0: DMA-API: device driver failed to check map error[device address=0x0000002020a30040] [size=44 bytes] [mapped as single]
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed By: Tomas Henzl <thenzl@redhat.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
      fd6ddfa4