Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2834230rwb; Fri, 20 Jan 2023 07:58:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXsjOBegZDjibI0zzwfFCbTTLuG6mUIuMQtACbMHd3m4bGhpSk1MfUjGIFNJ4OHYxcgl7RbG X-Received: by 2002:a17:907:1316:b0:863:e08e:2ac3 with SMTP id vj22-20020a170907131600b00863e08e2ac3mr24985009ejb.63.1674230314206; Fri, 20 Jan 2023 07:58:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674230314; cv=none; d=google.com; s=arc-20160816; b=bFp06MLr11o6/va+FIYWz6hmtnqigzFT1fB1mou99E3fRTQGsw15+zKH0C49lwkrDR 5H5mEVDGunFsjHyfqzqCT+vfs0KmDiXxMW0rV3opccG35Q9XoEwOGuEFd9DiOvr84Sj5 VC0f1t44aun0QsCmGApMkWyBGWX4sg12ZHBpMigUTWXEcjRR6gwJHrMA2eYBpqX6vOVy GFYU4ei2TB3wbLgt2YmGqSyY9NCGE/ioMFl17XgkWwXtRDPkIJsiAbCRLlEtU20A5Dk0 UIZDlnm4zOWfMhJCvaBX7ZgMlyUdZosCPqxkcsevsmGpE6GMd7748TY9uqjhwe7cL36C OD1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=TchU1iLPePpcqRbekVlnY2VH9ygMMGGc5dJbNtS9ixQ=; b=my4t7usHZpl7aKWgQm46SQvvelpzciMPP/GTFDItLgk5nNu6/7Gw3LG45al2gib1XE 4k6lEzD6gXvrwESLZHTG4uxiqLK19jEFpY3FLZLf8hVB7+39NkCPO3ufFrMpw3hq2Vmh uNjiFpk/x8EFN1huOqYs2ULgagdBQi5orRKu9m3qAm8n9ZxY4Z7VkUOuoITBd7ce0bZ4 1Iy4yMc6kgWHAPLafBXoA3qcjigw1i1B7knS9JRhMyKsUtW51yowL1ckmiQjvRE2FnRY UfG3xClRpOrLwjifEjyX5NYSbO86SWEb8ybwgXte+7OaRuMyuRp4VRhdrgkCeRTSy3mg lcbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=biA9YJbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu10-20020a170907a08a00b00871a4e8d7b6si15663380ejc.772.2023.01.20.07.58.20; Fri, 20 Jan 2023 07:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=biA9YJbw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbjATPvt (ORCPT + 50 others); Fri, 20 Jan 2023 10:51:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230458AbjATPvs (ORCPT ); Fri, 20 Jan 2023 10:51:48 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552F59742 for ; Fri, 20 Jan 2023 07:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674229907; x=1705765907; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=gYG8bbRbt/rhKlaJNI3iosDqiCy4zA84p3RRJ32SU9w=; b=biA9YJbwlK/ZyihFA4QUahiDphJ9RJ8roK6cW3CjZ/SZEC7zp1Hxc7+5 3664eiCOotZylo/fek3DcRAwvw+5UbnFusSAY7NE42d/rB7xr/j/BdtfM 0yZYSXpzv4qaDxtMJGxAPO/nfMiAsR7AXgkmWrtTo/3hJ/UA0+9BZQ87Y EXtAmp2x7xFog0ILZe6J59sSWMp2zTbMRJqY6L79pHFRCtKuO2dbQWhCE 505bO2KQYGQxAjQp4mSNhZgkXtUv3Xrxsng6svU/EghYSBgI7zdDJV0tk gHvKgsQqcDReVbXPnFE126elwxMh0pqHJaztVzaXj+idlFI3FHhSb2wtn A==; X-IronPort-AV: E=McAfee;i="6500,9779,10596"; a="309181132" X-IronPort-AV: E=Sophos;i="5.97,232,1669104000"; d="scan'208";a="309181132" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2023 07:51:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10596"; a="638190229" X-IronPort-AV: E=Sophos;i="5.97,232,1669104000"; d="scan'208";a="638190229" Received: from ubik.fi.intel.com (HELO localhost) ([10.237.72.184]) by orsmga006.jf.intel.com with ESMTP; 20 Jan 2023 07:51:43 -0800 From: Alexander Shishkin To: "Michael S. Tsirkin" Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, elena.reshetova@intel.com, kirill.shutemov@linux.intel.com, Andi Kleen , Amit Shah , Arnd Bergmann , Greg Kroah-Hartman , alexander.shishkin@linux.intel.com Subject: Re: [PATCH v1 1/6] virtio console: Harden multiport against invalid host input In-Reply-To: <20230120080130-mutt-send-email-mst@kernel.org> References: <20230119135721.83345-1-alexander.shishkin@linux.intel.com> <20230119135721.83345-2-alexander.shishkin@linux.intel.com> <20230120080130-mutt-send-email-mst@kernel.org> Date: Fri, 20 Jan 2023 17:51:42 +0200 Message-ID: <874jslqk4x.fsf@ubik.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Michael S. Tsirkin" writes: > Weird. Don't we already check for that? > > /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */ > if (!is_rproc_serial(vdev) && > virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT, > struct virtio_console_config, max_nr_ports, > &portdev->max_nr_ports) == 0) { > if (portdev->max_nr_ports == 0 || > portdev->max_nr_ports > VIRTCONS_MAX_PORTS) { > dev_err(&vdev->dev, > "Invalidate max_nr_ports %d", > portdev->max_nr_ports); > err = -EINVAL; > goto free; > } > multiport = true; > } Yes, I missed this earlier. I'll drop this patch. Thanks, -- Alex