Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4166337ybx; Mon, 4 Nov 2019 08:51:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxPnoo9qgvICI+D5k37pOrJhmqjIsBLnnsD6k6Hxi4n48FSSBMdLNRP1q7zgKaDGTPu3rsV X-Received: by 2002:a17:906:2cca:: with SMTP id r10mr25278218ejr.108.1572886265145; Mon, 04 Nov 2019 08:51:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572886265; cv=none; d=google.com; s=arc-20160816; b=HrUlKINnXgrzzmNtyMj0fjwPv3A3x8ejUram0CoZTn87N25gkfhcj+bd1LvVzQk9Tz so/9NFL86EoEAkWVxp9Wf1xWfir3e7jqW7y4nozKnQMq6V3wBDSqOnK0kDBFuW0NEKPx rLONBXAYxBQzp2YgStVvyvnOR+tSPt06vsUyJ3HKFTcbcNIyrjm8shHTHigptlCxciW1 yBuS2dZ7hjJCb3sCVuTl3WqqeL0Rsjvbu6P0zW7p0jF6XLp4jENHVlA/hYjwbk9fw5YB AHStr1ygyn66Uojd1SbTeZGAHWWwzd4f4L98BnPqpeIEPipownzU7FIrZBuja4+sgCTX jkNA== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=U0hqjWbAZRwnJ5Ou/2L0bueQ8dSveSp9CLL/P7WpZbo=; b=rA6/rnnZoVijLrm2anw1JvigtwaPbibs5YcEr4wmTGk5sPDH7/i314yk5Ydj6aQ0oe jCP27zhc5Vlm0QBWlPM4/jeTdp35RWUO+PUpIqvwSIjr4dHwxe2oox2ZTeQYroyUsofA gMnai8fudVFwIk14QrtqHPh4g7b9vRXevdCYP/xme7fXeYOI0mRD6vASVOxD7MrMfEbm J838mcCUv5J9Ul1YN0Uj5ZxHKP/DrxOmI2QOJV5q833b6HUBQPy+oiGZgafNS1+Gp2+F Xkxb59dxgqSBdaTQkSDOm9ilqRBxH0yKSg8Ilou+o+2cp2lN+1UyIYPMIezyA3LpNZl3 A7LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dqmh+eJh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si8275892edl.273.2019.11.04.08.50.42; Mon, 04 Nov 2019 08:51:05 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=dqmh+eJh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729006AbfKDQtW (ORCPT + 99 others); Mon, 4 Nov 2019 11:49:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:38562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbfKDQtW (ORCPT ); Mon, 4 Nov 2019 11:49:22 -0500 Received: from localhost (host6-102.lan-isdn.imaginet.fr [195.68.6.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1ADE22084D; Mon, 4 Nov 2019 16:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572886161; bh=XDStLaB9lk66yP2fHyiSK2C5nhHNkuFFN93WRiHDWxU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dqmh+eJhR1MbFlFInIjpw0/+T7Vu1RrFei0iezF3KF89WyEkRTtBEjqpc9wZLRPUT NGjhD5uP7MkNtPvb7gb39HqIcCbAy5yt72zlo57gbIbjCZVfPdsc5zxq6Msd/lh2og nlEJHzLk2P+u2J+x2C1qfd+GeSZ3M2TGgHwXtZsY= Date: Mon, 4 Nov 2019 17:49:19 +0100 From: Greg KH To: Jiri Slaby Cc: Xiaoming Ni , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tty:n_gsm.c: destroy port by tty_port_destroy() Message-ID: <20191104164919.GA2282079@kroah.com> References: <1569317156-45850-1-git-send-email-nixiaoming@huawei.com> <1fd7d2eb-7497-254b-b40f-84bc4114f8a3@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1fd7d2eb-7497-254b-b40f-84bc4114f8a3@suse.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 31, 2019 at 11:11:24AM +0100, Jiri Slaby wrote: > On 24. 09. 19, 11:25, Xiaoming Ni wrote: > > According to the comment of tty_port_destroy(): > > When a port was initialized using tty_port_init, one has to destroy > > the port by tty_port_destroy(); > > It continues with a part saying: > Either indirectly by using tty_port refcounting > (tty_port_put) or directly if refcounting is not used. > > > tty_port_init() is called in gsm_dlci_alloc() > > so tty_port_destroy() needs to be called in gsm_dlci_free() > > > > Signed-off-by: Xiaoming Ni > > --- > > drivers/tty/n_gsm.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c > > index 36a3eb4..3f5bcc9 100644 > > --- a/drivers/tty/n_gsm.c > > +++ b/drivers/tty/n_gsm.c > > @@ -1681,6 +1681,7 @@ static void gsm_dlci_free(struct tty_port *port) > > > > del_timer_sync(&dlci->t1); > > dlci->gsm->dlci[dlci->addr] = NULL; > > + tty_port_destroy(&dlci->port); > > This is wrong. gsm_dlci_free is tty_port_operations->destruct, i.e. > n_gsm uses tty_port refcounting and tty_port_destroy was called on this > port in tty_port_destructor already. > > Greg, please revert. Now reverted. sorry about that. greg k-h