From patchwork Fri Mar 29 17:12:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 232466 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A4ED22C00AF for ; Sat, 30 Mar 2013 04:18:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755015Ab3C2RSx (ORCPT ); Fri, 29 Mar 2013 13:18:53 -0400 Received: from mail-we0-f201.google.com ([74.125.82.201]:63673 "EHLO mail-we0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754807Ab3C2RSx (ORCPT ); Fri, 29 Mar 2013 13:18:53 -0400 Received: by mail-we0-f201.google.com with SMTP id d46so48326wer.2 for ; Fri, 29 Mar 2013 10:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=rgTj7P6oioDMBdbUyfSBjJLBorYxzDU799eNSv4Qzb8=; b=IEvwa3m6swU5s1RidH4M8XZ6CRgV0P/Ozr87FHAqCKWwMh0FgxAtmYNjy6jnpCEp4H 1M4acyuld6mL24Orh5//X5eDaEajXsE1LS91wHQqGS1RfiSk8AJtLnwHkgsZBf0R71Ru Cjnv1ZyRfOfhq/HwEhAAMvCTutDtb05c9lI2FRta59X5r5XmbQIzocaTsmVLJE4UlZ6T OfnOGeeYgZpyoaBRcx4QccL2jgQlpVe9a9/Os6W52y4iPn4x7Q/fvp6I5+fNLlDVKble t5lfROSnXy889OJL5oqfpanSH6bXeJVN35ASelhAPeJcy/WOivI5p7bILz8GnxkHDuPF wyIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=rgTj7P6oioDMBdbUyfSBjJLBorYxzDU799eNSv4Qzb8=; b=GYTk5azXeg6YYD8vdXBzOaSvzNMc3hfS0G7tYT2QH3UN0peWTWIeXTn8n7zoxIeBDx ffEFcYSX6H4TbRTDfSiU2LVQu0Jqo1kb2h6sEoVRaPsUCDQcK+mbFkZGxKIg5+D6/qWl AOIyyBcjnZ09eVU8F1me2W1MsCzyQYVUZfywThokELRgBW2RMFNboCoy60do78fiIbih T0lOLCvGsKXW6J4gZlK3pFFfhQH2q8vYucsMQdcnxuNL6QtM59QL6m0OLDYyD3v1vumP 2j53lBDdc0SGnJtoCV2VdzME8k8r2ZtEtMRMZkzI1O42a2HLoe0jD1CtX8z1txBQp+Fl pFEg== X-Received: by 10.14.215.69 with SMTP id d45mr4765709eep.6.1364577168738; Fri, 29 Mar 2013 10:12:48 -0700 (PDT) Received: from corp2gmr1-2.eem.corp.google.com (corp2gmr1-2.eem.corp.google.com [172.25.138.117]) by gmr-mx.google.com with ESMTPS id 47si857027eeh.1.2013.03.29.10.12.48 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Fri, 29 Mar 2013 10:12:48 -0700 (PDT) Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.124.97]) by corp2gmr1-2.eem.corp.google.com (Postfix) with ESMTP id 7DD381E41F3; Fri, 29 Mar 2013 10:12:48 -0700 (PDT) Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id C0D9B204E4; Fri, 29 Mar 2013 10:12:47 -0700 (PDT) From: Gwendal Grignou To: ronald645@gmail.com Cc: krzysiek@podlesie.net, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Gwendal Grignou Subject: [PATCH v2] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check Date: Fri, 29 Mar 2013 10:12:46 -0700 Message-Id: <1364577166-17930-1-git-send-email-gwendal@google.com> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1364576992-17598-1-git-send-email-gwendal@google.com> References: <1364576992-17598-1-git-send-email-gwendal@google.com> X-Gm-Message-State: ALoCoQlczRmk6nbEn3NVn349YCd2YctSkSdmVBYqx/BJqQtj3JsyXFEXMQ1S35TPbBVVgRU5GOwy7C48lsAOe+bmiqhfq8kKqZqUcktdvYVB9/9KLwvQNynzKXZYomKzLk4INh9rnHOHNMFEEtMPi4c0U1YX5edtKPA/zuASkIqNy8OZRquxHhtr7u2Yzrn8v9klpqasovq052BzVxonV87/C8nf/ZImAQ== Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly. Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO. Signed-off-by: Gwendal Grignou --- drivers/ata/libata-scsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 318b413..5eae74b 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -532,8 +532,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) struct scsi_sense_hdr sshdr; scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sshdr); - if (sshdr.sense_key == 0 && - sshdr.asc == 0 && sshdr.ascq == 0) + if (sshdr.sense_key == RECOVERED_ERROR && + sshdr.asc == 0 && sshdr.ascq == 0x1D) cmd_result &= ~SAM_STAT_CHECK_CONDITION; } @@ -618,8 +618,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) struct scsi_sense_hdr sshdr; scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sshdr); - if (sshdr.sense_key == 0 && - sshdr.asc == 0 && sshdr.ascq == 0) + if (sshdr.sense_key == RECOVERED_ERROR && + sshdr.asc == 0 && sshdr.ascq == 0x1D) cmd_result &= ~SAM_STAT_CHECK_CONDITION; }