netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: gw: use kmem_cache_free() instead of kfree()
@ 2013-04-09  6:16 Wei Yongjun
  2013-04-09  6:48 ` Oliver Hartkopp
  2013-04-09  8:20 ` Marc Kleine-Budde
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Yongjun @ 2013-04-09  6:16 UTC (permalink / raw)
  To: socketcan, davem; +Cc: yongjun_wei, linux-can, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 net/can/gw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/can/gw.c b/net/can/gw.c
index 2d117dc..117814a 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb,
 			if (gwj->src.dev == dev || gwj->dst.dev == dev) {
 				hlist_del(&gwj->list);
 				cgw_unregister_filter(gwj);
-				kfree(gwj);
+				kmem_cache_free(cgw_cache, gwj);
 			}
 		}
 	}
@@ -864,7 +864,7 @@ static void cgw_remove_all_jobs(void)
 	hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) {
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(gwj);
-		kfree(gwj);
+		kmem_cache_free(cgw_cache, gwj);
 	}
 }
 
@@ -920,7 +920,7 @@ static int cgw_remove_job(struct sk_buff *skb,  struct nlmsghdr *nlh, void *arg)
 
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(gwj);
-		kfree(gwj);
+		kmem_cache_free(cgw_cache, gwj);
 		err = 0;
 		break;
 	}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] can: gw: use kmem_cache_free() instead of kfree()
  2013-04-09  6:16 [PATCH] can: gw: use kmem_cache_free() instead of kfree() Wei Yongjun
@ 2013-04-09  6:48 ` Oliver Hartkopp
  2013-04-09  8:20 ` Marc Kleine-Budde
  1 sibling, 0 replies; 6+ messages in thread
From: Oliver Hartkopp @ 2013-04-09  6:48 UTC (permalink / raw)
  To: Wei Yongjun, davem; +Cc: yongjun_wei, linux-can, netdev

On 09.04.2013 08:16, Wei Yongjun wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> memory allocated by kmem_cache_alloc() should be freed using
> kmem_cache_free(), not kfree().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>


Oh yes, that's right ...

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Is also a stable candidate for Linux 3.2+ (can-gw emerged in 3.2)

Thanks for catching this!

Best regards,
Oliver

> ---
>  net/can/gw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/can/gw.c b/net/can/gw.c
> index 2d117dc..117814a 100644
> --- a/net/can/gw.c
> +++ b/net/can/gw.c
> @@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb,
>  			if (gwj->src.dev == dev || gwj->dst.dev == dev) {
>  				hlist_del(&gwj->list);
>  				cgw_unregister_filter(gwj);
> -				kfree(gwj);
> +				kmem_cache_free(cgw_cache, gwj);
>  			}
>  		}
>  	}
> @@ -864,7 +864,7 @@ static void cgw_remove_all_jobs(void)
>  	hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) {
>  		hlist_del(&gwj->list);
>  		cgw_unregister_filter(gwj);
> -		kfree(gwj);
> +		kmem_cache_free(cgw_cache, gwj);
>  	}
>  }
>  
> @@ -920,7 +920,7 @@ static int cgw_remove_job(struct sk_buff *skb,  struct nlmsghdr *nlh, void *arg)
>  
>  		hlist_del(&gwj->list);
>  		cgw_unregister_filter(gwj);
> -		kfree(gwj);
> +		kmem_cache_free(cgw_cache, gwj);
>  		err = 0;
>  		break;
>  	}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* pull-request: can 2013-04-09
@ 2013-04-09  8:13 Marc Kleine-Budde
  2013-04-09  8:13 ` [PATCH] can: gw: use kmem_cache_free() instead of kfree() Marc Kleine-Budde
  2013-04-09 17:25 ` pull-request: can 2013-04-09 David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-09  8:13 UTC (permalink / raw)
  To: netdev; +Cc: linux-can, davem

Hello David,

here's a fix for the v3.9 release cycle, if not too late:

Wei Yongjun contributes a patch for the can-gw protocoll. The patch fixes the
memory allocated with kmem_cache_alloc(), is now freed using kmem_cache_free(),
not kfree().

regards,
Marc

---

The following changes since commit c802d759623acbd6e1ee9fbdabae89159a513913:

  netrom: fix invalid use of sizeof in nr_recvmsg() (2013-04-08 22:49:23 -0400)

are available in the git repository at:

  git://gitorious.org/linux-can/linux-can.git fixes-for-3.9

for you to fetch changes up to 3480a2125923e4b7a56d79efc76743089bf273fc:

  can: gw: use kmem_cache_free() instead of kfree() (2013-04-09 09:58:44 +0200)

----------------------------------------------------------------
Wei Yongjun (1):
      can: gw: use kmem_cache_free() instead of kfree()

 net/can/gw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] can: gw: use kmem_cache_free() instead of kfree()
  2013-04-09  8:13 pull-request: can 2013-04-09 Marc Kleine-Budde
@ 2013-04-09  8:13 ` Marc Kleine-Budde
  2013-04-09 17:25 ` pull-request: can 2013-04-09 David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-09  8:13 UTC (permalink / raw)
  To: netdev; +Cc: linux-can, davem, Wei Yongjun, linux-stable, Marc Kleine-Budde

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Cc: linux-stable <stable@vger.kernel.org> # >= v3.2
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/gw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/can/gw.c b/net/can/gw.c
index 2d117dc..117814a 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb,
 			if (gwj->src.dev == dev || gwj->dst.dev == dev) {
 				hlist_del(&gwj->list);
 				cgw_unregister_filter(gwj);
-				kfree(gwj);
+				kmem_cache_free(cgw_cache, gwj);
 			}
 		}
 	}
@@ -864,7 +864,7 @@ static void cgw_remove_all_jobs(void)
 	hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) {
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(gwj);
-		kfree(gwj);
+		kmem_cache_free(cgw_cache, gwj);
 	}
 }
 
@@ -920,7 +920,7 @@ static int cgw_remove_job(struct sk_buff *skb,  struct nlmsghdr *nlh, void *arg)
 
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(gwj);
-		kfree(gwj);
+		kmem_cache_free(cgw_cache, gwj);
 		err = 0;
 		break;
 	}
-- 
1.8.2.rc2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] can: gw: use kmem_cache_free() instead of kfree()
  2013-04-09  6:16 [PATCH] can: gw: use kmem_cache_free() instead of kfree() Wei Yongjun
  2013-04-09  6:48 ` Oliver Hartkopp
@ 2013-04-09  8:20 ` Marc Kleine-Budde
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-04-09  8:20 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: socketcan, davem, yongjun_wei, linux-can, netdev

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On 04/09/2013 08:16 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> memory allocated by kmem_cache_alloc() should be freed using
> kmem_cache_free(), not kfree().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Thanks for catching this. Applied to can/master.
I've send a pull request to David, along with Oliver's Acked-by and
stable on Cc.

Thanks,
Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pull-request: can 2013-04-09
  2013-04-09  8:13 pull-request: can 2013-04-09 Marc Kleine-Budde
  2013-04-09  8:13 ` [PATCH] can: gw: use kmem_cache_free() instead of kfree() Marc Kleine-Budde
@ 2013-04-09 17:25 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2013-04-09 17:25 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Tue,  9 Apr 2013 10:13:34 +0200

> here's a fix for the v3.9 release cycle, if not too late:
> 
> Wei Yongjun contributes a patch for the can-gw protocoll. The patch fixes the
> memory allocated with kmem_cache_alloc(), is now freed using kmem_cache_free(),
> not kfree().

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-09 17:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09  8:13 pull-request: can 2013-04-09 Marc Kleine-Budde
2013-04-09  8:13 ` [PATCH] can: gw: use kmem_cache_free() instead of kfree() Marc Kleine-Budde
2013-04-09 17:25 ` pull-request: can 2013-04-09 David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-04-09  6:16 [PATCH] can: gw: use kmem_cache_free() instead of kfree() Wei Yongjun
2013-04-09  6:48 ` Oliver Hartkopp
2013-04-09  8:20 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).