Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609338

Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*()

Path csiph.com!news.redatomik.org!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Russell King - ARM Linux <linux@armlinux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*()
Date Sun, 26 Mar 2017 17:00:02 +0200
Message-ID <tphOa-1js-3@gated-at.bofh.it> (permalink)
References <tphEt-1ge-5@gated-at.bofh.it> <tphEt-1ge-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=QehwSstPt7Qm2KmfXpFwqjgktivbKcFu/4APAdB81aM=; b=Fz+H6KJUlLEFVh/AfAeuSYuEG8x94VqAktko65Vp1B0JwSnQTGQOvB65F91K69vJHerl7+G8XrYUUp1SutdEjv6tL7Z2U8MmeihVjp4nBluurvq2XXtcN895EGOn5SeS95xdhSCDcwEUyZxuK9Mt07eZe3zDlVI+9zk7+id4FtU=;
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 25
Organization linux.* mail to news gateway
X-Original-Cc Dmitry Torokhov <dmitry.torokhov@gmail.com>, Alessandro Zummo <a.zummo@towertech.it>, Alexandre Belloni <alexandre.belloni@free-electrons.com>, Linus Walleij <linus.walleij@linaro.org>, Baptiste Reynal <b.reynal@virtualopensystems.com>, Alex Williamson <alex.williamson@redhat.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, 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
X-Original-Date Sun, 26 Mar 2017 15:50:24 +0100
X-Original-Message-ID <20170326145023.GO7909@n2100.armlinux.org.uk>
X-Original-References <1490539314-9681-1-git-send-email-leo.yan@linaro.org> <1490539314-9681-2-git-send-email-leo.yan@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1609338

Show key headers only | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] Input: ambakmi - Convert to use devm_*() Leo Yan <leo.yan@linaro.org> - 2017-03-26 16:50 +0200
  Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-26 17:00 +0200
    Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Leo Yan <leo.yan@linaro.org> - 2017-03-26 17:40 +0200

csiph-web