Skip to contentSkip to conversation

Possible dst leak in udpv6_sendmsg.

PATCH In review Denis V. Lunev 2 participants 6 messages Jun 3, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Possible dst leak in udpv6_sendmsg.

ip6_sk_dst_lookup returns held dst entry. It should be released on all paths beyond this point. Add missed release when up->pending is set.

---
 net/ipv6/udp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
net/ipv6/udp.c +1 -0
index 1fd784f..3235528 100644
@@ -813,6 +813,7 @@ back_from_confirm:
 		/* The socket is already corked while preparing it. */
 		/* ... which is an evident application bug. --ANK */
 		release_sock(sk);
+		dst_release(dst);
 
 		LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 2\n");
 		err = -EINVAL;
Signature · 1 line
1.5.3.rc5
#1 lore raw

In article <[email protected]> (at Tue, 3 Jun 2008 15:08:42 +0400), "Denis V. Lunev" <[email protected]> says:

Quoted 2 lines

ip6_sk_dst_lookup returns held dst entry. It should be released on all paths beyond this point. Add missed release when up->pending is set.

Which kernel are you refering?
And, would you please take a look at ipv4 side as well?

--yoshfuji

#2 lore raw
Quoted 6 lines · YOSHIFUJI Hideaki / 吉藤英明

In article <[email protected]> (at Tue, 3 Jun 2008 15:08:42 +0400), "Denis V. Lunev" <[email protected]> says:

Quoted 2 lines

ip6_sk_dst_lookup returns held dst entry. It should be released on all paths beyond this point. Add missed release when up->pending is set.

Which kernel are you refering?

The patch is made against current net-2.6 tree, though all kernels are affected, starting at least RHEL5

Quoted 1 line

And, would you please take a look at ipv4 side as well?

ipv4 is ok, the code looks the same but there is an ip_rt_put at the
out: label.

#3 lore raw

In article <[email protected]> (at Tue, 03 Jun 2008 15:50:45 +0400), "Denis V. Lunev" <[email protected]> says:

Quoted 6 lines · YOSHIFUJI Hideaki / 吉藤英明
Quoted 5 lines

In article <[email protected]> (at Tue, 3 Jun 2008 15:08:42 +0400), "Denis V. Lunev" <[email protected]> says:

Quoted 2 lines

ip6_sk_dst_lookup returns held dst entry. It should be released on all paths beyond this point. Add missed release when up->pending is set.

Quoted 9 lines
Quoted 1 line

Which kernel are you refering?

The patch is made against current net-2.6 tree, though all kernels are affected, starting at least RHEL5

Quoted 1 line

And, would you please take a look at ipv4 side as well?

ipv4 is ok, the code looks the same but there is an ip_rt_put at the
out: label.

Okay, I think we have one more leakage here (in do_confirm path). How about this?

net/ipv6/udp.c +2 -0
index 1fd784f..47123bf 100644
@@ -848,12 +848,14 @@ do_append_data:
 		} else {
 			dst_release(dst);
 		}
+		dst = NULL;
 	}
 
 	if (err > 0)
 		err = np->recverr ? net_xmit_errno(err) : 0;
 	release_sock(sk);
 out:
+	dst_release(dst);
 	fl6_sock_release(flowlabel);
 	if (!err)
 		return len;

--yoshfuji