|
69 | 69 | #include <net/sctp/stream_sched.h>
|
70 | 70 |
|
71 | 71 | /* Forward declarations for internal helper functions. */
|
72 |
| -static bool sctp_writeable(struct sock *sk); |
| 72 | +static bool sctp_writeable(const struct sock *sk); |
73 | 73 | static void sctp_wfree(struct sk_buff *skb);
|
74 | 74 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
|
75 | 75 | size_t msg_len);
|
@@ -140,7 +140,7 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
|
140 | 140 |
|
141 | 141 | refcount_add(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc);
|
142 | 142 | asoc->sndbuf_used += chunk->skb->truesize + sizeof(struct sctp_chunk);
|
143 |
| - sk->sk_wmem_queued += chunk->skb->truesize + sizeof(struct sctp_chunk); |
| 143 | + sk_wmem_queued_add(sk, chunk->skb->truesize + sizeof(struct sctp_chunk)); |
144 | 144 | sk_mem_charge(sk, chunk->skb->truesize);
|
145 | 145 | }
|
146 | 146 |
|
@@ -9144,7 +9144,7 @@ static void sctp_wfree(struct sk_buff *skb)
|
9144 | 9144 | struct sock *sk = asoc->base.sk;
|
9145 | 9145 |
|
9146 | 9146 | sk_mem_uncharge(sk, skb->truesize);
|
9147 |
| - sk->sk_wmem_queued -= skb->truesize + sizeof(struct sctp_chunk); |
| 9147 | + sk_wmem_queued_add(sk, -(skb->truesize + sizeof(struct sctp_chunk))); |
9148 | 9148 | asoc->sndbuf_used -= skb->truesize + sizeof(struct sctp_chunk);
|
9149 | 9149 | WARN_ON(refcount_sub_and_test(sizeof(struct sctp_chunk),
|
9150 | 9150 | &sk->sk_wmem_alloc));
|
@@ -9299,9 +9299,9 @@ void sctp_write_space(struct sock *sk)
|
9299 | 9299 | * UDP-style sockets or TCP-style sockets, this code should work.
|
9300 | 9300 | * - Daisy
|
9301 | 9301 | */
|
9302 |
| -static bool sctp_writeable(struct sock *sk) |
| 9302 | +static bool sctp_writeable(const struct sock *sk) |
9303 | 9303 | {
|
9304 |
| - return sk->sk_sndbuf > sk->sk_wmem_queued; |
| 9304 | + return READ_ONCE(sk->sk_sndbuf) > READ_ONCE(sk->sk_wmem_queued); |
9305 | 9305 | }
|
9306 | 9306 |
|
9307 | 9307 | /* Wait for an association to go into ESTABLISHED state. If timeout is 0,
|
|
0 commit comments