From patchwork Thu May 11 05:47:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 9720977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5F0A560364 for ; Thu, 11 May 2017 05:47:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E43C2865B for ; Thu, 11 May 2017 05:47:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40B9228663; Thu, 11 May 2017 05:47:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4F942865B for ; Thu, 11 May 2017 05:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263AbdEKFrh (ORCPT ); Thu, 11 May 2017 01:47:37 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:58395 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdEKFrh (ORCPT ); Thu, 11 May 2017 01:47:37 -0400 Received: from [192.168.1.66] (75-37-194-224.lightspeed.lsatca.sbcglobal.net [75.37.194.224]) (using SSLv3 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nab) by linux-iscsi.org (Postfix) with ESMTPSA id 1EFDD40B0D; Thu, 11 May 2017 05:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1494481773; bh=IO988wyQ/vnyzS7GvYAJSVPCoikX++7 v40tmok3dCbg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Mime-Version:Content-Transfer-Encoding; b=nggvtl/o/oYu7kTJTk1Y1/ugs3kTbW6cOKYGzC0zH31huBqa2ac/EmpCAHDfIcfAu wb7WUMXy03htQ8WArLenXrbZZUppSxi5tiKhlVZnYRanNPLuQgQKmGMki3VLkrCm1k9 j593bwJInPv8SbYPiuX/MBSEF/In2MsKOm+prjY= Message-ID: <1494481655.16894.148.camel@haakon3.risingtidesystems.com> Subject: Re: [PATCH v2 0/6] SCSI target patches for kernel v4.12 From: "Nicholas A. Bellinger" To: Bart Van Assche Cc: target-devel@vger.kernel.org Date: Wed, 10 May 2017 22:47:35 -0700 In-Reply-To: <20170510203736.12462-1-bart.vanassche@sandisk.com> References: <20170510203736.12462-1-bart.vanassche@sandisk.com> X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 2017-05-10 at 13:37 -0700, Bart Van Assche wrote: > Hello Nic, > > As you requested I have rebased this patch series on top of the for-next > branch of your target-pending git repository and I have left out those > patches that are not bug fixes. Please consider these patches for kernel > v4.12. No, I'm not going to merge a bunch of changes at the last minute to avoid a regression for something your patch exposed in for-next. If you're able to trigger a issue outside of WRITE_VERIFY with iscsi-target for target-pending/for-next, then we should make a change to Roland's commit c72c525022 in >= v4.3.y to do the following. Otherwise if you want to actually support WRITE overflow, you're more than welcome to pursue that for v4.13-rc1, but I'm not going to make a merge a bunch of changes at the last minute of a merge window. --- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 37f5735..b20acc8 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1165,10 +1165,16 @@ int transport_dump_vpd_ident( " 0x%02x\n", cmd->se_tfo->get_fabric_name(), cmd->data_length, size, cmd->t_task_cdb[0]); - if (cmd->data_direction == DMA_TO_DEVICE && - cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { - pr_err("Rejecting underflow/overflow WRITE data\n"); + if (cmd->data_direction == DMA_TO_DEVICE) { + + if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { + pr_err("Rejecting underflow/overflow WRITE SCSI_DATA_CDB\n"); + return TCM_INVALID_CDB_FIELD; + } + if (size > cmd->data_length) { + pr_err("Rejecting overflow for WRITE CDB\n"); return TCM_INVALID_CDB_FIELD; + } } /* * Reject READ_* or WRITE_* with overflow/underflow for