Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1582175pxu; Sat, 12 Dec 2020 18:47:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpjtcRbyfx2RTywCkDLBZVbZa8OG95K+Qg98Omzy+sqK6ZCaEWzT+CYPv4P3gyLCV9mvkL X-Received: by 2002:a17:906:f1c8:: with SMTP id gx8mr17242457ejb.524.1607827673368; Sat, 12 Dec 2020 18:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607827673; cv=none; d=google.com; s=arc-20160816; b=IsQoNK361TIL869DtbgsP0IbN7Wg8TneJbmRcPf0aUoEN7YID64W2yEZ8j6YuEw1t9 CY0GP2UOTOqgjyUDCQwXQoeZkGqpKfhKlawqanRkTHbEkt5q6GitYPFmd0MfuwwdhFRR uUl12EgUEVTvgkWeRYkysBbegVSIb9HdzEJ/GOAXRQ3b6OixasvjzWXPhgNyI5DjsPAv 8dMrvQUf0RXgn1umg5MIDXn7LbfxS7xUTMYehwgCkFX8ooWrF0654yNnm1OQ8xk9RFpN CG8HnWfMy/mFq8cSkgMqCqjdW27+VkBTFXVLht7vfsqIybxYMEIZS+fob36xeF/HgBmx MkkQ== 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:dkim-signature:date; bh=b5oagRO3H3EQau2WCNpLRcRqFKX+Zw7v+u37uOewH5s=; b=f4pibC6p42aLwSLJR3NBOHQ0eEtXWoWmmSXdYPNpa4vDlNClYh+oGyeM0CtnXX1eBf 0gxXLeONjR3EhBeRqcVE67+mDPMnV9EJQwNgxw9Uj1th1drU72mVDJijLVoKuNmkK8d0 eizSDJ79a6GmIsomNCuusK9VHdQ7ZY426a2McqIzcI3b82Lt6eKqmdyUQfFEKU9aD8gG yeLWAZduReOywnu4dum0RnEEz0U+7Nzh6yBv+n7IOHo7itfmO5mW7+de/YyKxoHDVfBX bYpBfnsPRgU/G3Ueqx2+5MTdQ3MbNVfSr6bh2e+MmP4Jt4RvH5d8wZtc0FjK3hYHSfz3 njgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=leJmo82g; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si7345110ejp.606.2020.12.12.18.47.31; Sat, 12 Dec 2020 18:47:53 -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=@kernel.org header.s=k20201202 header.b=leJmo82g; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404288AbgLKUpE (ORCPT + 99 others); Fri, 11 Dec 2020 15:45:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:41274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726648AbgLKUol (ORCPT ); Fri, 11 Dec 2020 15:44:41 -0500 Date: Fri, 11 Dec 2020 12:43:53 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607719435; bh=XcX7+spUVzxQU2kUDRo52Z3TxHXsNz38Q4dbCvUXJLM=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=leJmo82gpXgvmCGOYQOZxcw5lJONE+q+gzxcZb6Yvgt91/lSWgGAG7ZEqYztg4rDC DywMKnin/wrojGutM27uCxaSOnClCmhYmpfLwy2FU8yifm3V5NUCub3aYxzLnix27o npNpFEVOxbbLlI1JJHYM1KL7RuS9VdfEQp+t3FJVeNgc084/hx/fK+yDeJDeB7z56s 6yV05xjabm8hIIhNddTsq5BCqmt3NYUiTdFP7HEXfSjqBMmSohMerZ66wPOsfWClSO 6WMi0d9vPRCNmff9kVB8EiE4sA0jjlM76+NoBcy3TI9MR2Y1DTM3su4qYkLMG4XORY aGylM9LaYE+aw== From: Eric Biggers To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com, cang@codeaurora.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, martin.petersen@oracle.com, stanley.chu@mediatek.com, Jaegeuk Kim Subject: Re: [PATCH] scsi: ufs: fix memory boundary check for UFS 3.0 Message-ID: References: <20201211193814.1709484-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201211193814.1709484-1-jaegeuk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 11:38:14AM -0800, Jaegeuk Kim wrote: > From: Jaegeuk Kim > > If param_offset is greater than what UFS supports, it'll give kernel panic. > > Signed-off-by: Jaegeuk Kim > Change-Id: I48ea6f3f3074bd42abf4ecf8be87806732f3e6a3 > --- > drivers/scsi/ufs/ufshcd.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index d6a3a0ba6960..04687661d0df 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -3194,6 +3194,9 @@ int ufshcd_read_desc_param(struct ufs_hba *hba, > return -EINVAL; > } > > + if (param_offset > buff_len) > + return -EINVAL; > + > /* Check whether we need temp memory */ > if (param_offset != 0 || param_size < buff_len) { > desc_buf = kmalloc(buff_len, GFP_KERNEL); > -- Didn't this already get fixed by: commit 1699f980d87fb678a669490462cf0b9517c1fb47 Author: Can Guo Date: Wed Oct 21 22:59:00 2020 -0700 scsi: ufs: Fix unexpected values from ufshcd_read_desc_param()