From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3230AC606BA for ; Mon, 8 Jul 2019 14:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 075DA21530 for ; Mon, 8 Jul 2019 14:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562594459; bh=dKFs8Ltv+5+60pBsVhTJ1iddmSakeBT4lUSaYP4ZEzo=; h=Subject:To:Cc:From:Date:List-ID:From; b=IOA3ucPI6Y+aqpe8tqsYgibVNGSKsSiwSFJiV/txxI0kbXgJrSTxIZgk+/IZU4UWC kLTlmu4NMXNNy9M1qftl9gozzUJkAab8p6e7wPEpyBZrgsXjp0vnGGTKTgV0dkpnlq lf9NojJh0LiYLDdSS0CNiZ3Q/8g1SZpL7AYX9Ykk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731494AbfGHOA6 (ORCPT ); Mon, 8 Jul 2019 10:00:58 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:39427 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727401AbfGHOA6 (ORCPT ); Mon, 8 Jul 2019 10:00:58 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 4323621F16; Mon, 8 Jul 2019 10:00:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 08 Jul 2019 10:00:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=MgKoKR GCmHDRY3Hfn3vZycyX+6ydFuCuR0URiaJDEAI=; b=UICKNRTuaATW4QlK1qKuKG S5N/OsF+SaiUqg0VTIn8JFA39/H78aD2b80uFYI4pVqYc1rrdhzdBQcNbIHMF+qD jh7vlO6HG5wsRYyfGfSfWCRWoJ8Ar+ceOwqkfXKL/BHLPife+1yCOKqnLZoI5XLu hAAxPCctdhFimwLIotQ+cnWJ5b/hvTyzUDeWEed1uFwd/Lf6aFtpEnDsNqIDrIho ClGhpmioRXG4PJjJXlGm8M6epPyLWho3CF9BDZxU3C+H3O/+2wHu1yCRyFRq+9nd KAGSLuJsMa70nAaiAndNjZaKo05uUuyNjeHvDPlxMq5efX1ZngiilQTve2o9LICA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedtgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedv X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 197C18006A; Mon, 8 Jul 2019 10:00:56 -0400 (EDT) Subject: FAILED: patch "[PATCH] scsi: target/iblock: Fix overrun in WRITE SAME emulation" failed to apply to 4.14-stable tree To: r.bolshakov@yadro.com, bvanassche@acm.org, martin.petersen@oracle.com, stable@vger.kernel.org Cc: From: Date: Mon, 08 Jul 2019 16:00:50 +0200 Message-ID: <156259445030138@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 5676234f20fef02f6ca9bd66c63a8860fce62645 Mon Sep 17 00:00:00 2001 From: Roman Bolshakov Date: Tue, 2 Jul 2019 22:16:38 +0300 Subject: [PATCH] scsi: target/iblock: Fix overrun in WRITE SAME emulation WRITE SAME corrupts data on the block device behind iblock if the command is emulated. The emulation code issues (M - 1) * N times more bios than requested, where M is the number of 512 blocks per real block size and N is the NUMBER OF LOGICAL BLOCKS specified in WRITE SAME command. So, for a device with 4k blocks, 7 * N more LBAs gets written after the requested range. The issue happens because the number of 512 byte sectors to be written is decreased one by one while the real bios are typically from 1 to 8 512 byte sectors per bio. Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Cc: Signed-off-by: Roman Bolshakov Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index b5ed9c377060..efebacd36101 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -515,7 +515,7 @@ iblock_execute_write_same(struct se_cmd *cmd) /* Always in 512 byte units for Linux/Block */ block_lba += sg->length >> SECTOR_SHIFT; - sectors -= 1; + sectors -= sg->length >> SECTOR_SHIFT; } iblock_submit_bios(&list);