mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
sctp: read sk->sk_bound_dev_if once in sctp_rcv()
[ Upstream commita20ea29807
] sctp_rcv() reads sk->sk_bound_dev_if twice while the socket is not locked. Another cpu could change this field under us. Fixes:0fd9a65a76
("[SCTP] Support SO_BINDTODEVICE socket option on incoming packets.") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Vlad Yasevich <vyasevich@gmail.com> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7f1577c4bf
commit
dd6a930314
1 changed files with 3 additions and 1 deletions
|
@ -103,6 +103,7 @@ int sctp_rcv(struct sk_buff *skb)
|
|||
struct sctp_chunk *chunk;
|
||||
union sctp_addr src;
|
||||
union sctp_addr dest;
|
||||
int bound_dev_if;
|
||||
int family;
|
||||
struct sctp_af *af;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
|
@ -180,7 +181,8 @@ int sctp_rcv(struct sk_buff *skb)
|
|||
* If a frame arrives on an interface and the receiving socket is
|
||||
* bound to another interface, via SO_BINDTODEVICE, treat it as OOTB
|
||||
*/
|
||||
if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb))) {
|
||||
bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
|
||||
if (bound_dev_if && (bound_dev_if != af->skb_iif(skb))) {
|
||||
if (transport) {
|
||||
sctp_transport_put(transport);
|
||||
asoc = NULL;
|
||||
|
|
Loading…
Reference in a new issue