Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixe…
Browse files Browse the repository at this point in the history
…s-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] bsg: fix oops on remove
  [SCSI] fusion: default MSI to disabled for SPI and FC controllers
  [SCSI] ipr: Fix HDIO_GET_IDENTITY oops for SATA devices
  [SCSI] mptspi: fix oops in mptspi_dv_renegotiate_work()
  [SCSI] erase invalid data returned by device
  • Loading branch information
torvalds committed Jul 12, 2008
2 parents 536abdb + 8df5fc0 commit de72aa4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
3 changes: 2 additions & 1 deletion block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,12 @@ static void bsg_kref_release_function(struct kref *kref)
{
struct bsg_class_device *bcd =
container_of(kref, struct bsg_class_device, ref);
struct device *parent = bcd->parent;

if (bcd->release)
bcd->release(bcd->parent);

put_device(bcd->parent);
put_device(parent);
}

static int bsg_put_device(struct bsg_device *bd)
Expand Down
11 changes: 8 additions & 3 deletions drivers/message/fusion/mptbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,9 +1686,14 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->bus_type = SAS;
}

if (ioc->bus_type == SAS && mpt_msi_enable == -1)
ioc->msi_enable = 1;
else
if (mpt_msi_enable == -1) {
/* Enable on SAS, disable on FC and SPI */
if (ioc->bus_type == SAS)
ioc->msi_enable = 1;
else
ioc->msi_enable = 0;
} else
/* follow flag: 0 - disable; 1 - enable */
ioc->msi_enable = mpt_msi_enable;

if (ioc->errata_flag_1064)
Expand Down
9 changes: 7 additions & 2 deletions drivers/message/fusion/mptspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,13 +1266,18 @@ mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd)
static int
mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
{
struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
int rc;

rc = mptscsih_ioc_reset(ioc, reset_phase);

if (reset_phase == MPT_IOC_POST_RESET)
/* only try to do a renegotiation if we're properly set up
* if we get an ioc fault on bringup, ioc->sh will be NULL */
if (reset_phase == MPT_IOC_POST_RESET &&
ioc->sh) {
struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);

mptspi_dv_renegotiate(hd);
}

return rc;
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/scsi/ipr.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/libata.h>
#include <linux/hdreg.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/processor.h>
Expand Down Expand Up @@ -4913,8 +4914,11 @@ static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
struct ipr_resource_entry *res;

res = (struct ipr_resource_entry *)sdev->hostdata;
if (res && ipr_is_gata(res))
if (res && ipr_is_gata(res)) {
if (cmd == HDIO_GET_IDENTITY)
return -ENOTTY;
return ata_scsi_ioctl(sdev, cmd, arg);
}

return -EINVAL;
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
*/
blk_execute_rq(req->q, NULL, req, 1);

/*
* Some devices (USB mass-storage in particular) may transfer
* garbage data together with a residue indicating that the data
* is invalid. Prevent the garbage from being misinterpreted
* and prevent security leaks by zeroing out the excess data.
*/
if (unlikely(req->data_len > 0 && req->data_len <= bufflen))
memset(buffer + (bufflen - req->data_len), 0, req->data_len);

ret = req->errors;
out:
blk_put_request(req);
Expand Down

0 comments on commit de72aa4

Please sign in to comment.