Skip to content

Commit

Permalink
can: gw: use kmem_cache_free() instead of kfree()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Marc Kleine-Budde committed Apr 9, 2013
1 parent c802d75 commit 3480a21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/can/gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3480a21

Please sign in to comment.