Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5dc314f8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'rds-tcp-sock_graft-leak'

Sowmini Varadhan says:

====================
rds-tcp: sock_graft() leak

Following up on the discussion at
  https://www.spinics.net/lists/netdev/msg442859.html


- make rds_tcp_accept_one() call sock_create_lite()
- add a WARN_ON() to sock_graft()

Tested by running an infinite while() loop that does
(module-load; rds-stress; module-unload) and monitors
TCP slabinfo while the test is running.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9dc351da 0ffdaf5b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1697,6 +1697,7 @@ static inline void sock_orphan(struct sock *sk)

static inline void sock_graft(struct sock *sk, struct socket *parent)
{
	WARN_ON(parent->sk);
	write_lock_bh(&sk->sk_callback_lock);
	sk->sk_wq = parent->wq;
	parent->sk = sk;
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ int rds_tcp_accept_one(struct socket *sock)
	if (!sock) /* module unload or netns delete in progress */
		return -ENETUNREACH;

	ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
	ret = sock_create_lite(sock->sk->sk_family,
			       sock->sk->sk_type, sock->sk->sk_protocol,
			       &new_sock);
	if (ret)