Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3959530ybc; Thu, 21 Nov 2019 17:05:30 -0800 (PST) X-Google-Smtp-Source: APXvYqzpfXBP4aNmD8e1zq0ryevQ61ntzdC47qVyilRw4EcMMpO/SFRH8PG0vrTLyzB0m0D/nHQD X-Received: by 2002:a7b:c08c:: with SMTP id r12mr13411509wmh.67.1574384730036; Thu, 21 Nov 2019 17:05:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574384730; cv=none; d=google.com; s=arc-20160816; b=NRCV7GHkhoMCktGFjQoMJeYEH6MF5EnMJWIOmFqmuwmOIr9OPvvBvnMTbyCF5W621I z2iaOyNFsBhPgCihN3+eKzoC6JUjLpezNUtSRKkSWUAKBGT3crUGhjXrM98fFfPsRTQj /0nJ746i1HT1uXHwjexV2AIcyZ2V+hNzuYVUUUvICGjV2cy5a+w76nfRswQ9ZmXc0ccy tM1rnbwhpWd8zV5IwU22RcYVypqscK++Fg3KPQKx3BeaBuvBmcSET3Pxty628ePhTs6n VAVlb49TUa9i6A1q9zsmzhC4bKssC+WAdGSE+QjAMJpWznULkDuvR9xqfhG8Tf3mUA2A fIxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=m913jDXRVfEU7lrY83rHrp6DULNdfWEGAoaZqXDkLTA=; b=aCyDtSsMkoZ/v2+5ei+PsmiqellyPXUnPPf7TWCsTYwocidu92FTN+EIJMMNgTawbq 0Gcf3REPlI15XbrdGWz1119xbq0l10dp/QjEWvqju+g1Wx9MEz0iE+VmZp+u9UdAzKDo vyaWgST0TdgH6bmw45dkFpl6OTdNc/siCnIYkywVCv9Aj6HJ5qjCPHSK3oJrhhQULYI0 9hL2xe8VaaYW4ssZFWibMdvz4MhaZsdW2FDJkDDQP0ON4PXqyyELGkR6rzVPsfWlWfKX a6tC3hdyDJFUhohyGe4neEVuzJdnq9FgXNzQRn57AO2dUHAYkGy/fLiUwVA4jAZNFC1T t+sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=pdPSpxfB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si33078edx.449.2019.11.21.17.05.04; Thu, 21 Nov 2019 17:05:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=pdPSpxfB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726855AbfKVBDy (ORCPT + 99 others); Thu, 21 Nov 2019 20:03:54 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39691 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfKVBDs (ORCPT ); Thu, 21 Nov 2019 20:03:48 -0500 Received: by mail-lj1-f194.google.com with SMTP id p18so5365907ljc.6 for ; Thu, 21 Nov 2019 17:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=m913jDXRVfEU7lrY83rHrp6DULNdfWEGAoaZqXDkLTA=; b=pdPSpxfBL1Ad/3JxV2mSmO4/6BOLjdGP/pkx3d6hs6QjMYWgNGmqybdAf8cVPb89MZ 7iy9H6Bwou+6jSwmM1TkH0C9Mb3il/QOlSAbnUqSfnXx9R4E3u4GoTFqXkAYmUgbtWG/ tldohmrkjSlw5hFcoW0L9cq3GjjCoh3i9UnrYfAl89Haytv6HBQTb73zmL5Nk1fmEdxY H31lfYB9925iXHbcDYjLF1RNJTiR5EYdDBnU0AAQfTpg0fiXE0TuYDdFNdeBB0waW0GY jKh67f3p7oxgyRw2uOMO5swxmrTiGZHbsFXZ73I5CTvbVBFrzxOtnpwyrzVggFornKH6 tDFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=m913jDXRVfEU7lrY83rHrp6DULNdfWEGAoaZqXDkLTA=; b=e6fljJZPdXe48LnKcHFbNBszS4ElqY1pOjPrRQGFDVzVT5TzxhNJXkBgEns1lGOoRE H0K9JtPxB9v1S3lYhLq0GRabcyFLB6TSI1jn5H8yKOicbvk050K4MSw2DggsqRXPLXQW QOgngdRpaQRZrGzAjUQwI+fDz4beP/btme6Pa3Wzy1/cMqF/iAV8hgZ/H80dKUSQfF4h zmYm+/Ax4D/E5eIfUz/nABjlCgWnOUhnIoxnKuHQTtuZO5uHofLKqa1hY/OB/QkNSKHm FM99u/TTOu1jQ7WvHqNhW5EmYOzK5jNN7abBIpfEjR7HrPzHQNPDSO6Zvw/t8VIwqZ+Y WxrA== X-Gm-Message-State: APjAAAWwUnlBNGB41MxcWV3MYD3BPofVpjLGjUA+CRLneOj6w2St2Sh2 2mBbPNrbS2gAbs8RTExFqBD1ww== X-Received: by 2002:a2e:575c:: with SMTP id r28mr9849257ljd.245.1574384626222; Thu, 21 Nov 2019 17:03:46 -0800 (PST) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id s27sm2253515lfc.31.2019.11.21.17.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 17:03:45 -0800 (PST) Date: Thu, 21 Nov 2019 17:03:35 -0800 From: Jakub Kicinski To: Haiyang Zhang Cc: "sashal@kernel.org" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , KY Srinivasan , Stephen Hemminger , "olaf@aepfle.de" , vkuznets , "davem@davemloft.net" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net,v2 1/2] hv_netvsc: Fix offset usage in netvsc_send_table() Message-ID: <20191121170335.2f73792d@cakuba.netronome.com> In-Reply-To: References: <1574372021-29439-1-git-send-email-haiyangz@microsoft.com> <1574372021-29439-2-git-send-email-haiyangz@microsoft.com> <20191121150445.47fc3358@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Nov 2019 00:54:20 +0000, Haiyang Zhang wrote: > > > > > > - tab = (u32 *)((unsigned long)&nvmsg->msg.v5_msg.send_table + > > > - nvmsg->msg.v5_msg.send_table.offset); > > > + if (offset > msglen - count * sizeof(u32)) { > > > > Can't this underflow now? What if msglen is small? > msglen came from the vmbus container message. We trust it to be big > enough for the data region. Ok, it looked like it was read from some descriptor which could potentially be controlled by "the other side" but I trust your judgement :) Both patches LGTM, then.