Received: by 10.213.65.68 with SMTP id h4csp100989imn; Thu, 15 Mar 2018 10:46:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELsMj9YRpT4JlKTR1GUD8Tvwr80tRGOeiLp0H+D5zDDL5HJjy/vTpYX9jlLtS4j1BJFgH6ye X-Received: by 10.99.36.193 with SMTP id k184mr7334138pgk.80.1521135968964; Thu, 15 Mar 2018 10:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521135968; cv=none; d=google.com; s=arc-20160816; b=qZRvtldDJFPMcWiTQjhGWlOj80r3sMq0CKKNcwFgTgQ2ZYCHNoPTvroPMMulo172lD kHiRdFWM35xdn+hzJ3yO9gv15zNFYkiZsdmli/q/e2O4Z5/Hb/eMN9Q7pVMGRxysmovf KO8nxXnG8Hj/8w+WihjZ69mTIBsTKrdIuv9FImO9pU5i7nNyz/CYRr4b/oqCUgq2Zi9I QT+Ac0yh3aTvYD5MMDIL5Uy/ga25j4hCzvi7my4QWnVHys036A8ruAX64RijPivGCiWP U1a7TGXltMiV0k5k+KXd6g/O8MyNvLQ096W1Y/7GYtagwWqP9IvSRMSKR/VPpfRJIk0q xxkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=TFARXtPKJpCT2a1yqcuUDl32rQJDGj3UL1weO+bwdR4=; b=Bd/RiI8/jacv1UI7eKZA5wR9HzugB6VjN/RJeTCBINZxK5dvQYf29kJjgqJAswZjEY Sz0YCsXzGfFKBgydixNhurfTMgmkeXIQc+a+v+ym1EOr7DuL10CLo+GqRubrdWugqcBu h0+siQmRYhGn7SQsxqeJbNdC7zRj+vWSKLKwjNbqtXEIUtn2px8q8p+Jk9Nbv7Fv3Hrh ed13fnlhOrYBtSLbEduWBoYfQItjwAzSDF1KIwWsAsvficLwY6VvcPjTK0ULU5nTvRaE 4hQyjlVu3++hWOqGsURWlQ8bM8o6aLZgxXSxdJKeeQbmr/qbStUeKvISnKVEzxCHtLjZ nJ7A== 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 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19-v6si4335875plo.652.2018.03.15.10.45.54; Thu, 15 Mar 2018 10:46:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752302AbeCORox (ORCPT + 99 others); Thu, 15 Mar 2018 13:44:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48378 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751372AbeCORow (ORCPT ); Thu, 15 Mar 2018 13:44:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B65DE8182D3A; Thu, 15 Mar 2018 17:44:51 +0000 (UTC) Received: from straylight.hirudinean.org (ovpn-122-26.rdu2.redhat.com [10.10.122.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C40472026E03; Thu, 15 Mar 2018 17:44:50 +0000 (UTC) Date: Thu, 15 Mar 2018 10:44:48 -0700 From: Chris Leech To: Arvind Yadav Cc: lduncan@suse.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-kernel@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org Subject: Re: [PATCH] scsi: scsi_transport_iscsi: use put_device() instead of kfree() Message-ID: <20180315174448.GB32176@straylight.hirudinean.org> Mail-Followup-To: Chris Leech , Arvind Yadav , lduncan@suse.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-kernel@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 15 Mar 2018 17:44:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 15 Mar 2018 17:44:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cleech@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 07, 2018 at 05:07:33PM +0530, Arvind Yadav wrote: > Never directly free @dev after calling device_register(), even > if it returned an error! Always use put_device() to give up the > reference initialized. > > Signed-off-by: Arvind Yadav > --- > drivers/scsi/scsi_transport_iscsi.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) > > @@ -783,7 +781,7 @@ struct iscsi_iface * > > free_iface: > put_device(iface->dev.parent); > - kfree(iface); > + put_device(&iface->dev); > return NULL; > } > EXPORT_SYMBOL_GPL(iscsi_create_iface); Am I reading the device code correctly that the parent reference is only released in the unregister path (device_unregister calls device_del) and so the manual put_device on the parent here is still correct? Just want to make sure that's still needed with the call to put_device. Other than that question, I this all looks good. Thanks. Signed-off-by: Chris Leech