Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2791278rwb; Fri, 2 Dec 2022 15:22:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TIeQoy7OMQi92RGUJwfVF3WtR/XJ5FDi2DH5fasaEzwwIrfWIRnSEp7cvnYjGp1jqgqAz X-Received: by 2002:a17:902:784c:b0:189:65c5:4507 with SMTP id e12-20020a170902784c00b0018965c54507mr38386865pln.172.1670023328700; Fri, 02 Dec 2022 15:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670023328; cv=none; d=google.com; s=arc-20160816; b=a07IM80G5gG3UFVS4+f5rL3ZpfHSFawDAu3wdmIMbYXIpCwJuh75sGBf0OszOkFHrf hpPAMdFWzo52v2MAhb5MCEseJrvHG4YdMlIyoqEJjt7ynVEdudasjf7FxaGeyt0/ZJkM drEtHWDkbr+s0AhI4IT8e7U7CmpLd8tJJDd10+Lkpy7FTRM4eaqhefECeppqLbxoGYeg 0SKZDLeo98lF8WAmkX36oi3C+ncKwnYaKe3w7G/xkUKDG1x2rLLg32kDxODmbbcBYwGr DHUvFgVGnn857kZ6+PFXOWiDGBHZq3xilcLJPZ8dG6W0wxZQEABsGEYHTO6TLkkzGVXP q54A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3XEuRS+fnNaOcwvF4ALf0vsvotjIsfbn8FzdiKmTHyE=; b=W6WXVaRgmH17AEb6PC1JZvV1QtZIJCIX2KqyiSsVooS8qZLbsWmBzr8j1EwgeedjwJ 8GCBxWYKLKoS7j7He0ZNpEdvG7LU3MkQfqLqvVsv4sI6/pfDoMFtQo2LI0ydIjO7Pz3m kSb2K2mJQwtgDvbdFM0R9ZIAtl0OHPtIReCpNFpSXngn44KcpHdLZboFT7bJ7LRyW8W4 R+mOxcfrbzu9Fzs2mGZP+9xVBKCSwdIYPT9hhPrQZINx3/93YesiONwn9t8Eje5K6ZL9 ruvPM0kdHkm4BfLVBCEZSVQarfVTL/zFbGDdvxLZp7oh2ya4oD7gEu7BXeMCQL0zHpa9 APOw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a056a000cc400b005631dab9f69si9546372pfv.301.2022.12.02.15.21.58; Fri, 02 Dec 2022 15:22:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234431AbiLBW6e (ORCPT + 82 others); Fri, 2 Dec 2022 17:58:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234513AbiLBW6a (ORCPT ); Fri, 2 Dec 2022 17:58:30 -0500 Received: from gw.red-soft.ru (red-soft.ru [188.246.186.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D184BEC09C; Fri, 2 Dec 2022 14:58:26 -0800 (PST) Received: from localhost.biz (unknown [10.81.81.211]) by gw.red-soft.ru (Postfix) with ESMTPA id 9FE7F3E4B13; Sat, 3 Dec 2022 01:58:23 +0300 (MSK) From: Artem Chernyshev To: Bryan Tan , Vishnu Dasa Cc: Artem Chernyshev , VMware PV-Drivers Reviewers , Stefano Garzarella , Jakub Kicinski , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] net: vmw_vsock: vmci: Check memcpy_from_msg() Date: Sat, 3 Dec 2022 01:58:18 +0300 Message-Id: <20221202225818.3934909-1-artem.chernyshev@red-soft.ru> X-Mailer: git-send-email 2.30.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 173907 [Dec 02 2022] X-KLMS-AntiSpam-Version: 5.9.59.0 X-KLMS-AntiSpam-Envelope-From: artem.chernyshev@red-soft.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 502 502 69dee8ef46717dd3cb3eeb129cb7cc8dab9e30f6, {Tracking_from_domain_doesnt_match_to}, d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;localhost.biz:7.1.1;127.0.0.199:7.1.2;red-soft.ru:7.1.1 X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2022/12/02 22:29:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2022/12/02 19:57:00 #20639455 X-KLMS-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 We returns from vmci_transport_dgram_enqueue() with error if memcpy goes wrong Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 0f7db23a07af ("vmci_transport: switch ->enqeue_dgram, ->enqueue_stream and ->dequeue_stream to msghdr") Signed-off-by: Artem Chernyshev --- net/vmw_vsock/vmci_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.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; - memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len); + if (memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len)) + return -EFAULT; dg->dst = vmci_make_handle(remote_addr->svm_cid, remote_addr->svm_port); -- 2.30.3