linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtip32xx: fix user_buffer check in exec_drive_command
@ 2012-09-12 19:06 David Milburn
  2012-09-12 20:23 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: David Milburn @ 2012-09-12 19:06 UTC (permalink / raw)
  To: axboe; +Cc: asamymuthupa, linux-kernel, thenzl

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>

Reported-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: David Milburn <dmilburn@redhat.com>
---
 drivers/block/mtip32xx/mtip32xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index a8fddeb..b24efe3 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -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,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtip32xx: fix user_buffer check in exec_drive_command
  2012-09-12 19:06 [PATCH] mtip32xx: fix user_buffer check in exec_drive_command David Milburn
@ 2012-09-12 20:23 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-09-12 20:23 UTC (permalink / raw)
  To: David Milburn; +Cc: asamymuthupa, linux-kernel, thenzl

On 2012-09-12 21:06, David Milburn wrote:
> 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>
> 
> Reported-by: Tomas Henzl <thenzl@redhat.com>
> Signed-off-by: David Milburn <dmilburn@redhat.com>
> ---
>  drivers/block/mtip32xx/mtip32xx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a8fddeb..b24efe3 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-12 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12 19:06 [PATCH] mtip32xx: fix user_buffer check in exec_drive_command David Milburn
2012-09-12 20:23 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).