Commit 3480a212 authored by Wei Yongjun's avatar Wei Yongjun Committed by Marc Kleine-Budde

can: gw: use kmem_cache_free() instead of kfree()

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent c802d759
...@@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb, ...@@ -466,7 +466,7 @@ static int cgw_notifier(struct notifier_block *nb,
if (gwj->src.dev == dev || gwj->dst.dev == dev) { if (gwj->src.dev == dev || gwj->dst.dev == dev) {
hlist_del(&gwj->list); hlist_del(&gwj->list);
cgw_unregister_filter(gwj); cgw_unregister_filter(gwj);
kfree(gwj); kmem_cache_free(cgw_cache, gwj);
} }
} }
} }
...@@ -864,7 +864,7 @@ static void cgw_remove_all_jobs(void) ...@@ -864,7 +864,7 @@ static void cgw_remove_all_jobs(void)
hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) { hlist_for_each_entry_safe(gwj, nx, &cgw_list, list) {
hlist_del(&gwj->list); hlist_del(&gwj->list);
cgw_unregister_filter(gwj); 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) ...@@ -920,7 +920,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
hlist_del(&gwj->list); hlist_del(&gwj->list);
cgw_unregister_filter(gwj); cgw_unregister_filter(gwj);
kfree(gwj); kmem_cache_free(cgw_cache, gwj);
err = 0; err = 0;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment