Pull networking fixes from David Miller: 1) Fix several scatter gather list issues in kTLS code, from Jakub Kicinski. 2) macb driver device remove has to kill the hresp_err_tasklet. From Chuhong Yuan. 3) Several memory leak and reference count bug fixes in tipc, from Tung Nguyen. 4) Fix mlx5 build error w/o ipv6, from Yue Haibing. 5) Fix jumbo frame and other regressions in r8169, from Heiner Kallweit. 6) Undo some BUG_ON()'s and replace them with WARN_ON_ONCE and proper error propagation/handling. From Paolo Abeni. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (24 commits) openvswitch: remove another BUG_ON() openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() net: phy: realtek: fix using paged operations with RTL8105e / RTL8208 r8169: fix resume on cable plug-in r8169: fix jumbo configuration for RTL8168evl net: emulex: benet: indent a Kconfig depends continuation line selftests: forwarding: fix race between packet receive and tc check net: sched: fix `tc -s class show` no bstats on class with nolock subqueues net: ethernet: ti: ale: ensure vlan/mdb deleted when no members net/mlx5e: Fix build error without IPV6 selftests: pmtu: use -oneline for ip route list cache tipc: fix duplicate SYN messages under link congestion tipc: fix wrong timeout input for tipc_wait_for_cond() tipc: fix wrong socket reference counter after tipc_sk_timeout() returns tipc: fix potential memory leak in __tipc_sendmsg() net: macb: add missed tasklet_kill selftests: bpf: correct perror strings selftests: bpf: test_sockmap: handle file creation failures gracefully net/tls: use sg_next() to walk sg entries net/tls: remove the dead inplace_crypto code ...
Showing the changes to include/linux (1 of 24 files). Show all
Unified · Split
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <net/strparser.h> | 14 | #include <net/strparser.h> |
| 15 | 15 | ||
| 16 | #define MAX_MSG_FRAGS MAX_SKB_FRAGS | 16 | #define MAX_MSG_FRAGS MAX_SKB_FRAGS |
| 17 | #define NR_MSG_FRAG_IDS (MAX_MSG_FRAGS + 1) | ||
| 17 | 18 | ||
| 18 | enum __sk_action { | 19 | enum __sk_action { |
| 19 | __SK_DROP = 0, | 20 | __SK_DROP = 0, |
| @@ -29,13 +30,15 @@ struct sk_msg_sg { · 9 unmodified lines | |||
| 29 | u32 size; | 30 | u32 size; |
| 30 | u32 copybreak; | 31 | u32 copybreak; |
| 31 | unsigned long copy; | 32 | unsigned long copy; |
| 32 | /* The extra element is used for chaining the front and sections when | 33 | /* The extra two elements: |
| 33 | * the list becomes partitioned (e.g. end < start). The crypto APIs | 34 | * 1) used for chaining the front and sections when the list becomes |
| 34 | * require the chaining. | 35 | * partitioned (e.g. end < start). The crypto APIs require the |
| 36 | * chaining; | ||
| 37 | * 2) to chain tailer SG entries after the message. | ||
| 35 | */ | 38 | */ |
| 36 | struct scatterlist data[MAX_MSG_FRAGS + 1]; | 39 | struct scatterlist data[MAX_MSG_FRAGS + 2]; |
| 37 | }; | 40 | }; |
| 38 | static_assert(BITS_PER_LONG >= MAX_MSG_FRAGS); | 41 | static_assert(BITS_PER_LONG >= NR_MSG_FRAG_IDS); |
| 39 | 42 | ||
| 40 | /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ | 43 | /* UAPI in filter.c depends on struct sk_msg_sg being first element. */ |
| 41 | struct sk_msg { | 44 | struct sk_msg { |
| @@ -142,13 +145,13 @@ static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) · 100 unmodified lines | |||
| 142 | 145 | ||
| 143 | static inline u32 sk_msg_iter_dist(u32 start, u32 end) | 146 | static inline u32 sk_msg_iter_dist(u32 start, u32 end) |
| 144 | { | 147 | { |
| 145 | return end >= start ? end - start : end + (MAX_MSG_FRAGS - start); | 148 | return end >= start ? end - start : end + (NR_MSG_FRAG_IDS - start); |
| 146 | } | 149 | } |
| 147 | 150 | ||
| 148 | #define sk_msg_iter_var_prev(var) \ | 151 | #define sk_msg_iter_var_prev(var) \ |
| 149 | do { \ | 152 | do { \ |
| 150 | if (var == 0) \ | 153 | if (var == 0) \ |
| 151 | var = MAX_MSG_FRAGS - 1; \ | 154 | var = NR_MSG_FRAG_IDS - 1; \ |
| 152 | else \ | 155 | else \ |
| 153 | var--; \ | 156 | var--; \ |
| 154 | } while (0) | 157 | } while (0) |
| @@ -156,7 +159,7 @@ static inline u32 sk_msg_iter_dist(u32 start, u32 end) · 1 unmodified line | |||
| 156 | #define sk_msg_iter_var_next(var) \ | 159 | #define sk_msg_iter_var_next(var) \ |
| 157 | do { \ | 160 | do { \ |
| 158 | var++; \ | 161 | var++; \ |
| 159 | if (var == MAX_MSG_FRAGS) \ | 162 | if (var == NR_MSG_FRAG_IDS) \ |
| 160 | var = 0; \ | 163 | var = 0; \ |
| 161 | } while (0) | 164 | } while (0) |
| 162 | 165 | ||
| @@ -173,9 +176,9 @@ static inline void sk_msg_clear_meta(struct sk_msg *msg) · 10 unmodified lines | |||
| 173 | 176 | ||
| 174 | static inline void sk_msg_init(struct sk_msg *msg) | 177 | static inline void sk_msg_init(struct sk_msg *msg) |
| 175 | { | 178 | { |
| 176 | BUILD_BUG_ON(ARRAY_SIZE(msg->sg.data) - 1 != MAX_MSG_FRAGS); | 179 | BUILD_BUG_ON(ARRAY_SIZE(msg->sg.data) - 1 != NR_MSG_FRAG_IDS); |
| 177 | memset(msg, 0, sizeof(*msg)); | 180 | memset(msg, 0, sizeof(*msg)); |
| 178 | sg_init_marker(msg->sg.data, MAX_MSG_FRAGS); | 181 | sg_init_marker(msg->sg.data, NR_MSG_FRAG_IDS); |
| 179 | } | 182 | } |
| 180 | 183 | ||
| 181 | static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, | 184 | static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, |
| @@ -196,14 +199,11 @@ static inline void sk_msg_xfer_full(struct sk_msg *dst, struct sk_msg *src) · 14 unmodified lines | |||
| 196 | 199 | ||
| 197 | static inline bool sk_msg_full(const struct sk_msg *msg) | 200 | static inline bool sk_msg_full(const struct sk_msg *msg) |
| 198 | { | 201 | { |
| 199 | return (msg->sg.end == msg->sg.start) && msg->sg.size; | 202 | return sk_msg_iter_dist(msg->sg.start, msg->sg.end) == MAX_MSG_FRAGS; |
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | static inline u32 sk_msg_elem_used(const struct sk_msg *msg) | 205 | static inline u32 sk_msg_elem_used(const struct sk_msg *msg) |
| 203 | { | 206 | { |
| 204 | if (sk_msg_full(msg)) | ||
| 205 | return MAX_MSG_FRAGS; | ||
| 206 | |||
| 207 | return sk_msg_iter_dist(msg->sg.start, msg->sg.end); | 207 | return sk_msg_iter_dist(msg->sg.start, msg->sg.end); |
| 208 | } | 208 | } |
| 209 | 209 | ||