Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8517267rwp; Wed, 19 Jul 2023 10:56:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlE3pKbruDDTPctm803fvvCFgZiGxVdVu1f0T/m3SSVx1QEfixCA99YYJ9VplYjMQFRD1KMl X-Received: by 2002:a05:6402:1ad1:b0:51d:a02d:f8fe with SMTP id ba17-20020a0564021ad100b0051da02df8femr2671664edb.29.1689789406585; Wed, 19 Jul 2023 10:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689789406; cv=none; d=google.com; s=arc-20160816; b=WXFZV+hbzyDiSms55iyzkWqz6BhWp3QBYKyg0LqtrBFPt3VWv117s9yuPTYrNx1rGu Asp6VHo8tlkCuUApxeyCFi9hEsd/sCWPUdoaupMJs4/qAw7aif8fJVJu8thXi09YCoNZ JGQdBwSJjhap6mnUWTe/Zj1w/XYJoHgEn19pKts63d8OfBpb/HLEWeKxL1p9p2t9CHhG Mh9nOUz8pJirKSU8NyVH68ho22nKFagvSaZtwyIoRkcVg+RZydSK/BWF3dol3zwMjk0t KNAlkskV88c/Ryl7/TVX9kaTY/TYPdnSiQ2QNX3TeCVKajFdpsGschPdxC7oSWYin6kn uDaw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=foCsuTlaTYiUdT0EoYTewi4VWmF5exv07sKx0Z3C8eQ=; fh=zLJKX52TPis7a2ErFVl0vrNBKBh+wlMvI6izaUXULfI=; b=chHvTHojassY763Y1fnVYKCYRF6lbJHdDOwJwB1mMTuv8ngNr8d/aqGi0JihiXH1dG wYnF64HHWemqawFhBR5DFvM8tDfsvMJbig0B1CDJxgu6Yd68qeST1G0ZjAGaoF1T1sh3 g+Q4ZJLR0JTo6BM6CtSgpJ14cDh5h0WkP5PaaU4IqOR3ffNeBgytlLdLrT1X6y8W5/eb zJ1TCsGoiqMiQUrg6anxp1oJXOVszNbMiD3dETy/7eBchIPqZX92I8kOwdYZ2542T2pB GczbqQisS5/2wl/bVIMHrVdmnlnACQPnOtpEzzjYHns7yxf1/MryBZXsVFzNCYaLXhvy I8dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZcSuv3Nw; 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 u2-20020aa7d542000000b0051e065bbc1dsi3631087edr.36.2023.07.19.10.56.22; Wed, 19 Jul 2023 10:56:46 -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=ZcSuv3Nw; 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 S229994AbjGSRsn (ORCPT + 99 others); Wed, 19 Jul 2023 13:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjGSRsm (ORCPT ); Wed, 19 Jul 2023 13:48:42 -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 4915C1FE8 for ; Wed, 19 Jul 2023 10:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689788875; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=foCsuTlaTYiUdT0EoYTewi4VWmF5exv07sKx0Z3C8eQ=; b=ZcSuv3Nwa+uIwaZ6rz23RgVjgKsaFSoze1k/K+MSRxd1pOjifcQKM6RaOCh5y60AwmeMoz DpCnP3YYHZuozt3YvSt+cPw5pTX/YBmiTRv7f4Ig+VtxBwCJigdabYlkfevpCROPenE4RO OUzlOzA5l5MoRZsFYe8BuTkFo+G1V1I= 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-370-xkW-L1d9OOmgSjrP5mDVdg-1; Wed, 19 Jul 2023 13:47:49 -0400 X-MC-Unique: xkW-L1d9OOmgSjrP5mDVdg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58BDE2800174; Wed, 19 Jul 2023 17:47:48 +0000 (UTC) Received: from rhel-developer-toolbox-latest (unknown [10.2.16.238]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79E962166B25; Wed, 19 Jul 2023 17:47:47 +0000 (UTC) Date: Wed, 19 Jul 2023 10:47:45 -0700 From: Chris Leech To: =?utf-8?B?5p2c5pWP5p2w?= Cc: Lee Duncan , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , "open list:ISCSI" , "open list:ISCSI" , open list , "opensource.kernel" Subject: Re: [PATCH v2] scsi: iscsi: kfree_sensitive() in iscsi_session_free() Message-ID: References: <20230719074534.5311-1-duminjie@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230719074534.5311-1-duminjie@vivo.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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_BLOCKED,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 Wed, Jul 19, 2023 at 07:45:48AM +0000, 杜敏杰 wrote: > session might contain private part of the password, so better use > kfree_sensitive() to free it. > In iscsi_session_free() use kfree_sensitive() to free session->password, > session->password_in, session->username, session->username_in. > > Signed-off-by: Minjie Du This looks good, thank you for the follow up to Mike's review. Reviewed-by: Chris Leech > --- > drivers/scsi/libiscsi.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c > index 0fda8905e..a307da898 100644 > --- a/drivers/scsi/libiscsi.c > +++ b/drivers/scsi/libiscsi.c > @@ -3132,10 +3132,10 @@ void iscsi_session_free(struct iscsi_cls_session *cls_session) > struct module *owner = cls_session->transport->owner; > > iscsi_pool_free(&session->cmdpool); > - kfree(session->password); > - kfree(session->password_in); > - kfree(session->username); > - kfree(session->username_in); > + kfree_sensitive(session->password); > + kfree_sensitive(session->password_in); > + kfree_sensitive(session->username); > + kfree_sensitive(session->username_in); > kfree(session->targetname); > kfree(session->targetalias); > kfree(session->initiatorname); > -- > 2.39.0 >