[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <566C5EE4.6040402@imap.cc>
Date: Sat, 12 Dec 2015 18:52:36 +0100
From: Tilman Schmidt <tilman@...p.cc>
To: Peter Hurley <peter@...leysoftware.com>
Cc: Paul Bolle <pebolle@...cali.nl>, netdev@...r.kernel.org,
Sasha Levin <sasha.levin@...cle.com>,
syzkaller@...glegroups.com, David Miller <davem@...emloft.net>,
Karsten Keil <isdn@...ux-pingi.de>,
isdn4linux@...tserv.isdn4linux.de,
gigaset307x-common@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] ser_gigaset: fix deallocation of platform device
structure
Hi Peter,
Am 10.12.2015 um 15:04 schrieb Peter Hurley:
>>>> --- a/drivers/isdn/gigaset/ser-gigaset.c
>>>> +++ b/drivers/isdn/gigaset/ser-gigaset.c
>>>> @@ -370,19 +370,23 @@ static void gigaset_freecshw(struct cardstate
>>>> *cs)
>>>> tasklet_kill(&cs->write_tasklet);
>>>> if (!cs->hw.ser)
>>>> return;
>>>> - dev_set_drvdata(&cs->hw.ser->dev.dev, NULL);
>>>> platform_device_unregister(&cs->hw.ser->dev);
>>>> - kfree(cs->hw.ser);
>>>> - cs->hw.ser = NULL;
>>>> }
>>>>
>>>> static void gigaset_device_release(struct device *dev)
>>>> {
>>>> struct platform_device *pdev = to_platform_device(dev);
>>>> + struct cardstate *cs = dev_get_drvdata(dev);
>>>>
>>>> /* adapted from platform_device_release() in
>>>> drivers/base/platform.c */
>>>> kfree(dev->platform_data);
>>>> kfree(pdev->resource);
>>>> +
>>>> + if (!cs)
>>>> + return;
>>>> + dev_set_drvdata(dev, NULL);
>
> This is of marginal value and (I think) unnecessary; it implies
> the core will use the device after release, which would trigger
> many problems if true.
Agreed, but I'm just moving existing code here. Dropping the
dev_set_drvdata() call would be an unrelated change which should be done
in a separate patch if I understand the rules correctly.
Regards,
Tilman
--
Tilman Schmidt E-Mail: tilman@...p.cc
Bonn, Germany
Nous, on a des fleurs et des bougies pour nous protéger.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists