[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FA47D36D6EC9FE4CB463299737C09B9901B6467C@SHSMSX102.ccr.corp.intel.com>
Date: Mon, 4 Nov 2013 02:07:32 +0000
From: "Wang, Xiaoming" <xiaoming.wang@...el.com>
To: Chanwoo Choi <cw00.choi@...sung.com>
CC: "myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Liu, Chuansheng" <chuansheng.liu@...el.com>,
"Zhang, Dongxing" <dongxing.zhang@...el.com>
Subject: RE: [PATCH] [extcon]:remove freed groups caused the panic or
warning in unregister flow
Dear Choi
-----Original Message-----
From: Chanwoo Choi [mailto:cw00.choi@...sung.com]
Sent: Monday, November 04, 2013 9:43 AM
To: Wang, Xiaoming
Cc: myungjoo.ham@...sung.com; linux-kernel@...r.kernel.org; Liu, Chuansheng; Zhang, Dongxing
Subject: Re: [PATCH] [extcon]:remove freed groups caused the panic or warning in unregister flow
Hi Wang,
> drivers/extcon/extcon-class.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/extcon/extcon-class.c
> b/drivers/extcon/extcon-class.c index 148382f..48f4669 100644
> --- a/drivers/extcon/extcon-class.c
> +++ b/drivers/extcon/extcon-class.c
> @@ -794,6 +794,8 @@ void extcon_dev_unregister(struct extcon_dev *edev)
> return;
> }
>
> + device_unregister(edev->dev);
> +
> if (edev->mutually_exclusive && edev->max_supported) {
> for (index = 0; edev->mutually_exclusive[index];
> index++)
> @@ -814,7 +816,6 @@ void extcon_dev_unregister(struct extcon_dev *edev)
> if (switch_class)
> class_compat_remove_link(switch_class, edev->dev, NULL); #endif
> - device_unregister(edev->dev);
> put_device(edev->dev);
> }
> EXPORT_SYMBOL_GPL(extcon_dev_unregister);
>
I think we could only apply following patch instead of moving the position of device_unregister().
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 148382f..ff27b19 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -805,10 +805,8 @@ void extcon_dev_unregister(struct extcon_dev *edev)
for (index = 0; index < edev->max_supported; index++)
kfree(edev->cables[index].attr_g.name);
- if (edev->max_supported) {
- kfree(edev->extcon_dev_type.groups);
+ if (edev->max_supported)
kfree(edev->cables);
- }
#if defined(CONFIG_ANDROID)
if (switch_class)
Thanks,
Chanwoo Choi
I don't agree with you.
Why do not you want moving the position of device_unregister()?
It will cause the memory leak if has not kfree edev->extcon_dev_type.groups as your patch do firstly. And if you think kfree edev->extcon_dev_type.groups is meaningless well then kfree edev->extcon_dev_type.groups in function exton_dev_register (line 756)also should be removed I think. What do you think?
Thanks
Xiaoming.
Powered by blists - more mailing lists