于 2012年09月26日 13:41, Steffen Klassert 写道:
On Wed, Sep 26, 2012 at 12:52:10PM +0800, Gao feng wrote:
quoted
+
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
const struct nlmsghdr *nlh,
struct netlink_dump_control *control)
@@ -1786,6 +1794,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
cb->done = control->done;
cb->nlh = nlh;
cb->data = control->data;
+ cb->module = control->module;
cb->min_dump_alloc = control->min_dump_alloc;
atomic_inc(&skb->users);
cb->skb = skb;
@@ -1796,19 +1805,27 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
return -ECONNREFUSED;
}
nlk = nlk_sk(sk);
- /* A dump is in progress... */
+
mutex_lock(nlk->cb_mutex);
+ /* A dump is in progress... */
if (nlk->cb) {
mutex_unlock(nlk->cb_mutex);
netlink_destroy_callback(cb);
- sock_put(sk);
- return -EBUSY;
+ ret = -EBUSY;
+ goto out;
+ }
+ /* add reference of module witch cb->dump belone to */
+ if (cb->module && !try_module_get(cb->module)) {
+ mutex_unlock(nlk->cb_mutex);
+ ret = -EPROTONOSUPPORT;
+ goto out;
Looks like you leak the allocated netlink_callback here.
You should call netlink_destroy_callback() before you exit.
oops, I will fix it,thanks very much!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html