Received: by 2002:ac8:4602:0:b0:405:464a:c27a with SMTP id p2csp2536548qtn; Tue, 25 Jul 2023 11:34:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/GjYg/SyLhkpstIW8oct0BVqfizJSxV42D7MhIieIFeId7s0aVSR0+Dlf9IT0zaF9J43K X-Received: by 2002:a17:902:7787:b0:1b9:f97a:16ab with SMTP id o7-20020a170902778700b001b9f97a16abmr72341pll.57.1690310050489; Tue, 25 Jul 2023 11:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690310050; cv=none; d=google.com; s=arc-20160816; b=pEyD/Tv54T9/RJKvYYkhh9bywhgkQHCED2kH/VGW6/HdV/akEgAGiR06huej28Ql/F 5SA0+BJzLLY20SVfoXCwuJrK2n0HAYlY5mxL6sHS5Wzvm35YnX+48/jRNoLNY2DCoHfk g29YfNiDrTUtRrq4Ek8zMUpkWzNt8vyvSHDXjXwE+jHRGCVHjSpyasTKyuBCp4Bb9AgW XUpq28R1aQA150QiJnpAmqMdkohJZKZW4HtD2kvuP41Yn+TbJFgmXaRsXkwAwkNfYr16 sqwp+a903waba3OlGg3XL3ckUybZu6csLaEMIUnlLFzAX2UVFLHCCwdJuDW3rGrrrRt8 9ZZw== 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=Xbds6RC4+zmMm8S6mNyiiv6mc/Jhy2JAc61bU2x/U1k=; fh=8nBWZbT6HMHubtHHd8IzkZgCrQUggc0mHHXc9tiMbbQ=; b=ZaG4LoL11r3CUYLM1MpnU/wTfBTSmfe8TefsPoiAcYECEwbP6if1HCG3gqas59gCPb ikL3IyXQktVFqHaRoIsUw5pfym275ARE7Kal4fDX3/6GqxYL8vyHX6+MKWIvpjHsyXL8 eVRfE/XmKLs5qmzrfoopgDaI1snrhuuVNNQvxe8escphuLKeiwaacRabdt63E2URkm9B 8IGMW/AcTEnX+CHCLDjQmg4jB6WuFlyAEdw94aMu+c4V78+Em9l2Ppac3fV/+kTR/3+u drqTRrNHx1kQgH3r++TwQ/rHruAIDM3971zieB+nfVbcSQz7NRQHxryT5Wnp+NS5wkWD WVsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LoNLPvSE; 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 o11-20020a170902d4cb00b001b69ede5b79si12725082plg.470.2023.07.25.11.33.57; Tue, 25 Jul 2023 11:34:10 -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=LoNLPvSE; 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 S231536AbjGYR1n (ORCPT + 99 others); Tue, 25 Jul 2023 13:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbjGYR1l (ORCPT ); Tue, 25 Jul 2023 13:27:41 -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 701031BD5 for ; Tue, 25 Jul 2023 10:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690306016; 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=Xbds6RC4+zmMm8S6mNyiiv6mc/Jhy2JAc61bU2x/U1k=; b=LoNLPvSEnYS+rWqHkbngoK0LD6nL7fQD0bGjo941qN5NRnG66eosRXcoumUpWW8gYGtWWj Ai5VtHeNGmIH5xpaO/d4j0LrVp39jtkc6sNQBXNGg7de4p5y5k5GnoH6VpKeHKTHhy+ddL 9JtPxOrcGlaxad5v6Msg3JsD+akt7jE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-Eke6rSJ1N4W5UsDSgFaWyQ-1; Tue, 25 Jul 2023 13:26:51 -0400 X-MC-Unique: Eke6rSJ1N4W5UsDSgFaWyQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43AD9858F1E; Tue, 25 Jul 2023 17:26:50 +0000 (UTC) Received: from rhel-developer-toolbox-latest (unknown [10.2.16.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BFB9C2C856; Tue, 25 Jul 2023 17:26:49 +0000 (UTC) Date: Tue, 25 Jul 2023 10:26:47 -0700 From: Chris Leech To: Lin Ma Cc: lduncan@suse.com, michael.christie@oracle.com, jejb@linux.ibm.com, martin.petersen@oracle.com, vikas.chaudhary@qlogic.com, JBottomley@parallels.com, mchan@broadcom.com, benli@broadcom.com, ogerlitz@voltaire.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] scsi: iscsi: Add strlen check in iscsi_if_set_{host}_param Message-ID: References: <20230725024545.428519-1-linma@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725024545.428519-1-linma@zju.edu.cn> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=unavailable 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 Tue, Jul 25, 2023 at 10:45:45AM +0800, Lin Ma wrote: > The function iscsi_if_set_param and iscsi_if_set_host_param converts > nlattr payload to type char* and then call C string handling functions > like sscanf and kstrdup. > > char *data = (char*)ev + sizeof(*ev); > ... > sscanf(data, "%d", &value); > > However, since the nlattr is provided by the user-space program and > the nlmsg skb is allocated with GFP_KERNEL instead of GFP_ZERO flag > (see netlink_alloc_large_skb in netlink_sendmsg), the dirty data > remained in the heap can cause OOB read for those string handling > functions. Reviewed-by: Chris Leech