From 033f2e4393cee632b58227eca3cac0cac7c44164 Mon Sep 17 00:00:00 2001 From: Sharath Chandra Vurukala Date: Fri, 4 Sep 2020 20:20:25 +0530 Subject: [PATCH] net:sockev: hold file reference till the sock event is sent Hold file reference till the sock event is sent. Change-Id: I14d581f210c86e5771bec22a9aca7c78630e9ac1 Signed-off-by: Sharath Chandra Vurukala --- net/socket.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index 1e415a5fc352..c74acb4139c8 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1505,9 +1505,10 @@ SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen) (struct sockaddr *) &address, addrlen); } - fput_light(sock->file, fput_needed); if (!err) sockev_notify(SOCKEV_BIND, sock); + + fput_light(sock->file, fput_needed); } return err; } @@ -1534,9 +1535,10 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog) if (!err) err = sock->ops->listen(sock, backlog); - fput_light(sock->file, fput_needed); if (!err) sockev_notify(SOCKEV_LISTEN, sock); + + fput_light(sock->file, fput_needed); } return err; }