Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6188635iob; Tue, 10 May 2022 12:21:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVE6N9Rb2nBjDNbVVogCi4K0lUQgRexBRV3h/AnfXNOikEsWGdqphJDgxUC6c3wBN/kP1L X-Received: by 2002:a05:6a00:1805:b0:50d:ee59:b579 with SMTP id y5-20020a056a00180500b0050dee59b579mr21796491pfa.70.1652210510882; Tue, 10 May 2022 12:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652210510; cv=none; d=google.com; s=arc-20160816; b=m4AW6hj7WFkse4uyIcsBnx7wRPHN9hjCC7Ah+6uZyUX+rC47V15eKWYIdbhjBm+Nh0 2pfwpZXbW7ciSGAClF+3R2Ii0RrGt7ldit3lb1Zz250QadsACEwm63XRzgoPZpwToKwz sDz3+BhuHbgAmH3hrtrQtMc5gTwbHV+5Yib76hMdCGSI2SE1Pnta/NRF05sU4fVXbXHt AFEwPSY2XPZrdoyBMKf03CZMk/kMDIJd7dsMbxoPHGaJUh5KfVFBYMpIXXF2RZ/GE2OA WKE+mZe8KJNZgsfRXunNi/AHxuFJQpLxHWYDFivOsornpTK4qk4l16Hc1cRqwYgkWiYB sfEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OXWFFOsjMspP9ASjl1/5068t6QataR8aaZe/YfnqhAY=; b=l4gutjHMJbiROIiMY+PBZef5Io4vQXFMJhPtNk3mUBro2gxkE7gVewMAmzoeRDwt+l ScYRryxCqvelvjJEJ1bnHjPCl3m89ftuB7x0XhTOvL6DySeGSkZZJcwknDzXnX5gBzkr M2+XbSvcn8fI6u84FtDFoUm1fCRIhhdU+kG0kJuFNLzavaanYtgZ5oTqdVjVSkKV8I+c zA/sXSKrSqkMizIqNmsaE/dFRQif+2eIPAZ08sldIW8Oy7dTWq8i12+EiamGJt+i26Zn zI4zSXnEkeqx9ll2YVM81TOFmUPBWcHltfwAJOJ5psoqQfTDIvDLLNwa3A3vYFIe7lyI FFVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LeJLp22H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170903234300b0015d02c4c78esi4774338plh.487.2022.05.10.12.21.34; Tue, 10 May 2022 12:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LeJLp22H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244596AbiEJNz7 (ORCPT + 99 others); Tue, 10 May 2022 09:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244891AbiEJNiK (ORCPT ); Tue, 10 May 2022 09:38:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617F272216; Tue, 10 May 2022 06:26:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB556B81DA2; Tue, 10 May 2022 13:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DA6DC385C2; Tue, 10 May 2022 13:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189193; bh=ZC2xq8mT32uAvdq52x5pVe1krkLHonF2/gxynch+b54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LeJLp22HOCzekF55mEPxb7fjFfMXGSUwAggzoOKTPeRmrORfPAWFxT2JerPl+IOjW nh6CmMYgp9DSyz9b3jkQygh+oAMk/mN+aEp64vZvOG1yMBv8Q43ss68AAjj9XNC5vr ZTNv1eoRRQ3lduv2tUtP1KOTwb+vvDA5skXXNqLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jan=20H=C3=B6ppner?= , Stefan Haberland , Jens Axboe Subject: [PATCH 5.10 25/70] s390/dasd: Fix read inconsistency for ESE DASD devices Date: Tue, 10 May 2022 15:07:44 +0200 Message-Id: <20220510130733.604849603@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Höppner commit b9c10f68e23c13f56685559a0d6fdaca9f838324 upstream. Read requests that return with NRF error are partially completed in dasd_eckd_ese_read(). The function keeps track of the amount of processed bytes and the driver will eventually return this information back to the block layer for further processing via __dasd_cleanup_cqr() when the request is in the final stage of processing (from the driver's perspective). For this, blk_update_request() is used which requires the number of bytes to complete the request. As per documentation the nr_bytes parameter is described as follows: "number of bytes to complete for @req". This was mistakenly interpreted as "number of bytes _left_ for @req" leading to new requests with incorrect data length. The consequence are inconsistent and completely wrong read requests as data from random memory areas are read back. Fix this by correctly specifying the amount of bytes that should be used to complete the request. Fixes: 5e6bdd37c552 ("s390/dasd: fix data corruption for thin provisioned devices") Cc: stable@vger.kernel.org # 5.3+ Signed-off-by: Jan Höppner Reviewed-by: Stefan Haberland Link: https://lore.kernel.org/r/20220505141733.1989450-5-sth@linux.ibm.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -2812,8 +2812,7 @@ static void __dasd_cleanup_cqr(struct da * complete a request partially. */ if (proc_bytes) { - blk_update_request(req, BLK_STS_OK, - blk_rq_bytes(req) - proc_bytes); + blk_update_request(req, BLK_STS_OK, proc_bytes); blk_mq_requeue_request(req, true); } else if (likely(!blk_should_fake_timeout(req->q))) { blk_mq_complete_request(req);