From: Al Viro Date: Thu, 4 Apr 2013 23:16:06 +0000 (-0400) Subject: bluetooth: fix race in bt_procfs_init() X-Git-Tag: upstream/snapshot3+hdmi~5227^2~96 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d006263d3d61413e63784a454b6e3310bd8e6ee;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git bluetooth: fix race in bt_procfs_init() use proc_create_data() rather than set ->data after the file has been created Signed-off-by: Al Viro --- diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 68e6fef..438a8c5 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -638,16 +638,10 @@ int bt_procfs_init(struct net *net, const char *name, struct bt_sock_list* sk_list, int (* seq_show)(struct seq_file *, void *)) { - struct proc_dir_entry * pde; - sk_list->custom_seq_show = seq_show; - pde = proc_create(name, 0, net->proc_net, &bt_fops); - if (!pde) + if (!proc_create_data(name, 0, net->proc_net, &bt_fops, sk_list)) return -ENOMEM; - - pde->data = sk_list; - return 0; }