From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King - ARM Linux Subject: Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Date: Sun, 26 Mar 2017 15:50:24 +0100 Message-ID: <20170326145023.GO7909@n2100.armlinux.org.uk> References: <1490539314-9681-1-git-send-email-leo.yan@linaro.org> <1490539314-9681-2-git-send-email-leo.yan@linaro.org> Reply-To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Content-Disposition: inline In-Reply-To: <1490539314-9681-2-git-send-email-leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Sender: Russell King - ARM Linux List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Leo Yan Cc: Dmitry Torokhov , Alessandro Zummo , Alexandre Belloni , Linus Walleij , Baptiste Reynal , Alex Williamson , Jaroslav Kysela , Takashi Iwai , linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org List-Id: linux-input@vger.kernel.org On Sun, Mar 26, 2017 at 10:41:50PM +0800, Leo Yan wrote: > Convert driver to use devm_*() APIs so rely on driver model core layer > to manage resources. This eliminates error path boilerplate and makes > code neat. > > This patch also fixes the memory leakage for 'kmi->io' when remove > module. No, it is not leaked, in fact, your patch introduces a use-after-free bug. kmi->io is of type "struct serio", and this structure has an embedded "struct device". The lifetime of any structure containing a "struct device" is controlled by the lifetime of the struct device. Once serio_register_port() has been called on it, it is up to the serio layer to free this structure. Therefore, your patch creates a bug, and so it gets a NAK. There is no resource leakage here. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout.