SCSI fixes on 20160304

Two fairly simple fixes.  One is a regression with ipr firmware
 loading caused by one of the trivial patches in the last merge window
 which failed to strip the \n from the file name string, so now the
 firmware loader no longer works leading to a lot of unhappy ipr users;
 fix by stripping the \n.  The second is a memory leak within SCSI: the
 BLK_PREP_INVALID state was introduced a recent fix but we forgot to
 account for it correctly when freeing state, resulting in memory
 leakage.  Add the correct state freeing in scsi_prep_return().
 
 Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABAgAGBQJW2hlQAAoJEDeqqVYsXL0McMQIALFgkpEzXrk4Jmrls1bNH4pM
 6+lMCRFHt97g5PXWg+C4icmH3cHi70Nu3qllbkDcvMUzBdlTN5lQIXIsunOHNf1B
 Tt9ZxwknCJMRFHr2PVdjILrF+fpsEoHBgFykpy8mvgS4A0Cj1I9qALYSID42hyIL
 Y8JP9Hq7oHG8Dsndttpa7nkq4HoD1X7q2YcX5fJ+I+h06bs7bL+lEszS6UjRIbgX
 +WFgDAbczpz4HgB/ZWSlgEw5Dn06boRAZQaIoYkXTtUlLgqx825WOPhyaTWMKrXe
 QuE7sPgf5wRvuq+gSnzRX/ieKMgB0zr3kpO6ZPMwXMVccBfDF+ZHj9w/wl5ULpk=
 =gJYE
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two fairly simple fixes.

  One is a regression with ipr firmware loading caused by one of the
  trivial patches in the last merge window which failed to strip the \n
  from the file name string, so now the firmware loader no longer works
  leading to a lot of unhappy ipr users; fix by stripping the \n.

  The second is a memory leak within SCSI: the BLK_PREP_INVALID state
  was introduced a recent fix but we forgot to account for it correctly
  when freeing state, resulting in memory leakage.  Add the correct
  state freeing in scsi_prep_return()"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  ipr: Fix regression when loading firmware
  SCSI: Free resources when we return BLKPREP_INVALID
This commit is contained in:
Linus Torvalds 2016-03-04 18:41:40 -08:00
commit c12f83c309
2 changed files with 6 additions and 0 deletions

View file

@ -4002,6 +4002,7 @@ static ssize_t ipr_store_update_fw(struct device *dev,
struct ipr_sglist *sglist;
char fname[100];
char *src;
char *endline;
int result, dnld_size;
if (!capable(CAP_SYS_ADMIN))
@ -4009,6 +4010,10 @@ static ssize_t ipr_store_update_fw(struct device *dev,
snprintf(fname, sizeof(fname), "%s", buf);
endline = strchr(fname, '\n');
if (endline)
*endline = '\0';
if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);
return -EIO;

View file

@ -1344,6 +1344,7 @@ scsi_prep_return(struct request_queue *q, struct request *req, int ret)
switch (ret) {
case BLKPREP_KILL:
case BLKPREP_INVALID:
req->errors = DID_NO_CONNECT << 16;
/* release the command and kill it */
if (req->special) {