Received: by 2002:a05:622a:a038:b0:405:55f2:b071 with SMTP id jt56csp2315172qtb; Tue, 25 Jul 2023 11:37:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2SwXIES94VNHdqDy14Gs13YrQKUH3EnNVXeCzzBv2vhfKn15yb7ztmmtpg9MaUCknMevF X-Received: by 2002:a17:902:b582:b0:1bb:1e69:28be with SMTP id a2-20020a170902b58200b001bb1e6928bemr60850pls.42.1690310278824; Tue, 25 Jul 2023 11:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690310278; cv=none; d=google.com; s=arc-20160816; b=Ntzj54KfTiawWhcAZ/EKYWMyJ/8atxlKZ9QciiPfCeI43Sb8r85Jf+YyLJvhf87JgP K6NXMWVrXx5Zkde9GJYxQ50VX4OoSA47OPoLtcMsAadpitUZ9Y30ZXHr6YNgklURzaES b0hWNeJLoZaI83Bz/QIUNJ4kXy2UC/2Pvef9zp9C/dRp89v6vrJ1HX8CFGiTxxj7W6j9 ny+1Yjf+h/EmQJPQG+sd/weqqJSgZMH8dAZa2MN0e5Bzf5EhpJw8+KcJMgGNO7rP1LJm w6jpRbVjVFJGNLuq4MVuoxaz1uXEfwm80VBNZ4VktNkOkahur7POzGFWxxRAi4Jj8tjJ 8kEg== 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=/+/nqT6fQIVWmc2UMyym2/MQImAiAAqOHD7/JM8jKDc=; fh=Ow80u87wYIHuG+YYXp2greoNNkHRio9pDOIcbHj+BXQ=; b=rHDgIVHYvqyOMngzfOfSlLBT4ukDlC9Dnlc5KBbYS+ABgiQzqP6t9lQimMalNTCIlY qvqYjFdB+XXI4/RFkRIpb0e/PU5rKS7xhWgOuOQPppdJu3W5K8TGBiQkGbi80mXCrxVz 6tjW82u+Ekc3O2QUNpuHoLqi36yMjCxurxRI1lYAtZ2WAijlZvT1ZtpBenG3w5TQS4zl 9vZ+Rt8jM+pM4g1KpkHTyrktMsdd6pHDBDw4CdWYTFJIkyjl8gX7bowZZWzvgABzef3b i2XNM0rEq/r5AJFmQenAAD2CINfL+R8mUJ04leTYbgwyuhNNQMoTiqZo7M0owGW5SN+F Vi7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gfBvc5xG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a17090264d600b001bb8c814915si6923520pli.83.2023.07.25.11.37.46; Tue, 25 Jul 2023 11:37:58 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gfBvc5xG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbjGYR23 (ORCPT + 99 others); Tue, 25 Jul 2023 13:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjGYR21 (ORCPT ); Tue, 25 Jul 2023 13:28:27 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFC31BFE for ; Tue, 25 Jul 2023 10:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690306061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/+/nqT6fQIVWmc2UMyym2/MQImAiAAqOHD7/JM8jKDc=; b=gfBvc5xG2My8swRxiomtc+VjwURC1Spre7Q1oNcDb5JFD3XKs8WzP6Irbl3m2ODTcXqLqh YGeeroxl4ZG/M1/9VmTMxDkMr3ZgE2J78yHg6rlw2vhC89ll6AHepJr2v5FdmP/zUeMKre IEuTfR9dFhmNXI8kIisQuHHXhZy0HQg= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-462-RHfb8bl_MICdb88O3e95xQ-1; Tue, 25 Jul 2023 13:27:38 -0400 X-MC-Unique: RHfb8bl_MICdb88O3e95xQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3E9D29A9D28; Tue, 25 Jul 2023 17:27:37 +0000 (UTC) Received: from rhel-developer-toolbox-latest (unknown [10.2.16.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E2A9492C13; Tue, 25 Jul 2023 17:27:36 +0000 (UTC) Date: Tue, 25 Jul 2023 10:27:34 -0700 From: Chris Leech To: Lin Ma Cc: ketan.mukadam@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] scsi: be2iscsi: Add length check when parsing nlattrs Message-ID: References: <20230723075938.3713864-1-linma@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230723075938.3713864-1-linma@zju.edu.cn> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On Sun, Jul 23, 2023 at 03:59:38PM +0800, Lin Ma wrote: > beiscsi_iface_set_param parses nlattr with nla_for_each_attr and assumes > every attributes can be viewed as struct iscsi_iface_param_info. > > This is not true because there is no any nla_policy to validate the > attributes passed from the upper function iscsi_set_iface_params. > > This patch adds the nla_len check before accessing the nlattr data and > error return EINVAL if the length check fails. Reviewed-by: Chris Leech