From mboxrd@z Thu Jan 1 00:00:00 1970 From: Auger Eric Subject: Re: [PATCH 1/2] vfio: platform: Fix reset module leak in error path Date: Mon, 26 Feb 2018 10:47:41 +0100 Message-ID: <9c79c6ba-c3a8-68f3-4ac6-00858bd1ccb5@redhat.com> References: <1518539815-13774-1-git-send-email-geert+renesas@glider.be> <1518539815-13774-2-git-send-email-geert+renesas@glider.be> <2fe86be6-a3e2-9bd6-1d72-63cf0fe3a731@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Geert Uytterhoeven Cc: Geert Uytterhoeven , Baptiste Reynal , Alex Williamson , Philipp Zabel , Rob Herring , Mark Rutland , KVM list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-Renesas , Linux Kernel Mailing List List-Id: devicetree@vger.kernel.org Hi Geert, On 21/02/18 17:07, Geert Uytterhoeven wrote: > Hi Eric, > > On Wed, Feb 14, 2018 at 10:32 AM, Geert Uytterhoeven > wrote: >> On Wed, Feb 14, 2018 at 9:36 AM, Auger Eric wrote: >>> If I am not wrong we also leak the reset_module if >>> vfio_platform_get_reset() fails to find the reset function (of_reset == >>> NULL), in which case we should do the module_put() in >>> vfio_platform_get_reset(). >> >> Correct. Will look into fixing it... > > Upon second look, I don't think there's a leak in vfio_platform_get_reset(). > > If try_module_get() succeeded, there will always be a valid reset function > (unless someone registered a vfio_reset_handler with a NULL reset function). Hum yes, you are right. So the code is fine as is. Sorry for the noise. Thanks Eric > > Or do you mean the call to request_module()? > That one doesn't do a module_get(), it merely tries to load a module. > Hence there's no need to do a module_put() afterwards. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds >