From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Sender: rtc-linux@googlegroups.com Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com. [2a00:1450:400c:c0c::235]) by gmr-mx.google.com with ESMTPS id q207si716764wme.3.2017.03.26.08.24.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Mar 2017 08:24:05 -0700 (PDT) Received: by mail-wr0-x235.google.com with SMTP id w43so11846674wrb.0 for ; Sun, 26 Mar 2017 08:24:05 -0700 (PDT) Date: Sun, 26 Mar 2017 23:23:54 +0800 From: Leo Yan To: Russell King - ARM Linux Cc: Dmitry Torokhov , Alessandro Zummo , Alexandre Belloni , Linus Walleij , Baptiste Reynal , Alex Williamson , Jaroslav Kysela , Takashi Iwai , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, alsa-devel@alsa-project.org Subject: [rtc-linux] Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Message-ID: <20170326152354.GA11555@leoy-linaro> References: <1490539314-9681-1-git-send-email-leo.yan@linaro.org> <1490539314-9681-2-git-send-email-leo.yan@linaro.org> <20170326145023.GO7909@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 In-Reply-To: <20170326145023.GO7909@n2100.armlinux.org.uk> Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On Sun, Mar 26, 2017 at 03:50:24PM +0100, Russell King - ARM Linux wrote: > 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. Thanks for reviewing. Now I understood and please ignore this patch and patch 0005. Thanks, Leo Yan -- 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@googlegroups.com. For more options, visit https://groups.google.com/d/optout.