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 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43E5ECA0FED for ; Wed, 27 Aug 2025 16:09:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urIhn-0005sh-LE; Wed, 27 Aug 2025 12:08:59 -0400 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 1urIhl-0005rm-2Y for qemu-devel@nongnu.org; Wed, 27 Aug 2025 12:08:57 -0400 Received: from na1pdmzitismtp01.corp.cloud.com ([160.101.131.8] helo=na1pdmzitismtp01.tibco.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urIhj-0007v6-BO for qemu-devel@nongnu.org; Wed, 27 Aug 2025 12:08:56 -0400 Received: from mewpvdipd1010.corp.cloud.com (unknown [10.113.40.46]) by na1pdmzitismtp01.tibco.com (Postfix) with ESMTP id 5B60C40D6683; Wed, 27 Aug 2025 12:08:14 -0400 (EDT) To: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, Mark Syms Subject: [PATCH] [xen-block] Return BLKIF_RSP_EOPNOTSUPP for unknown operation Date: Wed, 27 Aug 2025 17:08:41 +0100 Message-ID: <20250827160841.351707-1-mark.syms@cloud.com> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=160.101.131.8; envelope-from=mark.syms@cloud.com; helo=na1pdmzitismtp01.tibco.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Reply-to: Mark Syms From: Mark Syms via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Returning BLKIF_RSP_ERROR if an operation is not supoprted does not allow the frontend to exercise any discretion on how to handle the response and may lead to an operating system crash. As different backends may support different feature sets and we might, during a migration, switch backends, an in-flight request might be issued (or reissued) which is then not supported by this backend. Signed-off-by: Mark Syms --- hw/block/dataplane/xen-block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index 48c2e315f3..32cf919a97 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -167,7 +167,8 @@ static int xen_block_parse_request(XenBlockRequest *request) return 0; default: error_report("error: unknown operation (%d)", request->req.operation); - goto err; + request->status = BLKIF_RSP_EOPNOTSUPP; + return -1; }; if (request->req.operation != BLKIF_OP_READ && -- 2.50.1 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 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37C48CA0FED for ; Wed, 27 Aug 2025 16:09:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1096486.1451178 (Exim 4.92) (envelope-from ) id 1urIhk-0007zL-Uu; Wed, 27 Aug 2025 16:08:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1096486.1451178; Wed, 27 Aug 2025 16:08:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1urIhk-0007zE-Qk; Wed, 27 Aug 2025 16:08:56 +0000 Received: by outflank-mailman (input) for mailman id 1096486; Wed, 27 Aug 2025 16:08:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1urIhj-0007jm-Jf for xen-devel@lists.xenproject.org; Wed, 27 Aug 2025 16:08:55 +0000 Received: from na1pdmzitismtp01.tibco.com (na1pdmzitismtp01.corp.cloud.com [160.101.131.8]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 202c29c6-8360-11f0-ae26-e363de0e7a9e; Wed, 27 Aug 2025 18:08:53 +0200 (CEST) Received: from mewpvdipd1010.corp.cloud.com (unknown [10.113.40.46]) by na1pdmzitismtp01.tibco.com (Postfix) with ESMTP id 5B60C40D6683; Wed, 27 Aug 2025 12:08:14 -0400 (EDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 202c29c6-8360-11f0-ae26-e363de0e7a9e From: Mark Syms To: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, Mark Syms Subject: [PATCH] [xen-block] Return BLKIF_RSP_EOPNOTSUPP for unknown operation Date: Wed, 27 Aug 2025 17:08:41 +0100 Message-ID: <20250827160841.351707-1-mark.syms@cloud.com> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Returning BLKIF_RSP_ERROR if an operation is not supoprted does not allow the frontend to exercise any discretion on how to handle the response and may lead to an operating system crash. As different backends may support different feature sets and we might, during a migration, switch backends, an in-flight request might be issued (or reissued) which is then not supported by this backend. Signed-off-by: Mark Syms --- hw/block/dataplane/xen-block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c index 48c2e315f3..32cf919a97 100644 --- a/hw/block/dataplane/xen-block.c +++ b/hw/block/dataplane/xen-block.c @@ -167,7 +167,8 @@ static int xen_block_parse_request(XenBlockRequest *request) return 0; default: error_report("error: unknown operation (%d)", request->req.operation); - goto err; + request->status = BLKIF_RSP_EOPNOTSUPP; + return -1; }; if (request->req.operation != BLKIF_OP_READ && -- 2.50.1