[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50629B46.5070502@cn.fujitsu.com>
Date: Wed, 26 Sep 2012 14:05:58 +0800
From: Gao feng <gaofeng@...fujitsu.com>
To: Steffen Klassert <steffen.klassert@...unet.com>
CC: davem@...emloft.net, netfilter-devel@...r.kernel.org,
linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
eric.dumazet@...il.com, pablo@...filter.org,
linux-crypto@...r.kernel.org, jengelh@...i.de,
stephen.hemminger@...tta.com
Subject: Re: [PATCH 01/11] netlink: add reference of module in netlink_dump_start
于 2012年09月26日 13:41, Steffen Klassert 写道:
> On Wed, Sep 26, 2012 at 12:52:10PM +0800, Gao feng wrote:
>> +
>> 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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists