summaryrefslogtreecommitdiff
path: root/net/unix/diag.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-06-21 10:19:08 -0700
committerDavid S. Miller <davem@davemloft.net>2022-06-22 12:59:43 +0100
commit340c3d337119ea177a98338be2e3bc62ee87ac80 (patch)
tree6fb613affc4be36634c393ad26c7de92dd051e3e /net/unix/diag.c
parentffd3018bf7764f139e4378f303e6a97cf6b3687c (diff)
af_unix: Clean up some sock_net() uses.
Some functions define a net pointer only for one-shot use. Others call sock_net() redundantly even when a net pointer is available. Let's fix these and make the code simpler. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/diag.c')
-rw-r--r--net/unix/diag.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c
index bb0b5ea1655f..4e3dc8179fa4 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -308,7 +308,6 @@ out_nosk:
static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
{
int hdrlen = sizeof(struct unix_diag_req);
- struct net *net = sock_net(skb->sk);
if (nlmsg_len(h) < hdrlen)
return -EINVAL;
@@ -317,7 +316,7 @@ static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
struct netlink_dump_control c = {
.dump = unix_diag_dump,
};
- return netlink_dump_start(net->diag_nlsk, skb, h, &c);
+ return netlink_dump_start(sock_net(skb->sk)->diag_nlsk, skb, h, &c);
} else
return unix_diag_get_exact(skb, h, nlmsg_data(h));
}