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

Commit 1114ca13 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: socket: make sure refs are not released on fd before calling sockev"

parents 8a365f02 66e0f893
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -1527,9 +1527,14 @@ SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
						      (struct sockaddr *)
						      &address, addrlen);
		}
		fput_light(sock->file, fput_needed);
		if (!err)
		if (!err) {
			if (sock->sk)
				sock_hold(sock->sk);
			sockev_notify(SOCKEV_BIND, sock);
			if (sock->sk)
				sock_put(sock->sk);
		}
		fput_light(sock->file, fput_needed);
	}
	return err;
}
@@ -1556,9 +1561,14 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog)
		if (!err)
			err = sock->ops->listen(sock, backlog);

		fput_light(sock->file, fput_needed);
		if (!err)
		if (!err) {
			if (sock->sk)
				sock_hold(sock->sk);
			sockev_notify(SOCKEV_LISTEN, sock);
			if (sock->sk)
				sock_put(sock->sk);
		}
		fput_light(sock->file, fput_needed);
	}
	return err;
}