Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936140AbaFJA3H (ORCPT ); Mon, 9 Jun 2014 20:29:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58620 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbaFJAWt (ORCPT ); Mon, 9 Jun 2014 20:22:49 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Rob Evers , Christoph Hellwig , Roland Dreier , Nicholas Bellinger , Ben Hutchings , Rui Xiang Subject: [PATCH 3.4 69/88] target: Fix MAINTENANCE_IN service action CDB checks to use lower 5 bits Date: Mon, 9 Jun 2014 17:25:19 -0700 Message-Id: <20140610002426.770392814@linuxfoundation.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <20140610002424.500996570@linuxfoundation.org> References: <20140610002424.500996570@linuxfoundation.org> User-Agent: quilt/0.63-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Bellinger commit ba539743b70cd160c84bab1c82910d0789b820f8 upstream. This patch fixes the MAINTENANCE_IN service action type checks to only look at the proper lower 5 bits of cdb byte 1. This addresses the case where MI_REPORT_TARGET_PGS w/ extended header using the upper three bits of cdb byte 1 was not processed correctly in transport_generic_cmd_sequencer, as well as the three cases for standby, unavailable, and transition ALUA primary access state checks. Also add MAINTENANCE_IN to the excluded list in transport_generic_prepare_cdb() to prevent the PARAMETER DATA FORMAT bits from being cleared. Cc: Hannes Reinecke Cc: Rob Evers Cc: Christoph Hellwig Cc: Roland Dreier Signed-off-by: Nicholas Bellinger Signed-off-by: Ben Hutchings Cc: Rui Xiang Signed-off-by: Greg Kroah-Hartman --- drivers/target/target_core_alua.c | 6 +++--- drivers/target/target_core_transport.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c @@ -394,7 +394,7 @@ static inline int core_alua_state_standb case SEND_DIAGNOSTIC: return 0; case MAINTENANCE_IN: - switch (cdb[1]) { + switch (cdb[1] & 0x1f) { case MI_REPORT_TARGET_PGS: return 0; default: @@ -437,7 +437,7 @@ static inline int core_alua_state_unavai case REPORT_LUNS: return 0; case MAINTENANCE_IN: - switch (cdb[1]) { + switch (cdb[1] & 0x1f) { case MI_REPORT_TARGET_PGS: return 0; default: @@ -478,7 +478,7 @@ static inline int core_alua_state_transi case REPORT_LUNS: return 0; case MAINTENANCE_IN: - switch (cdb[1]) { + switch (cdb[1] & 0x1f) { case MI_REPORT_TARGET_PGS: return 0; default: --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1458,6 +1458,7 @@ static inline void transport_generic_pre case VERIFY_16: /* SBC - VRProtect */ case WRITE_VERIFY: /* SBC - VRProtect */ case WRITE_VERIFY_12: /* SBC - VRProtect */ + case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ break; default: cdb[1] &= 0x1f; /* clear logical unit number */ @@ -2813,7 +2814,7 @@ static int transport_generic_cmd_sequenc /* * Check for emulated MI_REPORT_TARGET_PGS. */ - if (cdb[1] == MI_REPORT_TARGET_PGS && + if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { cmd->execute_task = target_emulate_report_target_port_groups; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/