From nobody Tue Feb 10 00:22:48 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611337866; cv=none; d=zohomail.com; s=zohoarc; b=iLd7g7NhAY4I8WVS+ai8wCIaLIOmFV42HXzr7NKxSsOXNG6I6ZcUEbJi2ZPAHrnPu+9ggpxkFLj1W8v26FA8akntPI6fwW89aoLPY63O3f3glBQHMP8v9cIk/BgdJeWlmwQyK8zDC3b2bK5Dh16UnYCy20RmWQGKWUYeNbr9bNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611337866; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3cYJqJSxpRfhdfFzwRR6c0uMoYnqDQRDW/OpcLay+J4=; b=C5xsf4FzKnfoCv7P0701/o/xqVUugl/xir7OzBuuMgF72g65R1pGNZo3YzGz724VaqBcRHzCZP8NK8dAABM02lKs0HJWiluhkt3ENWvLgO2v907z2HIqTN5Hsfe/CFFj78a5gATFqNzOI+cHY1mlSqjZ/W+fBzxjt3KB7a3VsMI= 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611337866814906.9376136134283; Fri, 22 Jan 2021 09:51:06 -0800 (PST) Received: from localhost ([::1]:49290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l30aP-0005fw-QA for importer@patchew.org; Fri, 22 Jan 2021 12:51:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l30YX-0003ZV-BN for qemu-devel@nongnu.org; Fri, 22 Jan 2021 12:49:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l30YV-0004iK-4N for qemu-devel@nongnu.org; Fri, 22 Jan 2021 12:49:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-9HB-n-beP0GBOdq-vfxBQg-1; Fri, 22 Jan 2021 12:49:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B50C7802B40; Fri, 22 Jan 2021 17:48:59 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AE2E2BFE9; Fri, 22 Jan 2021 17:48:56 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 42B73180062C; Fri, 22 Jan 2021 18:48:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611337745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3cYJqJSxpRfhdfFzwRR6c0uMoYnqDQRDW/OpcLay+J4=; b=MpONTscnKaYo+8beHM/9sQj43ShPEoATtG8XRdPsr/+qmURYP+v4+vFWuWswIaqZmInEPh 4eGdBM24Nz1keO7z3vqRh+UMO32Xsxq7EjBsBwMADqOSY04fnxxA2yW/Pn74UHvr/6hycr zOeEOcdaeyWLxHxFOugzorJylpWQmts= X-MC-Unique: 9HB-n-beP0GBOdq-vfxBQg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/8] hw/usb/dev-uas: Report command additional adb length as unsupported Date: Fri, 22 Jan 2021 18:48:47 +0100 Message-Id: <20210122174849.3936119-7-kraxel@redhat.com> In-Reply-To: <20210122174849.3936119-1-kraxel@redhat.com> References: <20210122174849.3936119-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.182, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Ed Maste , qemu-block@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniele Buono , Han Han Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 We are not ready to handle additional CDB data. If a guest sends a packet with such additional data, report the command parameter as not supported. Specify a size (of 1 byte) for the add_cdb member we are not using, to fix the following warning: usb/dev-uas.c:157:31: error: field 'status' with variable sized type 'uas= _iu' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-= variable-sized-type-not-at-end] uas_iu status; ^ Reported-by: Ed Maste Reported-by: Daniele Buono Reported-by: Han Han Reviewed-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210120153522.1173897-4-philmd@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/usb/dev-uas.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index cec071d96c49..a51402bc0bfd 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -16,6 +16,7 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/log.h" =20 #include "hw/usb.h" #include "migration/vmstate.h" @@ -70,7 +71,7 @@ typedef struct { uint8_t reserved_2; uint64_t lun; uint8_t cdb[16]; - uint8_t add_cdb[]; + uint8_t add_cdb[1]; /* not supported by QEMU */ } QEMU_PACKED uas_iu_command; =20 typedef struct { @@ -700,6 +701,11 @@ static void usb_uas_command(UASDevice *uas, uas_iu *iu) uint32_t len; uint16_t tag =3D be16_to_cpu(iu->hdr.tag); =20 + if (iu->command.add_cdb_length > 0) { + qemu_log_mask(LOG_UNIMP, "additional adb length not yet supported\= n"); + goto unsupported_len; + } + if (uas_using_streams(uas) && tag > UAS_MAX_STREAMS) { goto invalid_tag; } @@ -735,6 +741,10 @@ static void usb_uas_command(UASDevice *uas, uas_iu *iu) } return; =20 +unsupported_len: + usb_uas_queue_fake_sense(uas, tag, sense_code_INVALID_PARAM_VALUE); + return; + invalid_tag: usb_uas_queue_fake_sense(uas, tag, sense_code_INVALID_TAG); return; --=20 2.29.2