mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 08:48:48 +00:00
net-sctp: replace some sock_net(sk) with just 'net'
It already existed in part of the function, but move it to a higher level and use it consistently throughout. Safe since sk is never written to. Signed-off-by: Maciej Żenczykowski <maze@google.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ac71676c49
commit
fb8223888e
@ -8267,6 +8267,7 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
|||||||
struct sctp_sock *sp = sctp_sk(sk);
|
struct sctp_sock *sp = sctp_sk(sk);
|
||||||
bool reuse = (sk->sk_reuse || sp->reuse);
|
bool reuse = (sk->sk_reuse || sp->reuse);
|
||||||
struct sctp_bind_hashbucket *head; /* hash list */
|
struct sctp_bind_hashbucket *head; /* hash list */
|
||||||
|
struct net *net = sock_net(sk);
|
||||||
kuid_t uid = sock_i_uid(sk);
|
kuid_t uid = sock_i_uid(sk);
|
||||||
struct sctp_bind_bucket *pp;
|
struct sctp_bind_bucket *pp;
|
||||||
unsigned short snum;
|
unsigned short snum;
|
||||||
@ -8282,7 +8283,6 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
|||||||
/* Search for an available port. */
|
/* Search for an available port. */
|
||||||
int low, high, remaining, index;
|
int low, high, remaining, index;
|
||||||
unsigned int rover;
|
unsigned int rover;
|
||||||
struct net *net = sock_net(sk);
|
|
||||||
|
|
||||||
inet_get_local_port_range(net, &low, &high);
|
inet_get_local_port_range(net, &low, &high);
|
||||||
remaining = (high - low) + 1;
|
remaining = (high - low) + 1;
|
||||||
@ -8294,12 +8294,12 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
|||||||
rover = low;
|
rover = low;
|
||||||
if (inet_is_local_reserved_port(net, rover))
|
if (inet_is_local_reserved_port(net, rover))
|
||||||
continue;
|
continue;
|
||||||
index = sctp_phashfn(sock_net(sk), rover);
|
index = sctp_phashfn(net, rover);
|
||||||
head = &sctp_port_hashtable[index];
|
head = &sctp_port_hashtable[index];
|
||||||
spin_lock(&head->lock);
|
spin_lock(&head->lock);
|
||||||
sctp_for_each_hentry(pp, &head->chain)
|
sctp_for_each_hentry(pp, &head->chain)
|
||||||
if ((pp->port == rover) &&
|
if ((pp->port == rover) &&
|
||||||
net_eq(sock_net(sk), pp->net))
|
net_eq(net, pp->net))
|
||||||
goto next;
|
goto next;
|
||||||
break;
|
break;
|
||||||
next:
|
next:
|
||||||
@ -8323,10 +8323,10 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
|||||||
* to the port number (snum) - we detect that with the
|
* to the port number (snum) - we detect that with the
|
||||||
* port iterator, pp being NULL.
|
* port iterator, pp being NULL.
|
||||||
*/
|
*/
|
||||||
head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), snum)];
|
head = &sctp_port_hashtable[sctp_phashfn(net, snum)];
|
||||||
spin_lock(&head->lock);
|
spin_lock(&head->lock);
|
||||||
sctp_for_each_hentry(pp, &head->chain) {
|
sctp_for_each_hentry(pp, &head->chain) {
|
||||||
if ((pp->port == snum) && net_eq(pp->net, sock_net(sk)))
|
if ((pp->port == snum) && net_eq(pp->net, net))
|
||||||
goto pp_found;
|
goto pp_found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8382,7 +8382,7 @@ pp_found:
|
|||||||
pp_not_found:
|
pp_not_found:
|
||||||
/* If there was a hash table miss, create a new port. */
|
/* If there was a hash table miss, create a new port. */
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (!pp && !(pp = sctp_bucket_create(head, sock_net(sk), snum)))
|
if (!pp && !(pp = sctp_bucket_create(head, net, snum)))
|
||||||
goto fail_unlock;
|
goto fail_unlock;
|
||||||
|
|
||||||
/* In either case (hit or miss), make sure fastreuse is 1 only
|
/* In either case (hit or miss), make sure fastreuse is 1 only
|
||||||
|
Loading…
x
Reference in New Issue
Block a user