Skip to contentSkip to conversation

driver core:firmware_class:fix memory leak of page pointers array

PATCH In review [email protected] 2 participants 6 messages Jul 9, 2009 – Jul 16, 2009 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core:firmware_class:fix memory leak of page pointers array

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

---
 drivers/base/firmware_class.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/base/firmware_class.c +0 -1
index fc46653..2643366 100644
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
 				goto err;
 			}
 			/* Pages will be freed by vfree() */
-			fw_priv->pages = NULL;
 			fw_priv->page_array_size = 0;
 			fw_priv->nr_pages = 0;
 			complete(&fw_priv->completion);
Signature · 1 line
1.6.0.GIT
author
#1 lore raw

2009/7/9 <[email protected]>:

Quoted 9 lines

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

---
This patch is against Catalin Marinas's patch:
[PATCH] Free struct device in fw_dev_release()

Quoted 20 lines

---
 drivers/base/firmware_class.c |    1 -

 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/base/firmware_class.c +0 -2
index fc46653..2643366 100644
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
                                goto err;
                        }
                        /* Pages will be freed by vfree() */
-                       fw_priv->pages = NULL;
                        fw_priv->page_array_size = 0;
                        fw_priv->nr_pages = 0;
                        complete(&fw_priv->completion);
--

1.6.0.GIT

Signature · 1 line
Lei Ming
#2 lore raw
Quoted 7 lines · Ming Lei

2009/7/9 <[email protected]>:

Quoted 6 lines

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

Quoted 7 lines
Quoted 3 lines

---
This patch is against Catalin Marinas's patch:
[PATCH] Free struct device in fw_dev_release()

Hm, I never got a final version of that patch, care to send it to me?

thanks,

greg k-h

author Acked-by David Woodhouse
#3 lore raw

于 Fri, 10 Jul 2009 10:36:49 -0700

Quoted 12 lines · Greg KH
Quoted 11 lines · Ming Lei

2009/7/9 <[email protected]>:

Quoted 9 lines

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

Quoted 5 lines
Quoted 3 lines

---
This patch is against Catalin Marinas's patch:
[PATCH] Free struct device in fw_dev_release()

Hm, I never got a final version of that patch, care to send it to me?

It is the latest version and now is against linus mainline. Thanks.

Quoted 1 line

From 50603673f5c68eb843584e65cc9930919910f98a Mon Sep 17 00:00:00 2001

From: Ming Lei <[email protected]>
Date: Thu, 9 Jul 2009 07:56:52 +0800
Subject: [PATCH] driver core:firmware_class:fix memory leak of page pointers array

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

---
 drivers/base/firmware_class.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/base/firmware_class.c +0 -1
index fc46653..2643366 100644
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
 				goto err;
 			}
 			/* Pages will be freed by vfree() */
-			fw_priv->pages = NULL;
 			fw_priv->page_array_size = 0;
 			fw_priv->nr_pages = 0;
 			complete(&fw_priv->completion);
Signature · 8 lines
1.6.0.GIT





-- 
Lei Ming
author
#4 lore raw

2009/7/11 Ming Lei <[email protected]>:

Quoted 15 lines
Quoted 12 lines · On Fri, 10 Jul 2009 10:36:49 -0700 Greg KH <[email protected]> wrote:
Quoted 11 lines · Ming Lei

2009/7/9  <[email protected]>:

Quoted 9 lines

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

---
This patch is against Catalin Marinas's patch:
    [PATCH] Free struct device in fw_dev_release()

Hm, I never got a final version of that patch, care to send it to me?

Hi,Greg

Care to queue the patch into your driver-core tree and send it to -rc4? Thanks.

Quoted 42 lines

It is the latest version and now is against linus mainline. Thanks.

From 50603673f5c68eb843584e65cc9930919910f98a Mon Sep 17 00:00:00 2001
From: Ming Lei <[email protected]>
Date: Thu, 9 Jul 2009 07:56:52 +0800
Subject: [PATCH] driver core:firmware_class:fix memory leak of page pointers array

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

---
 drivers/base/firmware_class.c |    1 -

 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/base/firmware_class.c +0 -2
index fc46653..2643366 100644
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
                                goto err;
                        }
                        /* Pages will be freed by vfree() */
-                       fw_priv->pages = NULL;
                        fw_priv->page_array_size = 0;
                        fw_priv->nr_pages = 0;
                        complete(&fw_priv->completion);
--

1.6.0.GIT

--
Lei Ming

Signature · 1 line
Lei Ming
#5 lore raw
Quoted 20 lines · Ming Lei

2009/7/11 Ming Lei <[email protected]>:

Quoted 19 lines
Quoted 16 lines · On Fri, 10 Jul 2009 10:36:49 -0700 Greg KH <[email protected]> wrote:
Quoted 14 lines · Ming Lei

2009/7/9  <[email protected]>:

Quoted 9 lines

From: Ming Lei <[email protected]>

The page pointers array is allocated in fw_realloc_buffer() called by firmware_data_write(), and should be freed in release function of firmware device.

---
This patch is against Catalin Marinas's patch:
    [PATCH] Free struct device in fw_dev_release()

Quoted 5 lines
Quoted 1 line
Quoted 1 line

Hm, I never got a final version of that patch, care to send it to me?

Hi,Greg

Care to queue the patch into your driver-core tree and send it to -rc4?

Now queued up.

thanks,

greg k-h