Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp231547ybb; Tue, 14 Apr 2020 23:49:59 -0700 (PDT) X-Google-Smtp-Source: APiQypIVvP81iQV1yudsj+x3TuAdXpdh+qgGFqPvQnFDfBvOhS8tdtuWnZDFc3iixKVeTsyNY9pd X-Received: by 2002:a05:6402:1f6:: with SMTP id i22mr1083959edy.271.1586933399104; Tue, 14 Apr 2020 23:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586933399; cv=none; d=google.com; s=arc-20160816; b=gmz2xB2Kf7ypbFIyRDogLYbPcXOVvxvXElUU5OKBJG0XW7EF/JWi3BNix8sGqo+EXF 4ZuEatqyBvQr2mqq3xmuDeGFuQsEvfrQypUkH9m/CZI3Xyo7da9UZM6y+lDMNs8H8odw nYnXrn/TU5iLcclDO9vTS9tE1cLJAv4qJTdLeeP0q3JvW1mablCb9vhYkDcpfuVImSHN /3yRNvunzp0M6/syTJRlOxs5hdI13bqKUcLIFGLVdPH1V1u1cIQ1i209FqIYh1Jk9Ieq buZutDHml2qt60HnCXgXmHt2NOgklq7R19BGH9oYA1co8pXDlRrSQAp4XcLfDzCkdjGr GG3g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to; bh=GUi9y5OLoY1T7nl1ZZ8JycNOmKwFjwsbUS62JZ2Nhto=; b=f1kNA3MDHl1l/gTmDDJWEEqCgHQnSkF54TA6MqVaw2GayZjwTLI9/yINtOGNhXO5MV IorDDl+jasaGqzLKOUbDSiCbAW4jkSYUx0elQcCYB6c4hx1115bciHX2c+SNUkxp9K3T Vgqfu4Iax+BBIPcWRlvTQJFy5y+6SUGLqezIqtOYO4Zg1wdS52sPbHwHI6aHOwS0DS4Z lI/PVBVBacEiV3zpKTNbwbXw1jSA3W+NFdXukaUG5k23YWxo8ao7gDtSzneWDJ847LOU erYiAkC/ZNN+oZXigg4Ku3Ew49mhB51bz9FEX0img1c7r857hl6w14hdmyQAMxquEZe9 XrfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w29si2265089edi.197.2020.04.14.23.49.35; Tue, 14 Apr 2020 23:49:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390710AbgDNBRq (ORCPT + 99 others); Mon, 13 Apr 2020 21:17:46 -0400 Received: from smtp.infotech.no ([82.134.31.41]:42625 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728669AbgDNBRq (ORCPT ); Mon, 13 Apr 2020 21:17:46 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id A5BA920425A; Tue, 14 Apr 2020 03:17:44 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xdIwwtOfRiW2; Tue, 14 Apr 2020 03:17:38 +0200 (CEST) Received: from [192.168.48.23] (host-23-251-188-50.dyn.295.ca [23.251.188.50]) by smtp.infotech.no (Postfix) with ESMTPA id BEA6E20414B; Tue, 14 Apr 2020 03:17:37 +0200 (CEST) Reply-To: dgilbert@interlog.com Subject: Re: [PATCH] scsi: sg: add sg_remove_request in sg_common_write To: Li Bin , jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, xiexiuqi@huawei.com References: <1586777361-17339-1-git-send-email-huawei.libin@huawei.com> From: Douglas Gilbert Message-ID: <8a19ba1a-1afe-2938-daea-96b1f14570cf@interlog.com> Date: Mon, 13 Apr 2020 21:17:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <1586777361-17339-1-git-send-email-huawei.libin@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-13 7:29 a.m., Li Bin wrote: > If the dxfer_len is greater than 256M that the request is invalid, s/that/then/ > it should call sg_remove_request in sg_common_write. > > Fixes: f930c7043663 ("scsi: sg: only check for dxfer_len greater than 256M") Code fix is fine, please replace the "that" in the first comment line above with "then". Acked-by: Douglas Gilbert > Signed-off-by: Li Bin > --- > drivers/scsi/sg.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index 4e6af592..9c0ee19 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -793,8 +793,10 @@ static int get_sg_io_pack_id(int *pack_id, void __user *buf, size_t count) > "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", > (int) cmnd[0], (int) hp->cmd_len)); > > - if (hp->dxfer_len >= SZ_256M) > + if (hp->dxfer_len >= SZ_256M) { > + sg_remove_request(sfp, srp); > return -EINVAL; > + } > > k = sg_start_req(srp, cmnd); > if (k) { >