Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1951355pxu; Sun, 13 Dec 2020 08:35:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLKT7oKLndSQFf/7a0Yo7CD01CJRP9JATyLuBTo6OJWfDX0tHXf+hvKPBhdF5zwDfhR+Pt X-Received: by 2002:aa7:c919:: with SMTP id b25mr20592989edt.108.1607877301531; Sun, 13 Dec 2020 08:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607877301; cv=none; d=google.com; s=arc-20160816; b=aaWxbuMlo4SNilKVVEvzAYI6rgrhzoMMpbixzKzYXXYLuYj+06iqAgGFTwJT4WXZ8r QKh2VbOYk9RVS3RbWrs4+4TAS/BqzDgoBpKfb6btf+LRw316q+1c4DWSMXeRIldbV1II 1oDIwZAt7/bPVyiHpP0rJl1+ixooBzbpg16iuz7972XgGeKWUjZnBKKMILmeMMA2zqnJ me9KlhNZP48DNlPq7l0YFrke3KhZSGqKDyb0DBlVJ528q+tAFoMOXIlRqqCFgs7YSscq u3GdQt32gZdH2RfNNDQgZ4WOUZ6vAhaHB/X/VO1t884IMmtNxi2rPYyiv6JddcgpM5zP PeEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kVgdL2B7MTt0Fzgc35wnEsVqokD6iC4w8zTszx314Y4=; b=WiQJzCVagysdk+2aUQ8nozRo2JwDuPj414F24rPMmk2tKCcHdiy99YFSxEZU7qCCi0 bYmmysc4QzpOoTM3lDXI0j9tm61SEinQI6m8H8aFtJrRX6xvZwebxGDIQDKGEo9XrrUI PkZxNg+aGP2MCE0u3IIn9StdMvkbCEEk53kYd+Zvh4PzbmKFfYLpi0g0lZeY7Yrhf3HA 095rBNDXprXEDeUldGwckJkHjCaL02OsAbAGypEBDzXJAnIZIQaeCPCfVUGg+phFeef6 4axCrPRZYjGJKk96aGJVK1/+Gnq1D5NPZJAPJwabAmTaveQ0YhEgsiP2/TY0ee09wrpR QS/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Du9m54Pj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si9736979edp.592.2020.12.13.08.34.38; Sun, 13 Dec 2020 08:35:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Du9m54Pj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404839AbgLLSJv (ORCPT + 99 others); Sat, 12 Dec 2020 13:09:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbgLLSJv (ORCPT ); Sat, 12 Dec 2020 13:09:51 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D4CC0613CF; Sat, 12 Dec 2020 10:09:10 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id f23so16895926ejk.2; Sat, 12 Dec 2020 10:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kVgdL2B7MTt0Fzgc35wnEsVqokD6iC4w8zTszx314Y4=; b=Du9m54PjDwlP5wo1ECsQM6S8frjG935mP18a3g5nrtzcEV+xYnN5xCLt6+sqqS9bma hKAgdp0WegfNrDEzBWk5y7bh1Tbrz/fyn7NkB1u3vXH8mT8Wp6R1T/0xjMjndFgJF7AA KOiuU00unQgQb/xYtLrtykxXv6GwE6TPpfSERfxhtxwk/gZBqR1iGifOWsQTqg2e3M88 oAIscXj8U3h0yT/SXHdbSQOB+dDzUM8UU/v+ftUh751M5mLrd7uzNaSnOew6RVqpNgrv +4NpVCYYdhRnP/uyfh7CEKllsNCPtZdlAENaU7BPJepX52V79m6PR0sVdM6iaA154bFA 2Fjw== 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:references :mime-version:content-disposition:in-reply-to; bh=kVgdL2B7MTt0Fzgc35wnEsVqokD6iC4w8zTszx314Y4=; b=osUTqAmMwmQ5D66rpDLxfoIq2Jm4/Evzk7y0tohPCQIsw5jMOuhZFY4eQ+3VQW8vkR VNHJrFtzfAx+yWRki6Ct9CTlEIZs1A5UW5YxY40KTSi19f8SiFMj0GOh3hBA3+nx8An7 B7x4ZkdBXvz6sxYINOU6fD/Y7G5D2lm4yxgXDdlxg9EcPjo+QPxjyBVv7Tk/zeuG8T9w OY0lvVKZwes1uOvqRL6jlD570Hrb6HXlfiK7LBSsGfmTCjk3zSsgbdXVdVoGUetFyPtk 0Yj65fq0LH0rh9v/CZqUhyknH66iOG6bh55VLfHdYWNZWF8CJJ+yE5hr8wBwNgMLCsS0 H52Q== X-Gm-Message-State: AOAM532rez46OdsqqvYRwNxARA7TfdtPeugZkFIsb2ErswVakqzPHflO bCLzP5EVAi9oV49XRnxNp2gt6SO+xtqCKA== X-Received: by 2002:a17:906:c244:: with SMTP id bl4mr15408500ejb.430.1607796548785; Sat, 12 Dec 2020 10:09:08 -0800 (PST) Received: from andrea (host-95-239-64-30.retail.telecomitalia.it. [95.239.64.30]) by smtp.gmail.com with ESMTPSA id c12sm11158312edw.55.2020.12.12.10.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Dec 2020 10:09:08 -0800 (PST) Date: Sat, 12 Dec 2020 19:09:01 +0100 From: Andrea Parri To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Saruhan Karademir , devel@linuxdriverproject.org Subject: Re: [PATCH AUTOSEL 5.9 15/23] scsi: storvsc: Validate length of incoming packet in storvsc_on_channel_callback() Message-ID: <20201212180901.GA19225@andrea> References: <20201212160804.2334982-1-sashal@kernel.org> <20201212160804.2334982-15-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201212160804.2334982-15-sashal@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sasha, On Sat, Dec 12, 2020 at 11:07:56AM -0500, Sasha Levin wrote: > From: "Andrea Parri (Microsoft)" > > [ Upstream commit 3b8c72d076c42bf27284cda7b2b2b522810686f8 ] FYI, we found that this commit introduced a regression and posted a revert: https://lkml.kernel.org/r/20201211131404.21359-1-parri.andrea@gmail.com Same comment for the AUTOSEL 5.4, 4.19 and 4.14 you've just posted. Andrea > > Check that the packet is of the expected size at least, don't copy data > past the packet. > > Link: https://lore.kernel.org/r/20201118145348.109879-1-parri.andrea@gmail.com > Cc: "James E.J. Bottomley" > Cc: "Martin K. Petersen" > Cc: linux-scsi@vger.kernel.org > Reported-by: Saruhan Karademir > Signed-off-by: Andrea Parri (Microsoft) > Signed-off-by: Martin K. Petersen > Signed-off-by: Sasha Levin > --- > drivers/scsi/storvsc_drv.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c > index 8f5f5dc863a4a..6779ee4edfee3 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -1246,6 +1246,11 @@ static void storvsc_on_channel_callback(void *context) > request = (struct storvsc_cmd_request *) > ((unsigned long)desc->trans_id); > > + if (hv_pkt_datalen(desc) < sizeof(struct vstor_packet) - vmscsi_size_delta) { > + dev_err(&device->device, "Invalid packet len\n"); > + continue; > + } > + > if (request == &stor_device->init_request || > request == &stor_device->reset_request) { > memcpy(&request->vstor_packet, packet, > -- > 2.27.0 >