Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp770527pxb; Fri, 22 Apr 2022 10:46:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmT8C1Y24bxLMRgLsZxKVImf/HGMnntvAl3pNBT5SJLjoA85OBfgZnATlxXn6WpqIsigJt X-Received: by 2002:a05:6a00:1749:b0:50a:8eed:b824 with SMTP id j9-20020a056a00174900b0050a8eedb824mr6157474pfc.50.1650649615227; Fri, 22 Apr 2022 10:46:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650649615; cv=pass; d=google.com; s=arc-20160816; b=a1IBoVg2F8piHaBjYSVzKNsZ8sa4mmhwKVrdODz1x+u3ik2beT7+slK07RDEebN1GE D+sO4+0llZDE//w+lGNLU/zmTqMJ9TePYsv2iJJ0NKZBJR8WYWCXDPh3Ze0v8TXBDhUx ep1P+19IZ8PB9PXgRaczbaRfNaBxNwYbjyq6GK+k/qXTS3iFo03X7rTPPWYpIvxXOt6H PgIVBR4bLr7DeSiq6IgDz2yrb1/eGXZDkoQa9v2QmXZrtsy884U7fR4pVpzTIu0MV262 RZTEo7RWMPGtb3wumiyTB+u73sPMzaCNlsfUmoiHvSY/oISnuBtx39JL+VCEq7c8JJ1a Q06Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=VNEYDDK4Vafr+Jqf0PaMDg7tROjZNvJ/mR1J2rj+654=; b=UyttAZge6uwD/5mUp5DDq0gBeJ8MQRCC7/mSeYB/Ce4VsJaTU9lixIlxjpdDVHPEAB XCtIsRuMXlVwghI7HRIALaTmzMSR9khdwMWaS4/Mm2LRs+9vp/7G53+BMzPsNbE2SkIW gxj/JmPgdolMFTbu1qIRVgmGlEbXJg93kJ+ePCC/6K/UO8XPfJdlxoCYJ/hOgrIEm+dc np+O0cBLfkNoXaZxZOTRLC3pPY2OEdQsvOHI37pfiPDbnj/sqn/3gNekX6NCrB948G7R 8zyGKfU/+SFXPtyxDfsKThC2ueAGGtWgFkvgrrGsUXnlRyu66eX1gdqEQS7Ybdco+EN8 ZDNg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=iHoCcjMk; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c29-20020a634e1d000000b0039e592ec1a7si8736599pgb.497.2022.04.22.10.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:46:55 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=iHoCcjMk; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E125BF2A20; Fri, 22 Apr 2022 10:32:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383074AbiDTXKH (ORCPT + 99 others); Wed, 20 Apr 2022 19:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235668AbiDTXKF (ORCPT ); Wed, 20 Apr 2022 19:10:05 -0400 Received: from na01-obe.outbound.protection.outlook.com (unknown [52.101.57.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3F081E3EF; Wed, 20 Apr 2022 16:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zf5v/PKYZggwLw7XWdRaNnX4otuiHrP4H/WFek74cKnWA0Lf/pRP355ho7jFZDcrI8u9gaVuWPpxG/lJzypWUmhYohewX7hmlGE912v4rK+SlYpUWsAhEJyUjPR/O7lFvAzSeCDHnnejvoOaiT6u6mNjrbBWu6bwdKO8SC/tPKDAduNYPzUTsPbYfh53caN2PT0utLQSUpOOYkgAdwxUXzkao1LUqxxeFFs1T7aU3VyhMSR90OFCP8N5EVDbXZNLJe/xH8NrChJY+p8jxzSULBB8gRPA+P3KdqW1//DhNjhmfaeJ/0UTbz1j/SGeHbDv2HvaVhZ+4Kq6WnvqB7skXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VNEYDDK4Vafr+Jqf0PaMDg7tROjZNvJ/mR1J2rj+654=; b=hClXFDA/hQoWsj0MdPR7YssaiSQzZpwbXbKjVNiguQX/A9QEt5x4FEsKoWKXMwUVsXkkrIY15OGgyPgLjZjQKwTM9es4/VRQcjmx3y4I74zR4Knv4Nsa3j2yuO6qFn0U1L7/JkzvgW4R7ATfNoFbFVbBdm1/mMUxEeN2Dt9UujY5uu9DbZGCwOxXsbdS5WVh7MVQIqsZqOUQ66Z+/s5l086rPm0nYDHKErkFUx02tS99GPqY0L44a/6NprnZ6A00lmH4/XEKs5CKtSpOn5Nd1fEAB1LyCWI46orEYouLlSeVe4Vehhd07Wp5i90x0WMIJCyzpoJhdLOfDC+EmQL9bA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VNEYDDK4Vafr+Jqf0PaMDg7tROjZNvJ/mR1J2rj+654=; b=iHoCcjMkxGxGEVGlATxn2f99q54EIaC6lDsJIlGAJzkmmdsJZFW59I2pAvxVaJ+ujZPq0WATKzJRKgz5TwCga3Uu3i6pmpx19QVd30qJTwfAS9ol5oprxaAe8UWeaCJyyN6gQ07xtRFp9lKCh1aVn+K3Q/8i18mF/4QU15KNk0w= Received: from PH0PR21MB3025.namprd21.prod.outlook.com (2603:10b6:510:d2::21) by DM5PR21MB0634.namprd21.prod.outlook.com (2603:10b6:3:127::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.6; Wed, 20 Apr 2022 23:07:15 +0000 Received: from PH0PR21MB3025.namprd21.prod.outlook.com ([fe80::dd77:2d4d:329e:87df]) by PH0PR21MB3025.namprd21.prod.outlook.com ([fe80::dd77:2d4d:329e:87df%5]) with mapi id 15.20.5206.006; Wed, 20 Apr 2022 23:07:14 +0000 From: "Michael Kelley (LINUX)" To: "Andrea Parri (Microsoft)" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Stefano Garzarella , David Miller , Jakub Kicinski , Paolo Abeni CC: "linux-hyperv@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/5] hv_sock: Check hv_pkt_iter_first_raw()'s return value Thread-Topic: [PATCH 1/5] hv_sock: Check hv_pkt_iter_first_raw()'s return value Thread-Index: AQHYVPJOg6b8Qh7Hl0ach3tCpZo5hqz5bKJQ Date: Wed, 20 Apr 2022 23:07:14 +0000 Message-ID: References: <20220420200720.434717-1-parri.andrea@gmail.com> <20220420200720.434717-2-parri.andrea@gmail.com> In-Reply-To: <20220420200720.434717-2-parri.andrea@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=e9a66bf9-4a31-4de8-8a69-3d46965b78f7;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-04-20T23:06:27Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a9c6db6a-1916-46d5-c6fc-08da2322823f x-ms-traffictypediagnostic: DM5PR21MB0634:EE_ x-ms-exchange-atpmessageproperties: SA|SL x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HxMXpXKVRaAl+jc0xyccgJxukh4Wf0q9eNzlcufREkpVM2qn/1xPFDIsCVWP7FENw6iY4cVFU+jVw5fj+fATPWPefuGC0My9xDFeRljK3TJNyxXioCJ70eF5LN0rY85QyBKE4HdbetWkINeBtAz167iw7UntVMazLpUb4Cd8ZUADzJRviR/g24G58OgLaYJGulabivdtAx0eXMFKCGMCjQiSypX6Vg8meIeMGVLwMo0bDpSRzWxPSlun+LGogi1LSZmhwYnoOrg4rd8jUyHzZswRPgSSmy5qOsStycoST7CvlAU92Zt4HO1/StGwZWT3U82Qrec0SCztDnVnoYnE/QEw/8qUp4Kvo9R0k9Vs5aEgLidtbn54qUlkj4F+BpJMyWCEqdTZ4Eb+KaYOd1DYsaDv+WHFdhyKZN4vL40tg1hfmfws6KKcKmFDeGRyLmg5c/Dvwo8JsbccbFBgny4TggMSWPzOS3UUGwM9FxeypLICyjhx7iTR/Nm8KNrystqrc1Oy7quxDcVaZiAfmsTH16CoaTFwP7rhUKaryeTO6qPbdlI9bxpLkADWspc3Yva0QC59QXFZiJDAZYnTXdJG/z9XO3yCAFBCtySHE7bhCb8k4q39GKeUZ67GonpCn7EpGaHlDK9Ae1pIZsF49ztPwuGnKHxM+/iGoaxMawUXNT3Ckak7P3Cxxj7keOkw8IJ7S3YuI34AN//Iie9V9OT0otOb8BBN5liv0zMpx1fYU5bhKsvV32Tvz1IPTZTBzQJZwWuYEwNZ1MTZYK4xtZ5hqA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR21MB3025.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(451199009)(26005)(8990500004)(6506007)(86362001)(2906002)(9686003)(186003)(110136005)(66946007)(7696005)(4326008)(54906003)(316002)(8676002)(64756008)(66446008)(76116006)(10290500003)(66476007)(66556008)(38100700002)(83380400001)(38070700005)(122000001)(55016003)(508600001)(5660300002)(7416002)(71200400001)(82950400001)(8936002)(52536014)(33656002)(82960400001)(921005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?LarTIWW+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D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR21MB3025.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9c6db6a-1916-46d5-c6fc-08da2322823f X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2022 23:07:14.6774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8uTOr1ULHrSCvPEfdCbSzwJEKu5NuhandNJU+1viCdmmlZ7u5hEFig/5SyJgM24OnosVdFW8ikTYNJsc8uv1gpdd9Vjtr16r1zPxJYPEbS4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0634 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 From: Andrea Parri (Microsoft) Sent: Wednesday, Ap= ril 20, 2022 1:07 PM >=20 > The function returns NULL if the ring buffer doesn't contain enough > readable bytes to constitute a packet descriptor. The ring buffer's > write_index is in memory which is shared with the Hyper-V host, an > erroneous or malicious host could thus change its value and overturn > the result of hvs_stream_has_data(). >=20 > Signed-off-by: Andrea Parri (Microsoft) > --- > net/vmw_vsock/hyperv_transport.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_tran= sport.c > index e111e13b66604..943352530936e 100644 > --- a/net/vmw_vsock/hyperv_transport.c > +++ b/net/vmw_vsock/hyperv_transport.c > @@ -603,6 +603,8 @@ static ssize_t hvs_stream_dequeue(struct vsock_sock *= vsk, > struct msghdr *msg, >=20 > if (need_refill) { > hvs->recv_desc =3D hv_pkt_iter_first_raw(hvs->chan); > + if (!hvs->recv_desc) > + return -ENOBUFS; > ret =3D hvs_update_recv_data(hvs); > if (ret) > return ret; > -- > 2.25.1 Reviewed-by: Michael Kelley