[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180907072056.GB1334@kroah.com>
Date: Fri, 7 Sep 2018 09:20:56 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: dingxiang@...s.chinamobile.com,
Staging subsystem List <devel@...verdev.osuosl.org>,
martyn@...chs.me.uk, manohar.vanga@...il.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vme: remove unneeded kfree
On Thu, Sep 06, 2018 at 10:04:49PM -0700, Linus Torvalds wrote:
> On Thu, Sep 6, 2018 at 1:51 AM Ding Xiang
> <dingxiang@...s.chinamobile.com> wrote:
> >
> > put_device will call vme_dev_release to free vdev, kfree is
> > unnecessary here.
>
> That does seem to be the case. I think "unnecessary" is overly kind,
> it does seem to be a double free.
>
> Looks like the issue was introduced back in 2013 by commit
> def1820d25fa ("vme: add missing put_device() after device_register()
> fails").
>
> It seems you should *either* kfree() the vdev, _or_ do put_device(),
> but doing both seems wrong.
You should only ever call put_device() after you have created the
structure, the documentation should say that somewhere...
> I presume the device_register() has never failed, and this being
> vme-only I'm guessing there isn't a vibrant testing community.
>
> Greg?
It's the correct fix, I'll queue it up soon, thanks.
greg k-h
Powered by blists - more mailing lists