Skip to contentSkip to conversation

mtip32xx: fix user_buffer check in exec_drive_command

PATCH In review David Milburn 2 participants 2 messages Sep 12, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtip32xx: fix user_buffer check in exec_drive_command

Current user_buffer check is incorrect and causes hdparm to fail

# hdparm -I /dev/rssda
 HDIO_DRIVE_CMD(identify) failed: Input/output error

/dev/rssda:

Patching linux-3.6-rc5 hdparm works as expected

# hdparm -I /dev/rssda
/dev/rssda:

ATA device, with non-removable media

	Model Number:       DELL_P320h-MTFDGAL350SAH                
	Serial Number:      00000000121302025F01
	Firmware Revision:  B1442808

<snip>

---
 drivers/block/mtip32xx/mtip32xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +1 -1
index a8fddeb..b24efe3 100644
@@ -1900,7 +1900,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command,
 	int rv = 0, xfer_sz = command[3];
 
 	if (xfer_sz) {
-		if (user_buffer)
+		if (!user_buffer)
 			return -EFAULT;
 
 		buf = dmam_alloc_coherent(&port->dd->pdev->dev,
maintainer
#1 lore raw
Quoted 29 lines · David Milburn

Current user_buffer check is incorrect and causes hdparm to fail

# hdparm -I /dev/rssda
 HDIO_DRIVE_CMD(identify) failed: Input/output error

/dev/rssda:

Patching linux-3.6-rc5 hdparm works as expected

# hdparm -I /dev/rssda
/dev/rssda:

ATA device, with non-removable media

	Model Number:       DELL_P320h-MTFDGAL350SAH                
	Serial Number:      00000000121302025F01
	Firmware Revision:  B1442808

<snip>

---
 drivers/block/mtip32xx/mtip32xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +0 -0
index a8fddeb..b24efe3 100644

drivers/block/mtip32xx/mtip32xx.c static int exec_drive_command(struct mtip_port *port, u8 *command, · line 1906

Quoted 8 lines
drivers/block/mtip32xx/mtip32xx.c +1 -1
@@ -1900,7 +1900,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command,
 	int rv = 0, xfer_sz = command[3];
 
 	if (xfer_sz) {
-		if (user_buffer)
+		if (!user_buffer)
 			return -EFAULT;
 
 		buf = dmam_alloc_coherent(&port->dd->pdev->dev,

Thanks, that's clearly a bug. Applied.

Signature · 1 line
Jens Axboe