From nobody Tue Nov 26 04:46:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1709563379; cv=none; d=zohomail.com; s=zohoarc; b=lp0g/QYp+R6HUF4wS7y1E6FY45AEDz2MhKWi2+3ETHKOYgmKlImZ9WzQS4vDySqhAVTzRQpQX5ToVOscZmrGYM7uOsM8d94LV5ysE4zeRhNDmR9PhRnRH/mZvy8KK9fj9jC050BlWsuE8FY2hJSkragabUzmKACHPnYFRjiVSRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709563379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gMWnFgy+jGeh21rdnVz9G6WnrlfoX9Gy9Ijx9mgMBUk=; b=H6ceb+BlJIpO+q0sMSMzoDrMv9qX34yAT1H/pS1+iJm1hGmhS1PE4M4DHYkt7zS4Ph5/E/+TOWXUsmaQLBZv4THqpoKgjZg//LEFVZfVq81tnBTKhyWlDtd6DDDiljEvBY47NHyLvaA40fBBEp/5Fy16T+qNWGZbsDo4xagbWS8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709563379197774.929280306867; Mon, 4 Mar 2024 06:42:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rh9WV-0005yV-8t; Mon, 04 Mar 2024 09:42:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rh9WS-0005xx-MJ for qemu-devel@nongnu.org; Mon, 04 Mar 2024 09:42:33 -0500 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rh9WN-0005w8-HJ for qemu-devel@nongnu.org; Mon, 04 Mar 2024 09:42:31 -0500 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c2a:3dc:0:640:1e66:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 0C3F460AB1; Mon, 4 Mar 2024 17:42:23 +0300 (MSK) Received: from davydov-max-nux.yandex-team.ru (unknown [2a02:6b8:b081:b709::1:23]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 3gfE183i2Sw0-f0EbGa5Q; Mon, 04 Mar 2024 17:42:22 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1709563342; bh=gMWnFgy+jGeh21rdnVz9G6WnrlfoX9Gy9Ijx9mgMBUk=; h=Message-Id:Date:Cc:Subject:To:From; b=iub5wRQBHoDQXBUVypRlhqIcus6IX59JtfF785bjriNABfCucZI0aKjrocTwLnnkx JjwoJCJ7OiLzApMwQamrWVFeAnkj7Yh7WHk5FPz5vtpGYnmFuVg5VAm81zBpm49/F1 BipG9+Mw6b4ABBN49On/+5sVTv4e3dVabtLsturQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: farosas@suse.de, peterx@redhat.com Subject: [PATCH] migration/ram: add additional check Date: Mon, 4 Mar 2024 17:42:03 +0300 Message-Id: <20240304144203.158477-1-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1709563380075100001 Content-Type: text/plain; charset="utf-8" If a migration stream is broken, the address and flag reading can return zero. Thus, an irrelevant flag error will be returned instead of EIO. It can be fixed by additional check after the reading. Signed-off-by: Maksim Davydov --- migration/ram.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 45a00b45ed..95d8b19c3b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3902,6 +3902,12 @@ static int ram_load_precopy(QEMUFile *f) i++; =20 addr =3D qemu_get_be64(f); + ret =3D qemu_file_get_error(f); + if (ret) { + error_report("Getting RAM address failed"); + break; + } + flags =3D addr & ~TARGET_PAGE_MASK; addr &=3D TARGET_PAGE_MASK; =20 --=20 2.34.1