aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2009-01-16 10:17:09 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-01-16 10:17:09 -0500
commit94be9a58d7e683ac3c1df1858a17f09ebade8da0 (patch)
tree2f346bb4d179caf1cf0f61012f35c8277504c55a /drivers/ata
parent5393f780277165f282a37ed82dd878159ec9dad5 (diff)
[libata] get-identity ioctl: Fix use of invalid memory pointer
for SAS drivers. Caught by Ke Wei (and team?) at Marvell. Also, move the ata_scsi_ioctl export to libata-scsi.c, as that seems to be the general trend. Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/ata/libata-scsi.c17
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 71218d76d75e..552ecae13434 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6638,7 +6638,6 @@ EXPORT_SYMBOL_GPL(ata_dev_pair);
6638EXPORT_SYMBOL_GPL(ata_port_disable); 6638EXPORT_SYMBOL_GPL(ata_port_disable);
6639EXPORT_SYMBOL_GPL(ata_ratelimit); 6639EXPORT_SYMBOL_GPL(ata_ratelimit);
6640EXPORT_SYMBOL_GPL(ata_wait_register); 6640EXPORT_SYMBOL_GPL(ata_wait_register);
6641EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
6642EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 6641EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
6643EXPORT_SYMBOL_GPL(ata_scsi_slave_config); 6642EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
6644EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy); 6643EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9e92107691f2..a1a6e6298c33 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -423,9 +423,9 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
423 * RETURNS: 423 * RETURNS:
424 * Zero on success, negative errno on error. 424 * Zero on success, negative errno on error.
425 */ 425 */
426static int ata_get_identity(struct scsi_device *sdev, void __user *arg) 426static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
427 void __user *arg)
427{ 428{
428 struct ata_port *ap = ata_shost_to_port(sdev->host);
429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev); 429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
430 u16 __user *dst = arg; 430 u16 __user *dst = arg;
431 char buf[40]; 431 char buf[40];
@@ -645,7 +645,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
645 return rc; 645 return rc;
646} 646}
647 647
648int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) 648int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
649 int cmd, void __user *arg)
649{ 650{
650 int val = -EINVAL, rc = -EINVAL; 651 int val = -EINVAL, rc = -EINVAL;
651 652
@@ -663,7 +664,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
663 return 0; 664 return 0;
664 665
665 case HDIO_GET_IDENTITY: 666 case HDIO_GET_IDENTITY:
666 return ata_get_identity(scsidev, arg); 667 return ata_get_identity(ap, scsidev, arg);
667 668
668 case HDIO_DRIVE_CMD: 669 case HDIO_DRIVE_CMD:
669 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 670 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
@@ -682,6 +683,14 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
682 683
683 return rc; 684 return rc;
684} 685}
686EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl);
687
688int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
689{
690 return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host),
691 scsidev, cmd, arg);
692}
693EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
685 694
686/** 695/**
687 * ata_scsi_qc_new - acquire new ata_queued_cmd reference 696 * ata_scsi_qc_new - acquire new ata_queued_cmd reference