Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2950459rwb; Fri, 2 Dec 2022 18:35:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DrCBPDsWqQyi682IcwQfRS27ypq7KwxuaM1cu8VE/MnNE/0y6ePbQ0vj+YwE3MS1A73+X X-Received: by 2002:aa7:d34b:0:b0:46a:914c:9bc9 with SMTP id m11-20020aa7d34b000000b0046a914c9bc9mr37559500edr.418.1670034928753; Fri, 02 Dec 2022 18:35:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670034928; cv=pass; d=google.com; s=arc-20160816; b=Ba6XY/DQYG4jR157c96zOcREQ92P5Qsb/Cz8ijOJuYc1rULuVxipugWw5hU/Eny1m2 +5z6iPdlUx5DIsACGMzHUP3UhipKXteiWEqK0ERrEQ19q/23gkC7BJPWXcs5qel/w48o vfHGDTFKRqAqA9EhIgZmDww7UNCOJuBXTrK0LXnM2+8DqbXsCH3H/aOuusor0gGvTfo8 /Xnt3oc+UoPEDZp34LsZq11K0+xbMiiXuUKfuEfAKfy0hK19r0OE2TmOvtE3F4tn9G0w 4ZqQQUZn/xZUXMrKN7+0zP46uensIavwwpYsBwWnJQzic3/UN2/3gXY91J2mWl0ELnNK aP8A== 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 :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=ytiPKTrE1y98gilt7tBCXZ1+lYVmXcyVfrhjLTZSTSc=; b=CU+obC7j9b/CnNwFgAfYO/QaoFmdrPoDqCpxsMnJR9AAZqCn/c13LNsYLQRoMIr+MC Itb+DqtAEdRPhyb02IrUzcC5edfQvzZH/5HuTHiynNkgoj/MLL2AGHysSiSCe24nHYQ1 Dp6aUjrcbhKRP/yyKnqrUrM/lvRziUy7aEhGloJ6jGavli3t2+6HJDlG28GMXGxEq3Ii SOoTz9UR7a8AxdBB5LFn5418RvPrVUq2oeKX59CvzJnW+zk1xlnDrrE9LrwFUVg5rKbY IZR9w3su5TyP7DzReNHAYmIgXzKAw2vbBjf4UnJYs7VwuBSnekCYUwai007dp5CSLCkM NlRA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=vyXXbwro; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb35-20020a170907962300b0078d8db64fffsi7554937ejc.20.2022.12.02.18.35.08; Fri, 02 Dec 2022 18:35:28 -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=@vmware.com header.s=selector2 header.b=vyXXbwro; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbiLCBRj (ORCPT + 82 others); Fri, 2 Dec 2022 20:17:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbiLCBRi (ORCPT ); Fri, 2 Dec 2022 20:17:38 -0500 Received: from CO1PR02CU001-vft-obe.outbound.protection.outlook.com (mail-westus2azon11011001.outbound.protection.outlook.com [52.101.47.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFEB910A5; Fri, 2 Dec 2022 17:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bEi9Gshg5FfCH/jOBE7QN8agz6xQ5nffMOOrJQ/KhQ915IjGAkIaAHZSFkU/aQctHr+02YTx7XUqxUP7GtfejIKouN3yoxqMh3+23RKdJ+H5n0KHg3a+HIMlV8tjVfc3w7SOwZMo0qngFVUf4Ernfp8OrbbH/OZ1ZEf8OjlF4zlZKGEZ40Mv/fcLYpHfh98BgbVFD8GPzQt+1LQTOuY1RWCwe6KM0PONQkrSe6ELVm0qI2Y+9G6kxZre3FE5QMSKgqdHmYBZlbbMb1lkwbrwRHh+RkBlVbDh7wsp6obP7eUThLJggPaqQCUGMyMCgZWUMnhShdEjZ0qHHTx2T1UjhA== 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=ytiPKTrE1y98gilt7tBCXZ1+lYVmXcyVfrhjLTZSTSc=; b=NkbZOj95GHbVFHFUO9LaLS3DY2mYDi6cEYMydmoZ4ClDEPBeLko1bgohPLFpbRbA+kkBzlZgP+bk4ENCKAb32NPLOvUtz4wEaoEU5ONHieEVEgYMvm1nSZE7aZcQqjt3hC6dj9zaxSnVQVZfXYztXj5S06riKufRcn2RxTQEBFvcgaNJoXuCTseR5jy9zhmjSykz+NcuHSRjQr/ts49t/CL9msnVSBrU9rapDwCte43psxszqSjOUtuPmjpD5fmKOaJa51vP33XoqyYwKdPByNEC8twrR/wyFC4nygcazIf/uAO9DS8dfLiIbvW7+L1TLMDvHMCT9EgDnf771WhC+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ytiPKTrE1y98gilt7tBCXZ1+lYVmXcyVfrhjLTZSTSc=; b=vyXXbwrod+S+avS+MYFv1WYquZR/Dcf34s1w8jS4QG/SVdn+IZ3smbCNEXhz/O+avv3ozMPFbZ2piFH61ERZXH4Lxo8WpgQMGQ2VSiJ7v20StC/o6ybn0tjZNGl+5HNW7bMuPnbamPzbdanbY55KNsosg60MWT0aQjcNletzATY= Received: from BYAPR05MB3960.namprd05.prod.outlook.com (2603:10b6:a02:88::12) by PH0PR05MB8511.namprd05.prod.outlook.com (2603:10b6:510:ac::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Sat, 3 Dec 2022 01:17:33 +0000 Received: from BYAPR05MB3960.namprd05.prod.outlook.com ([fe80::6764:941b:e0cc:c4e1]) by BYAPR05MB3960.namprd05.prod.outlook.com ([fe80::6764:941b:e0cc:c4e1%7]) with mapi id 15.20.5857.022; Sat, 3 Dec 2022 01:17:33 +0000 From: Vishnu Dasa To: Artem Chernyshev CC: Bryan Tan , Pv-drivers , Stefano Garzarella , Jakub Kicinski , "linux-kernel@vger.kernel.org" , Linux Virtualization , "netdev@vger.kernel.org" , "lvc-project@linuxtesting.org" , "David S. Miller" Subject: Re: [PATCH] net: vmw_vsock: vmci: Check memcpy_from_msg() Thread-Topic: [PATCH] net: vmw_vsock: vmci: Check memcpy_from_msg() Thread-Index: AQHZBqGb35ZyQ9z5mEiW229BBPzKAq5bXMUA Date: Sat, 3 Dec 2022 01:17:33 +0000 Message-ID: <702BBCBE-6E80-4B12-A996-4A2CB7C66D70@vmware.com> References: <20221202225818.3934909-1-artem.chernyshev@red-soft.ru> In-Reply-To: <20221202225818.3934909-1-artem.chernyshev@red-soft.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR05MB3960:EE_|PH0PR05MB8511:EE_ x-ms-office365-filtering-correlation-id: 9bfc709e-1439-4fa8-418d-08dad4cc27bb x-ld-processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 95EFquQyGVEEzp4n+vtz43UWVkRMmNbIBJ/+r09+JtD5kbx/IiRMzI6Lfris426zC6EwXoETothPJsLi7bMcajj0BZjPvlnI+dqf1f336WA2ED+31qxVMHJT7VP5rp6KRkKFnFUTbMRc0qFczzRTpv7iNjOzlEDaneBo1CahM0xnicstWFoyhYBwQT5CFYqB38pyoC+mqn/Eh8qj8Oa//bEFST+wT6fN3yRYbHeRF9YBvkeA2dvAmcor1FFQ8YdPPxqXFZ2SxQGixn5sOpPpnD6//pJ+umn8BPbyH6kGLOY4OwQ17ZNH7EmMU3IjeKZdFDi2Wv2MD1Pb58LwFjT9L87WI1MBZ2cZXhHm5rd8x1fvQSNDvEvRSKyWVl3126KU7r3oLugZFmhC8iIWchPQAmtVVtT5Rqjuoj/ZADMK1ujWKcwpEZV/493/GGg2U1Jz+cfGeu3YA7q7eqV2nna/oNJmeYQXtb/MH2GgWHhCyvpOoSc3sDXwwhVAiGA6SjDBb6428JNQQbnPKvoJ3H87rDNkAG7IbfBNcRY29ktyNqcFfaIO2O0RcS8AMFrzC9jimRCaoV7DfbQrRYEb4fUHP4yq1b4NcKao8TxMTA9I3Wrlx8pFCdTDW8nntyiQ4GogEGyNpkdctWFdYAvtr/BgSnoa0yZmp8Hn1aAopABAm2NYU4X17BzrVpICcu9ZZGfU+bsKC86WsgUbnxSDfeWSVg3UZNp+Oh8IhBNN9TFJkGs= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB3960.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(39860400002)(396003)(366004)(376002)(346002)(451199015)(5660300002)(41300700001)(8936002)(2906002)(38070700005)(8676002)(36756003)(66946007)(66556008)(66476007)(64756008)(76116006)(4326008)(66446008)(316002)(38100700002)(6916009)(33656002)(122000001)(71200400001)(54906003)(6486002)(6506007)(53546011)(2616005)(86362001)(186003)(478600001)(6512007)(83380400001)(45980500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?asvQdz43TSpYl+krkht9L4ZOOYOuXOhgsxzyIaJMPh22bgXTEfKDMWJtRwBs?= =?us-ascii?Q?CibJiCT7fHCPCGE5zpo88lgDlITPFysvbWKbaQN/SnxEIkjCoFtTvLYrDJAU?= =?us-ascii?Q?rBp+7pyvxwEdafC2h0ns32ksICDPpddYRi4GW7lczfR91ZxwLi5QOd2lPfLg?= =?us-ascii?Q?BpKM4r7Ea8lX6ZZ/CYWMyPcu7D8o8st8pYMDbekQIg8uBT1LjzwYZs0DrRwy?= =?us-ascii?Q?Sb/Y7v5Evdy7zl1Chrrfh2OeN/5oEzCicIgyTku4wny8c7LAVH0V/bK9fZ+P?= =?us-ascii?Q?dU8RGCa8DjilSdaUEQjyQ3ooDwx1S5f4xmjCge6dCgPvc6aZpMkE3IuDFXJN?= =?us-ascii?Q?MC5BQk0j4l6oMDv4wpQPmdHCOtubPjOj4On/XXXwO2snAcwdmJNdor138jgt?= =?us-ascii?Q?/Oh4lOpnmX8UrjllJn5urSg9qjL4KVXe/aCK/L4kulUQk3Bg6iPJBfk2SVn7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wxJkuMjf/zi0iyVhz+WRms57XrPjxTeoBTIYzmL?= =?us-ascii?Q?kTWix0yV0DYqKmUUSfiC1e6ySC3z2S4WqZz7Ryz/tJaB+KPlqufp6dY0Kwt4?= =?us-ascii?Q?/7po99+1zl/5nzEWryA/myH+Lv6Pj550w6haTYRyy1FjtbQ+/0X4XvCxlHkh?= =?us-ascii?Q?i+TpRn/j5eaHOYSvcO8a/Kh0nj2ffdAnVmNceVHbuOdIQ3p40e7wh76ZQA1Y?= =?us-ascii?Q?VKdd7AjMtdgc7O9igc+CYvRcvwgKJKyZgqF97eQ2gvLThB61U5VMmKMGfWTX?= =?us-ascii?Q?2RKiRf+Fw0uN9/rWzVK158vqS/TTsZgM7XrXghmpiZWe?= Content-Type: text/plain; charset="us-ascii" Content-ID: <7E63B8CF4B48EA4690AA573E066E001D@namprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR05MB3960.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bfc709e-1439-4fa8-418d-08dad4cc27bb X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2022 01:17:33.0721 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: z1/2v5aQEc1f1j9Wx34IIc6w1y5ZZF2vmFfKi1qPaP81zkGUUu7kMWlw6+cxvwYQek3vKEP44kwXVx7rnwyx1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR05MB8511 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE autolearn=no 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 > On Dec 2, 2022, at 2:58 PM, Artem Chernyshev wrote: >=20 > We returns from vmci_transport_dgram_enqueue() with error > if memcpy goes wrong Thanks for the patch. Nit: could you please update the description? Maybe something like - vmci_transport_dgram_enqueue() does not check the return value of memcpy_from_msg(). Return with an error if the memcpy fails. >=20 > Found by Linux Verification Center (linuxtesting.org) with SVACE. >=20 > Fixes: 0f7db23a07af ("vmci_transport: switch ->enqeue_dgram, ->enqueue_st= ream and ->dequeue_stream to msghdr") > Signed-off-by: Artem Chernyshev > --- > net/vmw_vsock/vmci_transport.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transpor= t.c > index 842c94286d31..7994090e0314 100644 > --- a/net/vmw_vsock/vmci_transport.c > +++ b/net/vmw_vsock/vmci_transport.c > @@ -1711,7 +1711,8 @@ static int vmci_transport_dgram_enqueue( > if (!dg) > return -ENOMEM; >=20 > - memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len); > + if (memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len)) Need to free dg using kfree() before returning. > + return -EFAULT; >=20 > dg->dst =3D vmci_make_handle(remote_addr->svm_cid, > remote_addr->svm_port); > --=20 > 2.30.3 >=20