summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorCong Wang <cong.wang@bytedance.com>2021-07-04 12:02:46 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-07-15 18:17:50 -0700
commitc7272e15f0f18d6e0f423b53207eac7a27ed5a49 (patch)
tree01eb32d0527511f6ec585b6f4bda65d7db24316b /net
parent83301b5367a98c17ec0d76c7bc0ccdc3c7e7ad6d (diff)
af_unix: Add a dummy ->close() for sockmap
Unlike af_inet, unix_proto is very different, it does not even have a ->close(). We have to add a dummy implementation to satisfy sockmap. Normally it is just a nop, it is introduced only for sockmap to replace it. Signed-off-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210704190252.11866-6-xiyou.wangcong@gmail.com
Diffstat (limited to 'net')
-rw-r--r--net/unix/af_unix.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 77fb3910e1c3..875eeaaddc07 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -781,10 +781,18 @@ static const struct proto_ops unix_seqpacket_ops = {
.show_fdinfo = unix_show_fdinfo,
};
+static void unix_close(struct sock *sk, long timeout)
+{
+ /* Nothing to do here, unix socket does not need a ->close().
+ * This is merely for sockmap.
+ */
+}
+
static struct proto unix_proto = {
.name = "UNIX",
.owner = THIS_MODULE,
.obj_size = sizeof(struct unix_sock),
+ .close = unix_close,
};
static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
@@ -868,6 +876,7 @@ static int unix_release(struct socket *sock)
if (!sk)
return 0;
+ sk->sk_prot->close(sk, 0);
unix_release_sock(sk, 0);
sock->sk = NULL;