Skip to content

Commit 4526fb8

Browse files
committed
Merge: sctp backports from upstream, 2nd phase
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6143 JIRA: https://issues.redhat.com/browse/RHEL-73625 Tested: compile only Signed-off-by: Xin Long <lxin@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents 30ef146 + 0e8c9e7 commit 4526fb8

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

net/sctp/associola.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ static struct sctp_association *sctp_association_init(
137137
= 5 * asoc->rto_max;
138138

139139
asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
140-
asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ;
140+
asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
141+
(unsigned long)sp->autoclose * HZ;
141142

142143
/* Initializes the timers */
143144
for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)

net/sctp/ipv6.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
684684
struct sock *sk = &sp->inet.sk;
685685
struct net *net = sock_net(sk);
686686
struct net_device *dev = NULL;
687-
int type;
687+
int type, res, bound_dev_if;
688688

689689
type = ipv6_addr_type(in6);
690690
if (IPV6_ADDR_ANY == type)
@@ -698,14 +698,21 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
698698
if (!(type & IPV6_ADDR_UNICAST))
699699
return 0;
700700

701-
if (sk->sk_bound_dev_if) {
702-
dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
701+
rcu_read_lock();
702+
bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
703+
if (bound_dev_if) {
704+
res = 0;
705+
dev = dev_get_by_index_rcu(net, bound_dev_if);
703706
if (!dev)
704-
return 0;
707+
goto out;
705708
}
706709

707-
return ipv6_can_nonlocal_bind(net, &sp->inet) ||
708-
ipv6_chk_addr(net, in6, dev, 0);
710+
res = ipv6_can_nonlocal_bind(net, &sp->inet) ||
711+
ipv6_chk_addr(net, in6, dev, 0);
712+
713+
out:
714+
rcu_read_unlock();
715+
return res;
709716
}
710717

711718
/* This function checks if the address is a valid address to be used for

0 commit comments

Comments
 (0)