From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754548AbbIHKjw (ORCPT ); Tue, 8 Sep 2015 06:39:52 -0400 Received: from avasout03.plus.net ([84.93.230.244]:43099 "EHLO avasout03.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754003AbbIHKjt (ORCPT ); Tue, 8 Sep 2015 06:39:49 -0400 X-Greylist: delayed 455 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Sep 2015 06:39:48 EDT X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=c6lWOkJl c=1 sm=1 tr=0 a=pJbiMua1b6Mba1+/ijXaqw==:117 a=pJbiMua1b6Mba1+/ijXaqw==:17 a=k3qmffNXAAAA:8 a=0Bzu9jTXAAAA:8 a=N659UExz7-8A:10 a=ff-B7xzCdYMA:10 a=pGLkceISAAAA:8 a=lUebfztndsWPHqD1ObcA:9 a=pILNOxqGKmIA:10 Message-ID: <55EEB927.1080508@kynesim.co.uk> Date: Tue, 08 Sep 2015 11:32:07 +0100 From: Richard Watts User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Leon Yu , Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] tty: don't leak cdev in tty_cdev_add() References: <1441631317-6238-1-git-send-email-chianglungyu@gmail.com> In-Reply-To: <1441631317-6238-1-git-send-email-chianglungyu@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SA-Score: 0.9 X-SA-Score-Int: 9 X-SA-Report: Spam detection software, running on the system "mohican.kynesim.co.uk", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: On 07/09/15 14:08, Leon Yu wrote: > Commit a3a10ce3429e ("Avoid usb reset crashes by making tty_io cdevs truly > dynamic") which mixes using cdev_alloc() and cdev_init() is problematic. > Subsequent call to cdev_init() after cdev_alloc() sets kobj release method > from cdev_dynamic_release() to cdev_default_release() and thus makes it > impossible to free allocated cdev. > > This patch also consolidates error path of cdev_add() as cdev can also leak > here if things went wrong. > > Signed-off-by: Leon Yu > Fixes: a3a10ce3429e ("Avoid usb reset crashes by making tty_io cdevs truly dynamic") [...] Content analysis details: (0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.4 DNS_FROM_AHBL_RHSBL RBL: Envelope sender listed in dnsbl.ahbl.org [listed in kynesim.co.uk.rhsbl.ahbl.org. IN] [A] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/09/15 14:08, Leon Yu wrote: > Commit a3a10ce3429e ("Avoid usb reset crashes by making tty_io cdevs truly > dynamic") which mixes using cdev_alloc() and cdev_init() is problematic. > Subsequent call to cdev_init() after cdev_alloc() sets kobj release method > from cdev_dynamic_release() to cdev_default_release() and thus makes it > impossible to free allocated cdev. > > This patch also consolidates error path of cdev_add() as cdev can also leak > here if things went wrong. > > Signed-off-by: Leon Yu > Fixes: a3a10ce3429e ("Avoid usb reset crashes by making tty_io cdevs truly dynamic") Oops! Apologies. Looks good to me - thank you. Acked-by: Richard Watts Richard.