From nobody Mon Feb 9 07:55:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1592319130; cv=none; d=zohomail.com; s=zohoarc; b=XsE/XHVI+Yck0hV3l+lWn7cD5RmTkEnGepfA+9pMBTRTEzBc35bGsJsFLbfqzi1RJPQumrMNuAUnqU8lMTtT+hbCGPUp/z0WN9azEyYaO9f/HTrdDL1SocXXg+5YgJ/dKoHwg9rnOBdm9TxffVpsmoYTeW5yyjGN+ZNO+YqFgq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592319130; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=7NX1GvgPv5viUDZxWAQeYn9X/XeNXTZT8tdkMO5SGPc=; b=O+iC3LmbEtZoxSRpl6VV2u3xjFiiR9N/wzPRMiZ/LJFoRBkAR5tGxRqWDArtOVyqaqM8qQy2eKOfPshR0QrRFGrJwt0tHEcJ/riQUEfnkqutvQ0C7xrbEA/s92J8b+mwi7kKMPivYxxI1hZ7y9K9bboR0HshfaQpyFTWvw3uwoY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592319130395784.803190330467; Tue, 16 Jun 2020 07:52:10 -0700 (PDT) Received: from localhost ([::1]:49962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlCwb-0005mF-Eq for importer@patchew.org; Tue, 16 Jun 2020 10:52:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlCQb-0003So-9z; Tue, 16 Jun 2020 10:19:05 -0400 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:44576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlCQX-0006xQ-Tp; Tue, 16 Jun 2020 10:19:03 -0400 Received: by mail-ot1-x343.google.com with SMTP id e5so16019021ote.11; Tue, 16 Jun 2020 07:19:01 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id g12sm2279151oos.8.2020.06.16.07.18.57 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jun 2020 07:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7NX1GvgPv5viUDZxWAQeYn9X/XeNXTZT8tdkMO5SGPc=; b=CGY7cca/2PrVPS+sI43RhOwOOKw/sBd/P2CuHE7+f/TA5es63A2YCbrwXdgjdZpktf FwlOT0lpxm/oiMDZ2oAODHpv/qRIzvpLuzdDatC47C5SmW5/GEbpkl/da9v920D++WGR PoSN9xPX0QKNGxkLPV9cFu+N16i36Vs15gOTF99RY1i2eob6rUWlslpPDEQ1SfWuytc+ VIzmNnr+fsTKE88vbQFkyNzOLi2/XtOISxlYXi9oBouAW8C53UYbjb+Wp4yqhbJWCGpG FIlTAEpQHLtiSFJxlbRsfbmmwSraYss3NJ/d7hdkKI2At8aMZrEh2gUT1yzkKRGeI91u pGrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7NX1GvgPv5viUDZxWAQeYn9X/XeNXTZT8tdkMO5SGPc=; b=OB1Zsbrx4lj4ChT12ivGvtE1KlY6giWG0YVBn7J9Y1tY/9Set1DuipN4IwakrZdxbS sGeh4bXDZAUJ6NYGJXHbHHXGSUyV0iO6CpiGjTc9CorxtI8ze6pz7SlpaZtkrReJ7IJl f3MDwj3zl2u6EG9h/c/1pGUpMc1R6hXBVXnGB68bLE5He2zx+P2IS+HCQi2q9YMnIy+j PLbTJVqW6h5mQRY8da4n5AU00W3yuG3DduWar9CxKRgqFu6t2cS/Qb8Rb91Ohs4lPvhK Wm1NS5axgrn8kRTJ6objB8jAPQGfxejpPN619e9kf46Sbb8KT4Xp7r7x6/B588r6sNK6 XfZA== X-Gm-Message-State: AOAM531GLzXVZA9fHcIhynPcHMyGvPGq84SG4JlNEc/BKN/5C7IXy9NB 0L21V1y681JL/kYrLZIJBuJ/xA53 X-Google-Smtp-Source: ABdhPJwS0A9w/iI4Ew+unRosDIyT/cBEWP9xRjnSJveQVBD9MYkW089eYNQViNjtTRPs0TH3NbLv0A== X-Received: by 2002:a9d:969:: with SMTP id 96mr2515397otp.319.1592317140012; Tue, 16 Jun 2020 07:19:00 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Subject: [PATCH 56/78] block/io: fix bdrv_co_do_copy_on_readv Date: Tue, 16 Jun 2020 09:15:25 -0500 Message-Id: <20200616141547.24664-57-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616141547.24664-1-mdroth@linux.vnet.ibm.com> References: <20200616141547.24664-1-mdroth@linux.vnet.ibm.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::343; envelope-from=flukshun@gmail.com; helo=mail-ot1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Prior to 1143ec5ebf4 it was OK to qemu_iovec_from_buf() from aligned-up buffer to original qiov, as qemu_iovec_from_buf() will stop at qiov end anyway. But after 1143ec5ebf4 we assume that bdrv_co_do_copy_on_readv works on part of original qiov, defined by qiov_offset and bytes. So we must not touch qiov behind qiov_offset+bytes bound. Fix it. Cc: qemu-stable@nongnu.org # v4.2 Fixes: 1143ec5ebf4 Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Message-id: 20200312081949.5350-1-vsementsov@virtuozzo.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit 4ab78b19189a81038e744728ed949d09aa477550) Signed-off-by: Michael Roth --- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index f75777f5ea..949932d6cc 100644 --- a/block/io.c +++ b/block/io.c @@ -1395,7 +1395,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(Bdrv= Child *child, if (!(flags & BDRV_REQ_PREFETCH)) { qemu_iovec_from_buf(qiov, qiov_offset + progress, bounce_buffer + skip_bytes, - pnum - skip_bytes); + MIN(pnum - skip_bytes, bytes - progres= s)); } } else if (!(flags & BDRV_REQ_PREFETCH)) { /* Read directly into the destination */ --=20 2.17.1