From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754562Ab0JBK2m (ORCPT ); Sat, 2 Oct 2010 06:28:42 -0400 Received: from mail-ww0-f42.google.com ([74.125.82.42]:39965 "EHLO mail-ww0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595Ab0JBK2l convert rfc822-to-8bit (ORCPT ); Sat, 2 Oct 2010 06:28:41 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=w/pwaAJwTxTk9bBbY4lmoSGiaXkfXuOfSDJ8HoyCdGPlAIlHN/oxoBSqU/l+2OKvGM CRLHT5PFIchWLZwiisuEJhVjxcUnxECNxG026YAi0F5svLGuAR5E2YGM5pI6EEUz5U5k OyFEqUP6967+YSRttwsMXr+X6CoqyTXBEbVy0= MIME-Version: 1.0 In-Reply-To: References: <1286002121-3694-1-git-send-email-rahul.ruikar@gmail.com> Date: Sat, 2 Oct 2010 18:28:39 +0800 Message-ID: Subject: Re: [PATCH] usb: core: endpoint: Fix error path From: Ming Lei To: Rahul Ruikar Cc: Greg Kroah-Hartman , Tejun Heo , asanchez@neurowork.net, rjw@sisk.pl, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2010/10/2 Rahul Ruikar : > Thanks Ming. > I have certain doubts related to device_unregister() > > In some of USB related code.. > kfree() is called after device_unregister() ...  device_unregister() > also internally calls put_device()... is that correct behavior or I'm > missing something here.. If no other external reference to device before put_device in device_unregister, dev.release will be called from put_device to free something, which depends on your implement for dev.release. > ex. > file : drivers/usb/gadget/fsl_udc_core.c > function : static int __init fsl_udc_probe(struct platform_device *pdev) Once reaches err_unregister, double free of udc_controller may be triggered, so fix should be needed. -- Lei Ming