lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Sep 2012 07:41:03 +0200
From:	Steffen Klassert <steffen.klassert@...unet.com>
To:	Gao feng <gaofeng@...fujitsu.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

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.

>  	}
> +
>  	nlk->cb = cb;
>  	mutex_unlock(nlk->cb_mutex);
>  
>  	ret = netlink_dump(sk);
> -
> +out:
>  	sock_put(sk);
>  
>  	if (ret)
> -- 
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ