From nobody Sun Nov 24 03:31:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727878034122393.43206522750665; Wed, 2 Oct 2024 07:07:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EA020C67; Wed, 2 Oct 2024 10:07:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 10D9CBE0; Wed, 2 Oct 2024 10:06:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1F3F5A09; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from forwardcorp1d.mail.yandex.net (forwardcorp1d.mail.yandex.net [178.154.239.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5BE92B44 for ; Wed, 2 Oct 2024 10:06:50 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id B971F60A08; Wed, 2 Oct 2024 17:06:48 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-Cn6zHsDZ; Wed, 02 Oct 2024 17:06:48 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878008; bh=yLJaDyEAelrXRgY1Ri4RSUibfQW2G7z/Oefqj6dQnvE=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=W+y8xb/7CcVraTiM1V+fhW6+2SRXra+taN7PjOznOOpnbH6K6y8LBuRaOFF3DW8xz 4p/O0PpE1pDamEPbfQmt0DzgUA461zaLcU514SBQldrUskxmtyKiSUCEGYEQ79W22F Y/q53Gwm1vk7kks0j/o6GxjgixnkdEwv+SpJnVpA= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 2/7] blockjob: block_job_change_locked(): check job type Date: Wed, 2 Oct 2024 17:06:11 +0300 Message-Id: <20241002140616.561652-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PM3ABDAH24E7INCEE7VIFHVJX6CNZ6NL X-Message-ID-Hash: PM3ABDAH24E7INCEE7VIFHVJX6CNZ6NL X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878035505116600 Content-Type: text/plain; charset="utf-8" User may specify wrong type for the job id. Let's check it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- blockjob.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blockjob.c b/blockjob.c index 8cfbb15543..788cb1e07d 100644 --- a/blockjob.c +++ b/blockjob.c @@ -319,6 +319,12 @@ void block_job_change_locked(BlockJob *job, JobChangeO= ptions *opts, =20 GLOBAL_STATE_CODE(); =20 + if (job_type(&job->job) !=3D opts->type) { + error_setg(errp, "Job '%s' is '%s' job, not '%s'", job->job.id, + job_type_str(&job->job), JobType_str(opts->type)); + return; + } + if (job_apply_verb_locked(&job->job, JOB_VERB_CHANGE, errp)) { return; } --=20 2.34.1