Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Fri, 09 Aug 2019 17:45:59
Message-Id: 1565372737.dbcb182ad192aecf33b5bc1c3893fe60e22b3b67.mpagano@gentoo
1 commit: dbcb182ad192aecf33b5bc1c3893fe60e22b3b67
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 9 17:45:37 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 9 17:45:37 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=dbcb182a
7
8 Linux patch 4.19.66
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1065_linux-4.19.66.patch | 2321 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2325 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 2679f40..6813edb 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -303,6 +303,10 @@ Patch: 1064_linux-4.19.65.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.65
23
24 +Patch: 1065_linux-4.19.66.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.66
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1065_linux-4.19.66.patch b/1065_linux-4.19.66.patch
33 new file mode 100644
34 index 0000000..1b0d353
35 --- /dev/null
36 +++ b/1065_linux-4.19.66.patch
37 @@ -0,0 +1,2321 @@
38 +diff --git a/Makefile b/Makefile
39 +index 41a565770431..065e5b34dc02 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 65
47 ++SUBLEVEL = 66
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
52 +index 82532c299bb5..008905d4152a 100644
53 +--- a/drivers/atm/iphase.c
54 ++++ b/drivers/atm/iphase.c
55 +@@ -63,6 +63,7 @@
56 + #include <asm/byteorder.h>
57 + #include <linux/vmalloc.h>
58 + #include <linux/jiffies.h>
59 ++#include <linux/nospec.h>
60 + #include "iphase.h"
61 + #include "suni.h"
62 + #define swap_byte_order(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8))
63 +@@ -2760,8 +2761,11 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
64 + }
65 + if (copy_from_user(&ia_cmds, arg, sizeof ia_cmds)) return -EFAULT;
66 + board = ia_cmds.status;
67 +- if ((board < 0) || (board > iadev_count))
68 +- board = 0;
69 ++
70 ++ if ((board < 0) || (board > iadev_count))
71 ++ board = 0;
72 ++ board = array_index_nospec(board, iadev_count + 1);
73 ++
74 + iadev = ia_dev[board];
75 + switch (ia_cmds.cmd) {
76 + case MEMDUMP:
77 +diff --git a/drivers/base/base.h b/drivers/base/base.h
78 +index 7a419a7a6235..559b047de9f7 100644
79 +--- a/drivers/base/base.h
80 ++++ b/drivers/base/base.h
81 +@@ -66,6 +66,9 @@ struct driver_private {
82 + * probed first.
83 + * @device - pointer back to the struct device that this structure is
84 + * associated with.
85 ++ * @dead - This device is currently either in the process of or has been
86 ++ * removed from the system. Any asynchronous events scheduled for this
87 ++ * device should exit without taking any action.
88 + *
89 + * Nothing outside of the driver core should ever touch these fields.
90 + */
91 +@@ -76,6 +79,7 @@ struct device_private {
92 + struct klist_node knode_bus;
93 + struct list_head deferred_probe;
94 + struct device *device;
95 ++ u8 dead:1;
96 + };
97 + #define to_device_private_parent(obj) \
98 + container_of(obj, struct device_private, knode_parent)
99 +diff --git a/drivers/base/core.c b/drivers/base/core.c
100 +index 92e2c32c2227..e1a8d5c06f65 100644
101 +--- a/drivers/base/core.c
102 ++++ b/drivers/base/core.c
103 +@@ -2031,6 +2031,24 @@ void put_device(struct device *dev)
104 + }
105 + EXPORT_SYMBOL_GPL(put_device);
106 +
107 ++bool kill_device(struct device *dev)
108 ++{
109 ++ /*
110 ++ * Require the device lock and set the "dead" flag to guarantee that
111 ++ * the update behavior is consistent with the other bitfields near
112 ++ * it and that we cannot have an asynchronous probe routine trying
113 ++ * to run while we are tearing out the bus/class/sysfs from
114 ++ * underneath the device.
115 ++ */
116 ++ lockdep_assert_held(&dev->mutex);
117 ++
118 ++ if (dev->p->dead)
119 ++ return false;
120 ++ dev->p->dead = true;
121 ++ return true;
122 ++}
123 ++EXPORT_SYMBOL_GPL(kill_device);
124 ++
125 + /**
126 + * device_del - delete device from system.
127 + * @dev: device.
128 +@@ -2050,6 +2068,10 @@ void device_del(struct device *dev)
129 + struct kobject *glue_dir = NULL;
130 + struct class_interface *class_intf;
131 +
132 ++ device_lock(dev);
133 ++ kill_device(dev);
134 ++ device_unlock(dev);
135 ++
136 + /* Notify clients of device removal. This call must come
137 + * before dpm_sysfs_remove().
138 + */
139 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
140 +index d48b310c4760..11d24a552ee4 100644
141 +--- a/drivers/base/dd.c
142 ++++ b/drivers/base/dd.c
143 +@@ -725,15 +725,6 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
144 + bool async_allowed;
145 + int ret;
146 +
147 +- /*
148 +- * Check if device has already been claimed. This may
149 +- * happen with driver loading, device discovery/registration,
150 +- * and deferred probe processing happens all at once with
151 +- * multiple threads.
152 +- */
153 +- if (dev->driver)
154 +- return -EBUSY;
155 +-
156 + ret = driver_match_device(drv, dev);
157 + if (ret == 0) {
158 + /* no match */
159 +@@ -768,6 +759,15 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
160 +
161 + device_lock(dev);
162 +
163 ++ /*
164 ++ * Check if device has already been removed or claimed. This may
165 ++ * happen with driver loading, device discovery/registration,
166 ++ * and deferred probe processing happens all at once with
167 ++ * multiple threads.
168 ++ */
169 ++ if (dev->p->dead || dev->driver)
170 ++ goto out_unlock;
171 ++
172 + if (dev->parent)
173 + pm_runtime_get_sync(dev->parent);
174 +
175 +@@ -778,7 +778,7 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)
176 +
177 + if (dev->parent)
178 + pm_runtime_put(dev->parent);
179 +-
180 ++out_unlock:
181 + device_unlock(dev);
182 +
183 + put_device(dev);
184 +@@ -891,7 +891,7 @@ static int __driver_attach(struct device *dev, void *data)
185 + if (dev->parent && dev->bus->need_parent_lock)
186 + device_lock(dev->parent);
187 + device_lock(dev);
188 +- if (!dev->driver)
189 ++ if (!dev->p->dead && !dev->driver)
190 + driver_probe_device(drv, dev);
191 + device_unlock(dev);
192 + if (dev->parent && dev->bus->need_parent_lock)
193 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
194 +index 50b3c0d89c9c..2898bb061945 100644
195 +--- a/drivers/hid/hid-ids.h
196 ++++ b/drivers/hid/hid-ids.h
197 +@@ -559,6 +559,7 @@
198 + #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a
199 + #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
200 + #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A 0x094a
201 ++#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641 0x0641
202 +
203 + #define USB_VENDOR_ID_HUION 0x256c
204 + #define USB_DEVICE_ID_HUION_TABLET 0x006e
205 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
206 +index 91e86af44a04..d29c7c9cd185 100644
207 +--- a/drivers/hid/hid-quirks.c
208 ++++ b/drivers/hid/hid-quirks.c
209 +@@ -94,6 +94,7 @@ static const struct hid_device_id hid_quirks[] = {
210 + { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL },
211 + { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
212 + { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A), HID_QUIRK_ALWAYS_POLL },
213 ++ { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL },
214 + { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT },
215 + { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT },
216 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), HID_QUIRK_MULTI_INPUT },
217 +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
218 +index 0ae848369474..e56dc97fe4b6 100644
219 +--- a/drivers/hid/wacom_wac.c
220 ++++ b/drivers/hid/wacom_wac.c
221 +@@ -537,14 +537,14 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
222 + */
223 + buttons = (data[4] << 1) | (data[3] & 0x01);
224 + } else if (features->type == CINTIQ_COMPANION_2) {
225 +- /* d-pad right -> data[4] & 0x10
226 +- * d-pad up -> data[4] & 0x20
227 +- * d-pad left -> data[4] & 0x40
228 +- * d-pad down -> data[4] & 0x80
229 +- * d-pad center -> data[3] & 0x01
230 ++ /* d-pad right -> data[2] & 0x10
231 ++ * d-pad up -> data[2] & 0x20
232 ++ * d-pad left -> data[2] & 0x40
233 ++ * d-pad down -> data[2] & 0x80
234 ++ * d-pad center -> data[1] & 0x01
235 + */
236 + buttons = ((data[2] >> 4) << 7) |
237 +- ((data[1] & 0x04) << 6) |
238 ++ ((data[1] & 0x04) << 4) |
239 + ((data[2] & 0x0F) << 2) |
240 + (data[1] & 0x03);
241 + } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
242 +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
243 +index 5b0e1d9e5adc..1de10e5c70d7 100644
244 +--- a/drivers/i2c/i2c-core-base.c
245 ++++ b/drivers/i2c/i2c-core-base.c
246 +@@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap)
247 + int i2c_generic_scl_recovery(struct i2c_adapter *adap)
248 + {
249 + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
250 +- int i = 0, scl = 1, ret;
251 ++ int i = 0, scl = 1, ret = 0;
252 +
253 + if (bri->prepare_recovery)
254 + bri->prepare_recovery(adap);
255 +diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
256 +index 7b794a14d6e8..8be082edf986 100644
257 +--- a/drivers/infiniband/core/sa_query.c
258 ++++ b/drivers/infiniband/core/sa_query.c
259 +@@ -1232,7 +1232,6 @@ static int roce_resolve_route_from_path(struct sa_path_rec *rec,
260 + {
261 + struct rdma_dev_addr dev_addr = {};
262 + union {
263 +- struct sockaddr _sockaddr;
264 + struct sockaddr_in _sockaddr_in;
265 + struct sockaddr_in6 _sockaddr_in6;
266 + } sgid_addr, dgid_addr;
267 +@@ -1249,12 +1248,12 @@ static int roce_resolve_route_from_path(struct sa_path_rec *rec,
268 + */
269 + dev_addr.net = &init_net;
270 +
271 +- rdma_gid2ip(&sgid_addr._sockaddr, &rec->sgid);
272 +- rdma_gid2ip(&dgid_addr._sockaddr, &rec->dgid);
273 ++ rdma_gid2ip((struct sockaddr *)&sgid_addr, &rec->sgid);
274 ++ rdma_gid2ip((struct sockaddr *)&dgid_addr, &rec->dgid);
275 +
276 + /* validate the route */
277 +- ret = rdma_resolve_ip_route(&sgid_addr._sockaddr,
278 +- &dgid_addr._sockaddr, &dev_addr);
279 ++ ret = rdma_resolve_ip_route((struct sockaddr *)&sgid_addr,
280 ++ (struct sockaddr *)&dgid_addr, &dev_addr);
281 + if (ret)
282 + return ret;
283 +
284 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
285 +index 3edb81a4f075..33baa17fa9d5 100644
286 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
287 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
288 +@@ -1936,8 +1936,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
289 + }
290 +
291 + /* select a non-FCoE queue */
292 +- return fallback(dev, skb, NULL) %
293 +- (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos);
294 ++ return fallback(dev, skb, NULL) % (BNX2X_NUM_ETH_QUEUES(bp));
295 + }
296 +
297 + void bnx2x_set_num_queues(struct bnx2x *bp)
298 +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
299 +index df5b74f289e1..6455511457ca 100644
300 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
301 ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
302 +@@ -3501,6 +3501,7 @@ static int mvpp2_set_mac_address(struct net_device *dev, void *p)
303 + static int mvpp2_change_mtu(struct net_device *dev, int mtu)
304 + {
305 + struct mvpp2_port *port = netdev_priv(dev);
306 ++ bool running = netif_running(dev);
307 + int err;
308 +
309 + if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) {
310 +@@ -3509,40 +3510,24 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu)
311 + mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8);
312 + }
313 +
314 +- if (!netif_running(dev)) {
315 +- err = mvpp2_bm_update_mtu(dev, mtu);
316 +- if (!err) {
317 +- port->pkt_size = MVPP2_RX_PKT_SIZE(mtu);
318 +- return 0;
319 +- }
320 +-
321 +- /* Reconfigure BM to the original MTU */
322 +- err = mvpp2_bm_update_mtu(dev, dev->mtu);
323 +- if (err)
324 +- goto log_error;
325 +- }
326 +-
327 +- mvpp2_stop_dev(port);
328 ++ if (running)
329 ++ mvpp2_stop_dev(port);
330 +
331 + err = mvpp2_bm_update_mtu(dev, mtu);
332 +- if (!err) {
333 ++ if (err) {
334 ++ netdev_err(dev, "failed to change MTU\n");
335 ++ /* Reconfigure BM to the original MTU */
336 ++ mvpp2_bm_update_mtu(dev, dev->mtu);
337 ++ } else {
338 + port->pkt_size = MVPP2_RX_PKT_SIZE(mtu);
339 +- goto out_start;
340 + }
341 +
342 +- /* Reconfigure BM to the original MTU */
343 +- err = mvpp2_bm_update_mtu(dev, dev->mtu);
344 +- if (err)
345 +- goto log_error;
346 +-
347 +-out_start:
348 +- mvpp2_start_dev(port);
349 +- mvpp2_egress_enable(port);
350 +- mvpp2_ingress_enable(port);
351 ++ if (running) {
352 ++ mvpp2_start_dev(port);
353 ++ mvpp2_egress_enable(port);
354 ++ mvpp2_ingress_enable(port);
355 ++ }
356 +
357 +- return 0;
358 +-log_error:
359 +- netdev_err(dev, "failed to change MTU\n");
360 + return err;
361 + }
362 +
363 +@@ -5358,9 +5343,6 @@ static int mvpp2_remove(struct platform_device *pdev)
364 +
365 + mvpp2_dbgfs_cleanup(priv);
366 +
367 +- flush_workqueue(priv->stats_queue);
368 +- destroy_workqueue(priv->stats_queue);
369 +-
370 + fwnode_for_each_available_child_node(fwnode, port_fwnode) {
371 + if (priv->port_list[i]) {
372 + mutex_destroy(&priv->port_list[i]->gather_stats_lock);
373 +@@ -5369,6 +5351,8 @@ static int mvpp2_remove(struct platform_device *pdev)
374 + i++;
375 + }
376 +
377 ++ destroy_workqueue(priv->stats_queue);
378 ++
379 + for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) {
380 + struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i];
381 +
382 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
383 +index 1c225be9c7db..3692d6a1cce8 100644
384 +--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
385 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
386 +@@ -307,7 +307,7 @@ void mlx5_unregister_device(struct mlx5_core_dev *dev)
387 + struct mlx5_interface *intf;
388 +
389 + mutex_lock(&mlx5_intf_mutex);
390 +- list_for_each_entry(intf, &intf_list, list)
391 ++ list_for_each_entry_reverse(intf, &intf_list, list)
392 + mlx5_remove_device(intf, priv);
393 + list_del(&priv->dev_list);
394 + mutex_unlock(&mlx5_intf_mutex);
395 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
396 +index 0f1c296c3ce4..83ab2c0e6b61 100644
397 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
398 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
399 +@@ -420,12 +420,11 @@ static inline u64 mlx5e_get_mpwqe_offset(struct mlx5e_rq *rq, u16 wqe_ix)
400 +
401 + static void mlx5e_init_frags_partition(struct mlx5e_rq *rq)
402 + {
403 +- struct mlx5e_wqe_frag_info next_frag, *prev;
404 ++ struct mlx5e_wqe_frag_info next_frag = {};
405 ++ struct mlx5e_wqe_frag_info *prev = NULL;
406 + int i;
407 +
408 + next_frag.di = &rq->wqe.di[0];
409 +- next_frag.offset = 0;
410 +- prev = NULL;
411 +
412 + for (i = 0; i < mlx5_wq_cyc_get_size(&rq->wqe.wq); i++) {
413 + struct mlx5e_rq_frag_info *frag_info = &rq->wqe.info.arr[0];
414 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
415 +index 9f7f8425f676..c8928ce69185 100644
416 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
417 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
418 +@@ -992,13 +992,13 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
419 + void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
420 + {
421 + struct mlx5e_neigh *m_neigh = &nhe->m_neigh;
422 +- u64 bytes, packets, lastuse = 0;
423 + struct mlx5e_tc_flow *flow;
424 + struct mlx5e_encap_entry *e;
425 + struct mlx5_fc *counter;
426 + struct neigh_table *tbl;
427 + bool neigh_used = false;
428 + struct neighbour *n;
429 ++ u64 lastuse;
430 +
431 + if (m_neigh->family == AF_INET)
432 + tbl = &arp_tbl;
433 +@@ -1015,7 +1015,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
434 + list_for_each_entry(flow, &e->flows, encap) {
435 + if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
436 + counter = mlx5_flow_rule_counter(flow->rule[0]);
437 +- mlx5_fc_query_cached(counter, &bytes, &packets, &lastuse);
438 ++ lastuse = mlx5_fc_query_lastuse(counter);
439 + if (time_after((unsigned long)lastuse, nhe->reported_lastuse)) {
440 + neigh_used = true;
441 + break;
442 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
443 +index 58af6be13dfa..808ddd732e04 100644
444 +--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
445 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
446 +@@ -321,6 +321,11 @@ int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
447 + }
448 + EXPORT_SYMBOL(mlx5_fc_query);
449 +
450 ++u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter)
451 ++{
452 ++ return counter->cache.lastuse;
453 ++}
454 ++
455 + void mlx5_fc_query_cached(struct mlx5_fc *counter,
456 + u64 *bytes, u64 *packets, u64 *lastuse)
457 + {
458 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
459 +index 0cab06046e5d..ee126bcf7c35 100644
460 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
461 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
462 +@@ -5032,7 +5032,7 @@ static int __init mlxsw_sp_module_init(void)
463 + return 0;
464 +
465 + err_sp2_pci_driver_register:
466 +- mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver);
467 ++ mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver);
468 + err_sp1_pci_driver_register:
469 + mlxsw_core_driver_unregister(&mlxsw_sp2_driver);
470 + err_sp2_core_driver_register:
471 +diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
472 +index 10291198decd..732ba21d3369 100644
473 +--- a/drivers/net/ethernet/mscc/ocelot.c
474 ++++ b/drivers/net/ethernet/mscc/ocelot.c
475 +@@ -1767,6 +1767,7 @@ EXPORT_SYMBOL(ocelot_init);
476 +
477 + void ocelot_deinit(struct ocelot *ocelot)
478 + {
479 ++ cancel_delayed_work(&ocelot->stats_work);
480 + destroy_workqueue(ocelot->stats_queue);
481 + mutex_destroy(&ocelot->stats_lock);
482 + }
483 +diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
484 +index 884f1f52dcc2..70879a3ab567 100644
485 +--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
486 ++++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
487 +@@ -59,7 +59,7 @@ struct rmnet_map_dl_csum_trailer {
488 + struct rmnet_map_ul_csum_header {
489 + __be16 csum_start_offset;
490 + u16 csum_insert_offset:14;
491 +- u16 udp_ip4_ind:1;
492 ++ u16 udp_ind:1;
493 + u16 csum_enabled:1;
494 + } __aligned(1);
495 +
496 +diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
497 +index 57a9c314a665..b2090cedd2e9 100644
498 +--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
499 ++++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
500 +@@ -215,9 +215,9 @@ rmnet_map_ipv4_ul_csum_header(void *iphdr,
501 + ul_header->csum_insert_offset = skb->csum_offset;
502 + ul_header->csum_enabled = 1;
503 + if (ip4h->protocol == IPPROTO_UDP)
504 +- ul_header->udp_ip4_ind = 1;
505 ++ ul_header->udp_ind = 1;
506 + else
507 +- ul_header->udp_ip4_ind = 0;
508 ++ ul_header->udp_ind = 0;
509 +
510 + /* Changing remaining fields to network order */
511 + hdr++;
512 +@@ -248,6 +248,7 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr,
513 + struct rmnet_map_ul_csum_header *ul_header,
514 + struct sk_buff *skb)
515 + {
516 ++ struct ipv6hdr *ip6h = (struct ipv6hdr *)ip6hdr;
517 + __be16 *hdr = (__be16 *)ul_header, offset;
518 +
519 + offset = htons((__force u16)(skb_transport_header(skb) -
520 +@@ -255,7 +256,11 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr,
521 + ul_header->csum_start_offset = offset;
522 + ul_header->csum_insert_offset = skb->csum_offset;
523 + ul_header->csum_enabled = 1;
524 +- ul_header->udp_ip4_ind = 0;
525 ++
526 ++ if (ip6h->nexthdr == IPPROTO_UDP)
527 ++ ul_header->udp_ind = 1;
528 ++ else
529 ++ ul_header->udp_ind = 0;
530 +
531 + /* Changing remaining fields to network order */
532 + hdr++;
533 +@@ -428,7 +433,7 @@ sw_csum:
534 + ul_header->csum_start_offset = 0;
535 + ul_header->csum_insert_offset = 0;
536 + ul_header->csum_enabled = 0;
537 +- ul_header->udp_ip4_ind = 0;
538 ++ ul_header->udp_ind = 0;
539 +
540 + priv->stats.csum_sw++;
541 + }
542 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
543 +index a6992c4c7313..0c8b7146637e 100644
544 +--- a/drivers/net/ethernet/realtek/r8169.c
545 ++++ b/drivers/net/ethernet/realtek/r8169.c
546 +@@ -7239,13 +7239,18 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
547 + {
548 + unsigned int flags;
549 +
550 +- if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
551 ++ switch (tp->mac_version) {
552 ++ case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
553 + RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
554 + RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
555 + RTL_W8(tp, Cfg9346, Cfg9346_Lock);
556 ++ /* fall through */
557 ++ case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_24:
558 + flags = PCI_IRQ_LEGACY;
559 +- } else {
560 ++ break;
561 ++ default:
562 + flags = PCI_IRQ_ALL_TYPES;
563 ++ break;
564 + }
565 +
566 + return pci_alloc_irq_vectors(tp->pci_dev, 1, 1, flags);
567 +diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
568 +index e029c7977a56..2e8056d48f4a 100644
569 +--- a/drivers/net/phy/phylink.c
570 ++++ b/drivers/net/phy/phylink.c
571 +@@ -226,6 +226,8 @@ static int phylink_parse_fixedlink(struct phylink *pl,
572 + __ETHTOOL_LINK_MODE_MASK_NBITS, true);
573 + linkmode_zero(pl->supported);
574 + phylink_set(pl->supported, MII);
575 ++ phylink_set(pl->supported, Pause);
576 ++ phylink_set(pl->supported, Asym_Pause);
577 + if (s) {
578 + __set_bit(s->bit, pl->supported);
579 + } else {
580 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
581 +index f22639f0116a..c04f3dc17d76 100644
582 +--- a/drivers/net/ppp/pppoe.c
583 ++++ b/drivers/net/ppp/pppoe.c
584 +@@ -1120,6 +1120,9 @@ static const struct proto_ops pppoe_ops = {
585 + .recvmsg = pppoe_recvmsg,
586 + .mmap = sock_no_mmap,
587 + .ioctl = pppox_ioctl,
588 ++#ifdef CONFIG_COMPAT
589 ++ .compat_ioctl = pppox_compat_ioctl,
590 ++#endif
591 + };
592 +
593 + static const struct pppox_proto pppoe_proto = {
594 +diff --git a/drivers/net/ppp/pppox.c b/drivers/net/ppp/pppox.c
595 +index c0599b3b23c0..9128e42e33e7 100644
596 +--- a/drivers/net/ppp/pppox.c
597 ++++ b/drivers/net/ppp/pppox.c
598 +@@ -22,6 +22,7 @@
599 + #include <linux/string.h>
600 + #include <linux/module.h>
601 + #include <linux/kernel.h>
602 ++#include <linux/compat.h>
603 + #include <linux/errno.h>
604 + #include <linux/netdevice.h>
605 + #include <linux/net.h>
606 +@@ -103,6 +104,18 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
607 +
608 + EXPORT_SYMBOL(pppox_ioctl);
609 +
610 ++#ifdef CONFIG_COMPAT
611 ++int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
612 ++{
613 ++ if (cmd == PPPOEIOCSFWD32)
614 ++ cmd = PPPOEIOCSFWD;
615 ++
616 ++ return pppox_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
617 ++}
618 ++
619 ++EXPORT_SYMBOL(pppox_compat_ioctl);
620 ++#endif
621 ++
622 + static int pppox_create(struct net *net, struct socket *sock, int protocol,
623 + int kern)
624 + {
625 +diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
626 +index 7321a4eca235..9ad3ff40a563 100644
627 +--- a/drivers/net/ppp/pptp.c
628 ++++ b/drivers/net/ppp/pptp.c
629 +@@ -633,6 +633,9 @@ static const struct proto_ops pptp_ops = {
630 + .recvmsg = sock_no_recvmsg,
631 + .mmap = sock_no_mmap,
632 + .ioctl = pppox_ioctl,
633 ++#ifdef CONFIG_COMPAT
634 ++ .compat_ioctl = pppox_compat_ioctl,
635 ++#endif
636 + };
637 +
638 + static const struct pppox_proto pppox_pptp_proto = {
639 +diff --git a/drivers/net/tun.c b/drivers/net/tun.c
640 +index b67fee56ec81..5fa7047ea361 100644
641 +--- a/drivers/net/tun.c
642 ++++ b/drivers/net/tun.c
643 +@@ -1682,6 +1682,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
644 +
645 + skb_reserve(skb, pad - delta);
646 + skb_put(skb, len);
647 ++ skb_set_owner_w(skb, tfile->socket.sk);
648 + get_page(alloc_frag->page);
649 + alloc_frag->offset += buflen;
650 +
651 +diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
652 +index e65d027b91fa..529be35ac178 100644
653 +--- a/drivers/nfc/nfcmrvl/main.c
654 ++++ b/drivers/nfc/nfcmrvl/main.c
655 +@@ -244,7 +244,7 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv)
656 + /* Reset possible fault of previous session */
657 + clear_bit(NFCMRVL_PHY_ERROR, &priv->flags);
658 +
659 +- if (priv->config.reset_n_io) {
660 ++ if (gpio_is_valid(priv->config.reset_n_io)) {
661 + nfc_info(priv->dev, "reset the chip\n");
662 + gpio_set_value(priv->config.reset_n_io, 0);
663 + usleep_range(5000, 10000);
664 +@@ -255,7 +255,7 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv)
665 +
666 + void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
667 + {
668 +- if (priv->config.reset_n_io)
669 ++ if (gpio_is_valid(priv->config.reset_n_io))
670 + gpio_set_value(priv->config.reset_n_io, 0);
671 + }
672 +
673 +diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
674 +index 9a22056e8d9e..e5a622ce4b95 100644
675 +--- a/drivers/nfc/nfcmrvl/uart.c
676 ++++ b/drivers/nfc/nfcmrvl/uart.c
677 +@@ -26,7 +26,7 @@
678 + static unsigned int hci_muxed;
679 + static unsigned int flow_control;
680 + static unsigned int break_control;
681 +-static unsigned int reset_n_io;
682 ++static int reset_n_io = -EINVAL;
683 +
684 + /*
685 + ** NFCMRVL NCI OPS
686 +@@ -231,5 +231,5 @@ MODULE_PARM_DESC(break_control, "Tell if UART driver must drive break signal.");
687 + module_param(hci_muxed, uint, 0);
688 + MODULE_PARM_DESC(hci_muxed, "Tell if transport is muxed in HCI one.");
689 +
690 +-module_param(reset_n_io, uint, 0);
691 ++module_param(reset_n_io, int, 0);
692 + MODULE_PARM_DESC(reset_n_io, "GPIO that is wired to RESET_N signal.");
693 +diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
694 +index 945cc903d8f1..888e298f610b 100644
695 +--- a/drivers/nfc/nfcmrvl/usb.c
696 ++++ b/drivers/nfc/nfcmrvl/usb.c
697 +@@ -305,6 +305,7 @@ static int nfcmrvl_probe(struct usb_interface *intf,
698 +
699 + /* No configuration for USB */
700 + memset(&config, 0, sizeof(config));
701 ++ config.reset_n_io = -EINVAL;
702 +
703 + nfc_info(&udev->dev, "intf %p id %p\n", intf, id);
704 +
705 +diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
706 +index ee39e2c1644a..2ba22cd1331b 100644
707 +--- a/drivers/nvdimm/bus.c
708 ++++ b/drivers/nvdimm/bus.c
709 +@@ -528,13 +528,38 @@ EXPORT_SYMBOL(nd_device_register);
710 +
711 + void nd_device_unregister(struct device *dev, enum nd_async_mode mode)
712 + {
713 ++ bool killed;
714 ++
715 + switch (mode) {
716 + case ND_ASYNC:
717 ++ /*
718 ++ * In the async case this is being triggered with the
719 ++ * device lock held and the unregistration work needs to
720 ++ * be moved out of line iff this is thread has won the
721 ++ * race to schedule the deletion.
722 ++ */
723 ++ if (!kill_device(dev))
724 ++ return;
725 ++
726 + get_device(dev);
727 + async_schedule_domain(nd_async_device_unregister, dev,
728 + &nd_async_domain);
729 + break;
730 + case ND_SYNC:
731 ++ /*
732 ++ * In the sync case the device is being unregistered due
733 ++ * to a state change of the parent. Claim the kill state
734 ++ * to synchronize against other unregistration requests,
735 ++ * or otherwise let the async path handle it if the
736 ++ * unregistration was already queued.
737 ++ */
738 ++ device_lock(dev);
739 ++ killed = kill_device(dev);
740 ++ device_unlock(dev);
741 ++
742 ++ if (!killed)
743 ++ return;
744 ++
745 + nd_synchronize();
746 + device_unregister(dev);
747 + break;
748 +@@ -840,10 +865,12 @@ void wait_nvdimm_bus_probe_idle(struct device *dev)
749 + do {
750 + if (nvdimm_bus->probe_active == 0)
751 + break;
752 +- nvdimm_bus_unlock(&nvdimm_bus->dev);
753 ++ nvdimm_bus_unlock(dev);
754 ++ device_unlock(dev);
755 + wait_event(nvdimm_bus->wait,
756 + nvdimm_bus->probe_active == 0);
757 +- nvdimm_bus_lock(&nvdimm_bus->dev);
758 ++ device_lock(dev);
759 ++ nvdimm_bus_lock(dev);
760 + } while (true);
761 + }
762 +
763 +@@ -926,20 +953,19 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
764 + int read_only, unsigned int ioctl_cmd, unsigned long arg)
765 + {
766 + struct nvdimm_bus_descriptor *nd_desc = nvdimm_bus->nd_desc;
767 +- static char out_env[ND_CMD_MAX_ENVELOPE];
768 +- static char in_env[ND_CMD_MAX_ENVELOPE];
769 + const struct nd_cmd_desc *desc = NULL;
770 + unsigned int cmd = _IOC_NR(ioctl_cmd);
771 + struct device *dev = &nvdimm_bus->dev;
772 + void __user *p = (void __user *) arg;
773 ++ char *out_env = NULL, *in_env = NULL;
774 + const char *cmd_name, *dimm_name;
775 + u32 in_len = 0, out_len = 0;
776 + unsigned int func = cmd;
777 + unsigned long cmd_mask;
778 + struct nd_cmd_pkg pkg;
779 + int rc, i, cmd_rc;
780 ++ void *buf = NULL;
781 + u64 buf_len = 0;
782 +- void *buf;
783 +
784 + if (nvdimm) {
785 + desc = nd_cmd_dimm_desc(cmd);
786 +@@ -970,7 +996,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
787 + case ND_CMD_ARS_START:
788 + case ND_CMD_CLEAR_ERROR:
789 + case ND_CMD_CALL:
790 +- dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
791 ++ dev_dbg(dev, "'%s' command while read-only.\n",
792 + nvdimm ? nvdimm_cmd_name(cmd)
793 + : nvdimm_bus_cmd_name(cmd));
794 + return -EPERM;
795 +@@ -979,6 +1005,9 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
796 + }
797 +
798 + /* process an input envelope */
799 ++ in_env = kzalloc(ND_CMD_MAX_ENVELOPE, GFP_KERNEL);
800 ++ if (!in_env)
801 ++ return -ENOMEM;
802 + for (i = 0; i < desc->in_num; i++) {
803 + u32 in_size, copy;
804 +
805 +@@ -986,14 +1015,17 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
806 + if (in_size == UINT_MAX) {
807 + dev_err(dev, "%s:%s unknown input size cmd: %s field: %d\n",
808 + __func__, dimm_name, cmd_name, i);
809 +- return -ENXIO;
810 ++ rc = -ENXIO;
811 ++ goto out;
812 + }
813 +- if (in_len < sizeof(in_env))
814 +- copy = min_t(u32, sizeof(in_env) - in_len, in_size);
815 ++ if (in_len < ND_CMD_MAX_ENVELOPE)
816 ++ copy = min_t(u32, ND_CMD_MAX_ENVELOPE - in_len, in_size);
817 + else
818 + copy = 0;
819 +- if (copy && copy_from_user(&in_env[in_len], p + in_len, copy))
820 +- return -EFAULT;
821 ++ if (copy && copy_from_user(&in_env[in_len], p + in_len, copy)) {
822 ++ rc = -EFAULT;
823 ++ goto out;
824 ++ }
825 + in_len += in_size;
826 + }
827 +
828 +@@ -1005,6 +1037,12 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
829 + }
830 +
831 + /* process an output envelope */
832 ++ out_env = kzalloc(ND_CMD_MAX_ENVELOPE, GFP_KERNEL);
833 ++ if (!out_env) {
834 ++ rc = -ENOMEM;
835 ++ goto out;
836 ++ }
837 ++
838 + for (i = 0; i < desc->out_num; i++) {
839 + u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i,
840 + (u32 *) in_env, (u32 *) out_env, 0);
841 +@@ -1013,15 +1051,18 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
842 + if (out_size == UINT_MAX) {
843 + dev_dbg(dev, "%s unknown output size cmd: %s field: %d\n",
844 + dimm_name, cmd_name, i);
845 +- return -EFAULT;
846 ++ rc = -EFAULT;
847 ++ goto out;
848 + }
849 +- if (out_len < sizeof(out_env))
850 +- copy = min_t(u32, sizeof(out_env) - out_len, out_size);
851 ++ if (out_len < ND_CMD_MAX_ENVELOPE)
852 ++ copy = min_t(u32, ND_CMD_MAX_ENVELOPE - out_len, out_size);
853 + else
854 + copy = 0;
855 + if (copy && copy_from_user(&out_env[out_len],
856 +- p + in_len + out_len, copy))
857 +- return -EFAULT;
858 ++ p + in_len + out_len, copy)) {
859 ++ rc = -EFAULT;
860 ++ goto out;
861 ++ }
862 + out_len += out_size;
863 + }
864 +
865 +@@ -1029,19 +1070,23 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
866 + if (buf_len > ND_IOCTL_MAX_BUFLEN) {
867 + dev_dbg(dev, "%s cmd: %s buf_len: %llu > %d\n", dimm_name,
868 + cmd_name, buf_len, ND_IOCTL_MAX_BUFLEN);
869 +- return -EINVAL;
870 ++ rc = -EINVAL;
871 ++ goto out;
872 + }
873 +
874 + buf = vmalloc(buf_len);
875 +- if (!buf)
876 +- return -ENOMEM;
877 ++ if (!buf) {
878 ++ rc = -ENOMEM;
879 ++ goto out;
880 ++ }
881 +
882 + if (copy_from_user(buf, p, buf_len)) {
883 + rc = -EFAULT;
884 + goto out;
885 + }
886 +
887 +- nvdimm_bus_lock(&nvdimm_bus->dev);
888 ++ device_lock(dev);
889 ++ nvdimm_bus_lock(dev);
890 + rc = nd_cmd_clear_to_send(nvdimm_bus, nvdimm, func, buf);
891 + if (rc)
892 + goto out_unlock;
893 +@@ -1056,17 +1101,16 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
894 + nvdimm_account_cleared_poison(nvdimm_bus, clear_err->address,
895 + clear_err->cleared);
896 + }
897 +- nvdimm_bus_unlock(&nvdimm_bus->dev);
898 +
899 + if (copy_to_user(p, buf, buf_len))
900 + rc = -EFAULT;
901 +
902 +- vfree(buf);
903 +- return rc;
904 +-
905 +- out_unlock:
906 +- nvdimm_bus_unlock(&nvdimm_bus->dev);
907 +- out:
908 ++out_unlock:
909 ++ nvdimm_bus_unlock(dev);
910 ++ device_unlock(dev);
911 ++out:
912 ++ kfree(in_env);
913 ++ kfree(out_env);
914 + vfree(buf);
915 + return rc;
916 + }
917 +diff --git a/drivers/nvdimm/region.c b/drivers/nvdimm/region.c
918 +index b9ca0033cc99..f9130cc157e8 100644
919 +--- a/drivers/nvdimm/region.c
920 ++++ b/drivers/nvdimm/region.c
921 +@@ -42,17 +42,6 @@ static int nd_region_probe(struct device *dev)
922 + if (rc)
923 + return rc;
924 +
925 +- rc = nd_region_register_namespaces(nd_region, &err);
926 +- if (rc < 0)
927 +- return rc;
928 +-
929 +- ndrd = dev_get_drvdata(dev);
930 +- ndrd->ns_active = rc;
931 +- ndrd->ns_count = rc + err;
932 +-
933 +- if (rc && err && rc == err)
934 +- return -ENODEV;
935 +-
936 + if (is_nd_pmem(&nd_region->dev)) {
937 + struct resource ndr_res;
938 +
939 +@@ -68,6 +57,17 @@ static int nd_region_probe(struct device *dev)
940 + nvdimm_badblocks_populate(nd_region, &nd_region->bb, &ndr_res);
941 + }
942 +
943 ++ rc = nd_region_register_namespaces(nd_region, &err);
944 ++ if (rc < 0)
945 ++ return rc;
946 ++
947 ++ ndrd = dev_get_drvdata(dev);
948 ++ ndrd->ns_active = rc;
949 ++ ndrd->ns_count = rc + err;
950 ++
951 ++ if (rc && err && rc == err)
952 ++ return -ENODEV;
953 ++
954 + nd_region->btt_seed = nd_btt_create(nd_region);
955 + nd_region->pfn_seed = nd_pfn_create(nd_region);
956 + nd_region->dax_seed = nd_dax_create(nd_region);
957 +diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
958 +index e7377f1028ef..0303296e6d5b 100644
959 +--- a/drivers/nvdimm/region_devs.c
960 ++++ b/drivers/nvdimm/region_devs.c
961 +@@ -425,10 +425,12 @@ static ssize_t available_size_show(struct device *dev,
962 + * memory nvdimm_bus_lock() is dropped, but that's userspace's
963 + * problem to not race itself.
964 + */
965 ++ device_lock(dev);
966 + nvdimm_bus_lock(dev);
967 + wait_nvdimm_bus_probe_idle(dev);
968 + available = nd_region_available_dpa(nd_region);
969 + nvdimm_bus_unlock(dev);
970 ++ device_unlock(dev);
971 +
972 + return sprintf(buf, "%llu\n", available);
973 + }
974 +@@ -440,10 +442,12 @@ static ssize_t max_available_extent_show(struct device *dev,
975 + struct nd_region *nd_region = to_nd_region(dev);
976 + unsigned long long available = 0;
977 +
978 ++ device_lock(dev);
979 + nvdimm_bus_lock(dev);
980 + wait_nvdimm_bus_probe_idle(dev);
981 + available = nd_region_allocatable_dpa(nd_region);
982 + nvdimm_bus_unlock(dev);
983 ++ device_unlock(dev);
984 +
985 + return sprintf(buf, "%llu\n", available);
986 + }
987 +diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
988 +index 7dc4ffa24430..24cbd0a2cc69 100644
989 +--- a/drivers/scsi/fcoe/fcoe_ctlr.c
990 ++++ b/drivers/scsi/fcoe/fcoe_ctlr.c
991 +@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac);
992 + */
993 + static inline struct fcoe_rport *fcoe_ctlr_rport(struct fc_rport_priv *rdata)
994 + {
995 +- return (struct fcoe_rport *)(rdata + 1);
996 ++ return container_of(rdata, struct fcoe_rport, rdata);
997 + }
998 +
999 + /**
1000 +@@ -2281,7 +2281,7 @@ static void fcoe_ctlr_vn_start(struct fcoe_ctlr *fip)
1001 + */
1002 + static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
1003 + struct sk_buff *skb,
1004 +- struct fc_rport_priv *rdata)
1005 ++ struct fcoe_rport *frport)
1006 + {
1007 + struct fip_header *fiph;
1008 + struct fip_desc *desc = NULL;
1009 +@@ -2289,16 +2289,12 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
1010 + struct fip_wwn_desc *wwn = NULL;
1011 + struct fip_vn_desc *vn = NULL;
1012 + struct fip_size_desc *size = NULL;
1013 +- struct fcoe_rport *frport;
1014 + size_t rlen;
1015 + size_t dlen;
1016 + u32 desc_mask = 0;
1017 + u32 dtype;
1018 + u8 sub;
1019 +
1020 +- memset(rdata, 0, sizeof(*rdata) + sizeof(*frport));
1021 +- frport = fcoe_ctlr_rport(rdata);
1022 +-
1023 + fiph = (struct fip_header *)skb->data;
1024 + frport->flags = ntohs(fiph->fip_flags);
1025 +
1026 +@@ -2361,15 +2357,17 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
1027 + if (dlen != sizeof(struct fip_wwn_desc))
1028 + goto len_err;
1029 + wwn = (struct fip_wwn_desc *)desc;
1030 +- rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn);
1031 ++ frport->rdata.ids.node_name =
1032 ++ get_unaligned_be64(&wwn->fd_wwn);
1033 + break;
1034 + case FIP_DT_VN_ID:
1035 + if (dlen != sizeof(struct fip_vn_desc))
1036 + goto len_err;
1037 + vn = (struct fip_vn_desc *)desc;
1038 + memcpy(frport->vn_mac, vn->fd_mac, ETH_ALEN);
1039 +- rdata->ids.port_id = ntoh24(vn->fd_fc_id);
1040 +- rdata->ids.port_name = get_unaligned_be64(&vn->fd_wwpn);
1041 ++ frport->rdata.ids.port_id = ntoh24(vn->fd_fc_id);
1042 ++ frport->rdata.ids.port_name =
1043 ++ get_unaligned_be64(&vn->fd_wwpn);
1044 + break;
1045 + case FIP_DT_FC4F:
1046 + if (dlen != sizeof(struct fip_fc4_feat))
1047 +@@ -2750,10 +2748,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
1048 + {
1049 + struct fip_header *fiph;
1050 + enum fip_vn2vn_subcode sub;
1051 +- struct {
1052 +- struct fc_rport_priv rdata;
1053 +- struct fcoe_rport frport;
1054 +- } buf;
1055 ++ struct fcoe_rport frport = { };
1056 + int rc, vlan_id = 0;
1057 +
1058 + fiph = (struct fip_header *)skb->data;
1059 +@@ -2769,7 +2764,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
1060 + goto drop;
1061 + }
1062 +
1063 +- rc = fcoe_ctlr_vn_parse(fip, skb, &buf.rdata);
1064 ++ rc = fcoe_ctlr_vn_parse(fip, skb, &frport);
1065 + if (rc) {
1066 + LIBFCOE_FIP_DBG(fip, "vn_recv vn_parse error %d\n", rc);
1067 + goto drop;
1068 +@@ -2778,19 +2773,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
1069 + mutex_lock(&fip->ctlr_mutex);
1070 + switch (sub) {
1071 + case FIP_SC_VN_PROBE_REQ:
1072 +- fcoe_ctlr_vn_probe_req(fip, &buf.rdata);
1073 ++ fcoe_ctlr_vn_probe_req(fip, &frport.rdata);
1074 + break;
1075 + case FIP_SC_VN_PROBE_REP:
1076 +- fcoe_ctlr_vn_probe_reply(fip, &buf.rdata);
1077 ++ fcoe_ctlr_vn_probe_reply(fip, &frport.rdata);
1078 + break;
1079 + case FIP_SC_VN_CLAIM_NOTIFY:
1080 +- fcoe_ctlr_vn_claim_notify(fip, &buf.rdata);
1081 ++ fcoe_ctlr_vn_claim_notify(fip, &frport.rdata);
1082 + break;
1083 + case FIP_SC_VN_CLAIM_REP:
1084 +- fcoe_ctlr_vn_claim_resp(fip, &buf.rdata);
1085 ++ fcoe_ctlr_vn_claim_resp(fip, &frport.rdata);
1086 + break;
1087 + case FIP_SC_VN_BEACON:
1088 +- fcoe_ctlr_vn_beacon(fip, &buf.rdata);
1089 ++ fcoe_ctlr_vn_beacon(fip, &frport.rdata);
1090 + break;
1091 + default:
1092 + LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub);
1093 +@@ -2814,22 +2809,18 @@ drop:
1094 + */
1095 + static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip,
1096 + struct sk_buff *skb,
1097 +- struct fc_rport_priv *rdata)
1098 ++ struct fcoe_rport *frport)
1099 + {
1100 + struct fip_header *fiph;
1101 + struct fip_desc *desc = NULL;
1102 + struct fip_mac_desc *macd = NULL;
1103 + struct fip_wwn_desc *wwn = NULL;
1104 +- struct fcoe_rport *frport;
1105 + size_t rlen;
1106 + size_t dlen;
1107 + u32 desc_mask = 0;
1108 + u32 dtype;
1109 + u8 sub;
1110 +
1111 +- memset(rdata, 0, sizeof(*rdata) + sizeof(*frport));
1112 +- frport = fcoe_ctlr_rport(rdata);
1113 +-
1114 + fiph = (struct fip_header *)skb->data;
1115 + frport->flags = ntohs(fiph->fip_flags);
1116 +
1117 +@@ -2883,7 +2874,8 @@ static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip,
1118 + if (dlen != sizeof(struct fip_wwn_desc))
1119 + goto len_err;
1120 + wwn = (struct fip_wwn_desc *)desc;
1121 +- rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn);
1122 ++ frport->rdata.ids.node_name =
1123 ++ get_unaligned_be64(&wwn->fd_wwn);
1124 + break;
1125 + default:
1126 + LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x "
1127 +@@ -2994,22 +2986,19 @@ static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
1128 + {
1129 + struct fip_header *fiph;
1130 + enum fip_vlan_subcode sub;
1131 +- struct {
1132 +- struct fc_rport_priv rdata;
1133 +- struct fcoe_rport frport;
1134 +- } buf;
1135 ++ struct fcoe_rport frport = { };
1136 + int rc;
1137 +
1138 + fiph = (struct fip_header *)skb->data;
1139 + sub = fiph->fip_subcode;
1140 +- rc = fcoe_ctlr_vlan_parse(fip, skb, &buf.rdata);
1141 ++ rc = fcoe_ctlr_vlan_parse(fip, skb, &frport);
1142 + if (rc) {
1143 + LIBFCOE_FIP_DBG(fip, "vlan_recv vlan_parse error %d\n", rc);
1144 + goto drop;
1145 + }
1146 + mutex_lock(&fip->ctlr_mutex);
1147 + if (sub == FIP_SC_VL_REQ)
1148 +- fcoe_ctlr_vlan_disc_reply(fip, &buf.rdata);
1149 ++ fcoe_ctlr_vlan_disc_reply(fip, &frport.rdata);
1150 + mutex_unlock(&fip->ctlr_mutex);
1151 +
1152 + drop:
1153 +diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
1154 +index 3d51a936f6d5..90a748551ede 100644
1155 +--- a/drivers/scsi/libfc/fc_rport.c
1156 ++++ b/drivers/scsi/libfc/fc_rport.c
1157 +@@ -140,6 +140,7 @@ EXPORT_SYMBOL(fc_rport_lookup);
1158 + struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
1159 + {
1160 + struct fc_rport_priv *rdata;
1161 ++ size_t rport_priv_size = sizeof(*rdata);
1162 +
1163 + lockdep_assert_held(&lport->disc.disc_mutex);
1164 +
1165 +@@ -147,7 +148,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
1166 + if (rdata)
1167 + return rdata;
1168 +
1169 +- rdata = kzalloc(sizeof(*rdata) + lport->rport_priv_size, GFP_KERNEL);
1170 ++ if (lport->rport_priv_size > 0)
1171 ++ rport_priv_size = lport->rport_priv_size;
1172 ++ rdata = kzalloc(rport_priv_size, GFP_KERNEL);
1173 + if (!rdata)
1174 + return NULL;
1175 +
1176 +diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
1177 +index 25abf2d1732a..eab27d41ba83 100644
1178 +--- a/drivers/spi/spi-bcm2835.c
1179 ++++ b/drivers/spi/spi-bcm2835.c
1180 +@@ -554,7 +554,8 @@ static int bcm2835_spi_transfer_one(struct spi_master *master,
1181 + bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
1182 +
1183 + /* handle all the 3-wire mode */
1184 +- if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf))
1185 ++ if (spi->mode & SPI_3WIRE && tfr->rx_buf &&
1186 ++ tfr->rx_buf != master->dummy_rx)
1187 + cs |= BCM2835_SPI_CS_REN;
1188 + else
1189 + cs &= ~BCM2835_SPI_CS_REN;
1190 +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
1191 +index a9b00942e87d..8f08095ee54e 100644
1192 +--- a/fs/compat_ioctl.c
1193 ++++ b/fs/compat_ioctl.c
1194 +@@ -894,9 +894,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN)
1195 + COMPATIBLE_IOCTL(PPPIOCATTCHAN)
1196 + COMPATIBLE_IOCTL(PPPIOCGCHAN)
1197 + COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS)
1198 +-/* PPPOX */
1199 +-COMPATIBLE_IOCTL(PPPOEIOCSFWD)
1200 +-COMPATIBLE_IOCTL(PPPOEIOCDFWD)
1201 + /* Big A */
1202 + /* sparc only */
1203 + /* Big Q for sound/OSS */
1204 +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
1205 +index a6090154b2ab..a01ebb630abc 100644
1206 +--- a/include/linux/cgroup-defs.h
1207 ++++ b/include/linux/cgroup-defs.h
1208 +@@ -207,6 +207,7 @@ struct css_set {
1209 + */
1210 + struct list_head tasks;
1211 + struct list_head mg_tasks;
1212 ++ struct list_head dying_tasks;
1213 +
1214 + /* all css_task_iters currently walking this cset */
1215 + struct list_head task_iters;
1216 +diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
1217 +index 8937d48a5389..b4854b48a4f3 100644
1218 +--- a/include/linux/cgroup.h
1219 ++++ b/include/linux/cgroup.h
1220 +@@ -43,6 +43,9 @@
1221 + /* walk all threaded css_sets in the domain */
1222 + #define CSS_TASK_ITER_THREADED (1U << 1)
1223 +
1224 ++/* internal flags */
1225 ++#define CSS_TASK_ITER_SKIPPED (1U << 16)
1226 ++
1227 + /* a css_task_iter should be treated as an opaque object */
1228 + struct css_task_iter {
1229 + struct cgroup_subsys *ss;
1230 +@@ -57,6 +60,7 @@ struct css_task_iter {
1231 + struct list_head *task_pos;
1232 + struct list_head *tasks_head;
1233 + struct list_head *mg_tasks_head;
1234 ++ struct list_head *dying_tasks_head;
1235 +
1236 + struct css_set *cur_cset;
1237 + struct css_set *cur_dcset;
1238 +diff --git a/include/linux/device.h b/include/linux/device.h
1239 +index 3f1066a9e1c3..19dd8852602c 100644
1240 +--- a/include/linux/device.h
1241 ++++ b/include/linux/device.h
1242 +@@ -1332,6 +1332,7 @@ extern int (*platform_notify_remove)(struct device *dev);
1243 + */
1244 + extern struct device *get_device(struct device *dev);
1245 + extern void put_device(struct device *dev);
1246 ++extern bool kill_device(struct device *dev);
1247 +
1248 + #ifdef CONFIG_DEVTMPFS
1249 + extern int devtmpfs_create_node(struct device *dev);
1250 +diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
1251 +index ba7a9b0c7c57..24e9b360da65 100644
1252 +--- a/include/linux/if_pppox.h
1253 ++++ b/include/linux/if_pppox.h
1254 +@@ -84,6 +84,9 @@ extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
1255 + extern void unregister_pppox_proto(int proto_num);
1256 + extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
1257 + extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
1258 ++extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
1259 ++
1260 ++#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t)
1261 +
1262 + /* PPPoX socket states */
1263 + enum {
1264 +diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
1265 +index 804516e4f483..3386399feadc 100644
1266 +--- a/include/linux/mlx5/fs.h
1267 ++++ b/include/linux/mlx5/fs.h
1268 +@@ -188,6 +188,7 @@ int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler,
1269 + struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handler);
1270 + struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
1271 + void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
1272 ++u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter);
1273 + void mlx5_fc_query_cached(struct mlx5_fc *counter,
1274 + u64 *bytes, u64 *packets, u64 *lastuse);
1275 + int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
1276 +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
1277 +index f043d65b9bac..177f11c96187 100644
1278 +--- a/include/linux/mlx5/mlx5_ifc.h
1279 ++++ b/include/linux/mlx5/mlx5_ifc.h
1280 +@@ -5623,7 +5623,12 @@ struct mlx5_ifc_modify_cq_in_bits {
1281 +
1282 + struct mlx5_ifc_cqc_bits cq_context;
1283 +
1284 +- u8 reserved_at_280[0x600];
1285 ++ u8 reserved_at_280[0x60];
1286 ++
1287 ++ u8 cq_umem_valid[0x1];
1288 ++ u8 reserved_at_2e1[0x1f];
1289 ++
1290 ++ u8 reserved_at_300[0x580];
1291 +
1292 + u8 pas[0][0x40];
1293 + };
1294 +diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
1295 +index bb8092fa1e36..58507c7783cf 100644
1296 +--- a/include/scsi/libfcoe.h
1297 ++++ b/include/scsi/libfcoe.h
1298 +@@ -241,6 +241,7 @@ struct fcoe_fcf {
1299 + * @vn_mac: VN_Node assigned MAC address for data
1300 + */
1301 + struct fcoe_rport {
1302 ++ struct fc_rport_priv rdata;
1303 + unsigned long time;
1304 + u16 fcoe_len;
1305 + u16 flags;
1306 +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
1307 +index 81441117f611..78ef274b036e 100644
1308 +--- a/kernel/cgroup/cgroup.c
1309 ++++ b/kernel/cgroup/cgroup.c
1310 +@@ -212,7 +212,8 @@ static struct cftype cgroup_base_files[];
1311 +
1312 + static int cgroup_apply_control(struct cgroup *cgrp);
1313 + static void cgroup_finalize_control(struct cgroup *cgrp, int ret);
1314 +-static void css_task_iter_advance(struct css_task_iter *it);
1315 ++static void css_task_iter_skip(struct css_task_iter *it,
1316 ++ struct task_struct *task);
1317 + static int cgroup_destroy_locked(struct cgroup *cgrp);
1318 + static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
1319 + struct cgroup_subsys *ss);
1320 +@@ -672,6 +673,7 @@ struct css_set init_css_set = {
1321 + .dom_cset = &init_css_set,
1322 + .tasks = LIST_HEAD_INIT(init_css_set.tasks),
1323 + .mg_tasks = LIST_HEAD_INIT(init_css_set.mg_tasks),
1324 ++ .dying_tasks = LIST_HEAD_INIT(init_css_set.dying_tasks),
1325 + .task_iters = LIST_HEAD_INIT(init_css_set.task_iters),
1326 + .threaded_csets = LIST_HEAD_INIT(init_css_set.threaded_csets),
1327 + .cgrp_links = LIST_HEAD_INIT(init_css_set.cgrp_links),
1328 +@@ -775,6 +777,21 @@ static void css_set_update_populated(struct css_set *cset, bool populated)
1329 + cgroup_update_populated(link->cgrp, populated);
1330 + }
1331 +
1332 ++/*
1333 ++ * @task is leaving, advance task iterators which are pointing to it so
1334 ++ * that they can resume at the next position. Advancing an iterator might
1335 ++ * remove it from the list, use safe walk. See css_task_iter_skip() for
1336 ++ * details.
1337 ++ */
1338 ++static void css_set_skip_task_iters(struct css_set *cset,
1339 ++ struct task_struct *task)
1340 ++{
1341 ++ struct css_task_iter *it, *pos;
1342 ++
1343 ++ list_for_each_entry_safe(it, pos, &cset->task_iters, iters_node)
1344 ++ css_task_iter_skip(it, task);
1345 ++}
1346 ++
1347 + /**
1348 + * css_set_move_task - move a task from one css_set to another
1349 + * @task: task being moved
1350 +@@ -800,22 +817,9 @@ static void css_set_move_task(struct task_struct *task,
1351 + css_set_update_populated(to_cset, true);
1352 +
1353 + if (from_cset) {
1354 +- struct css_task_iter *it, *pos;
1355 +-
1356 + WARN_ON_ONCE(list_empty(&task->cg_list));
1357 +
1358 +- /*
1359 +- * @task is leaving, advance task iterators which are
1360 +- * pointing to it so that they can resume at the next
1361 +- * position. Advancing an iterator might remove it from
1362 +- * the list, use safe walk. See css_task_iter_advance*()
1363 +- * for details.
1364 +- */
1365 +- list_for_each_entry_safe(it, pos, &from_cset->task_iters,
1366 +- iters_node)
1367 +- if (it->task_pos == &task->cg_list)
1368 +- css_task_iter_advance(it);
1369 +-
1370 ++ css_set_skip_task_iters(from_cset, task);
1371 + list_del_init(&task->cg_list);
1372 + if (!css_set_populated(from_cset))
1373 + css_set_update_populated(from_cset, false);
1374 +@@ -1142,6 +1146,7 @@ static struct css_set *find_css_set(struct css_set *old_cset,
1375 + cset->dom_cset = cset;
1376 + INIT_LIST_HEAD(&cset->tasks);
1377 + INIT_LIST_HEAD(&cset->mg_tasks);
1378 ++ INIT_LIST_HEAD(&cset->dying_tasks);
1379 + INIT_LIST_HEAD(&cset->task_iters);
1380 + INIT_LIST_HEAD(&cset->threaded_csets);
1381 + INIT_HLIST_NODE(&cset->hlist);
1382 +@@ -4149,15 +4154,18 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it)
1383 + it->task_pos = NULL;
1384 + return;
1385 + }
1386 +- } while (!css_set_populated(cset));
1387 ++ } while (!css_set_populated(cset) && list_empty(&cset->dying_tasks));
1388 +
1389 + if (!list_empty(&cset->tasks))
1390 + it->task_pos = cset->tasks.next;
1391 +- else
1392 ++ else if (!list_empty(&cset->mg_tasks))
1393 + it->task_pos = cset->mg_tasks.next;
1394 ++ else
1395 ++ it->task_pos = cset->dying_tasks.next;
1396 +
1397 + it->tasks_head = &cset->tasks;
1398 + it->mg_tasks_head = &cset->mg_tasks;
1399 ++ it->dying_tasks_head = &cset->dying_tasks;
1400 +
1401 + /*
1402 + * We don't keep css_sets locked across iteration steps and thus
1403 +@@ -4183,9 +4191,20 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it)
1404 + list_add(&it->iters_node, &cset->task_iters);
1405 + }
1406 +
1407 ++static void css_task_iter_skip(struct css_task_iter *it,
1408 ++ struct task_struct *task)
1409 ++{
1410 ++ lockdep_assert_held(&css_set_lock);
1411 ++
1412 ++ if (it->task_pos == &task->cg_list) {
1413 ++ it->task_pos = it->task_pos->next;
1414 ++ it->flags |= CSS_TASK_ITER_SKIPPED;
1415 ++ }
1416 ++}
1417 ++
1418 + static void css_task_iter_advance(struct css_task_iter *it)
1419 + {
1420 +- struct list_head *next;
1421 ++ struct task_struct *task;
1422 +
1423 + lockdep_assert_held(&css_set_lock);
1424 + repeat:
1425 +@@ -4195,25 +4214,40 @@ repeat:
1426 + * consumed first and then ->mg_tasks. After ->mg_tasks,
1427 + * we move onto the next cset.
1428 + */
1429 +- next = it->task_pos->next;
1430 +-
1431 +- if (next == it->tasks_head)
1432 +- next = it->mg_tasks_head->next;
1433 ++ if (it->flags & CSS_TASK_ITER_SKIPPED)
1434 ++ it->flags &= ~CSS_TASK_ITER_SKIPPED;
1435 ++ else
1436 ++ it->task_pos = it->task_pos->next;
1437 +
1438 +- if (next == it->mg_tasks_head)
1439 ++ if (it->task_pos == it->tasks_head)
1440 ++ it->task_pos = it->mg_tasks_head->next;
1441 ++ if (it->task_pos == it->mg_tasks_head)
1442 ++ it->task_pos = it->dying_tasks_head->next;
1443 ++ if (it->task_pos == it->dying_tasks_head)
1444 + css_task_iter_advance_css_set(it);
1445 +- else
1446 +- it->task_pos = next;
1447 + } else {
1448 + /* called from start, proceed to the first cset */
1449 + css_task_iter_advance_css_set(it);
1450 + }
1451 +
1452 +- /* if PROCS, skip over tasks which aren't group leaders */
1453 +- if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos &&
1454 +- !thread_group_leader(list_entry(it->task_pos, struct task_struct,
1455 +- cg_list)))
1456 +- goto repeat;
1457 ++ if (!it->task_pos)
1458 ++ return;
1459 ++
1460 ++ task = list_entry(it->task_pos, struct task_struct, cg_list);
1461 ++
1462 ++ if (it->flags & CSS_TASK_ITER_PROCS) {
1463 ++ /* if PROCS, skip over tasks which aren't group leaders */
1464 ++ if (!thread_group_leader(task))
1465 ++ goto repeat;
1466 ++
1467 ++ /* and dying leaders w/o live member threads */
1468 ++ if (!atomic_read(&task->signal->live))
1469 ++ goto repeat;
1470 ++ } else {
1471 ++ /* skip all dying ones */
1472 ++ if (task->flags & PF_EXITING)
1473 ++ goto repeat;
1474 ++ }
1475 + }
1476 +
1477 + /**
1478 +@@ -4269,6 +4303,10 @@ struct task_struct *css_task_iter_next(struct css_task_iter *it)
1479 +
1480 + spin_lock_irq(&css_set_lock);
1481 +
1482 ++ /* @it may be half-advanced by skips, finish advancing */
1483 ++ if (it->flags & CSS_TASK_ITER_SKIPPED)
1484 ++ css_task_iter_advance(it);
1485 ++
1486 + if (it->task_pos) {
1487 + it->cur_task = list_entry(it->task_pos, struct task_struct,
1488 + cg_list);
1489 +@@ -5670,6 +5708,7 @@ void cgroup_exit(struct task_struct *tsk)
1490 + if (!list_empty(&tsk->cg_list)) {
1491 + spin_lock_irq(&css_set_lock);
1492 + css_set_move_task(tsk, cset, NULL, false);
1493 ++ list_add_tail(&tsk->cg_list, &cset->dying_tasks);
1494 + cset->nr_tasks--;
1495 + spin_unlock_irq(&css_set_lock);
1496 + } else {
1497 +@@ -5690,6 +5729,13 @@ void cgroup_release(struct task_struct *task)
1498 + do_each_subsys_mask(ss, ssid, have_release_callback) {
1499 + ss->release(task);
1500 + } while_each_subsys_mask();
1501 ++
1502 ++ if (use_task_css_set_links) {
1503 ++ spin_lock_irq(&css_set_lock);
1504 ++ css_set_skip_task_iters(task_css_set(task), task);
1505 ++ list_del_init(&task->cg_list);
1506 ++ spin_unlock_irq(&css_set_lock);
1507 ++ }
1508 + }
1509 +
1510 + void cgroup_free(struct task_struct *task)
1511 +diff --git a/kernel/exit.c b/kernel/exit.c
1512 +index 5c0964dc805a..e10de9836dd7 100644
1513 +--- a/kernel/exit.c
1514 ++++ b/kernel/exit.c
1515 +@@ -194,6 +194,7 @@ repeat:
1516 + rcu_read_unlock();
1517 +
1518 + proc_flush_task(p);
1519 ++ cgroup_release(p);
1520 +
1521 + write_lock_irq(&tasklist_lock);
1522 + ptrace_release_task(p);
1523 +@@ -219,7 +220,6 @@ repeat:
1524 + }
1525 +
1526 + write_unlock_irq(&tasklist_lock);
1527 +- cgroup_release(p);
1528 + release_thread(p);
1529 + call_rcu(&p->rcu, delayed_put_task_struct);
1530 +
1531 +diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
1532 +index fb54d32321ec..6a362da211e1 100644
1533 +--- a/net/bridge/br_multicast.c
1534 ++++ b/net/bridge/br_multicast.c
1535 +@@ -1621,6 +1621,9 @@ br_multicast_leave_group(struct net_bridge *br,
1536 + if (!br_port_group_equal(p, port, src))
1537 + continue;
1538 +
1539 ++ if (p->flags & MDB_PG_FLAGS_PERMANENT)
1540 ++ break;
1541 ++
1542 + rcu_assign_pointer(*pp, p->next);
1543 + hlist_del_init(&p->mglist);
1544 + del_timer(&p->timer);
1545 +diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
1546 +index 7df269092103..5f3950f00f73 100644
1547 +--- a/net/bridge/br_vlan.c
1548 ++++ b/net/bridge/br_vlan.c
1549 +@@ -677,6 +677,11 @@ void br_vlan_flush(struct net_bridge *br)
1550 +
1551 + ASSERT_RTNL();
1552 +
1553 ++ /* delete auto-added default pvid local fdb before flushing vlans
1554 ++ * otherwise it will be leaked on bridge device init failure
1555 ++ */
1556 ++ br_fdb_delete_by_port(br, NULL, 0, 1);
1557 ++
1558 + vg = br_vlan_group(br);
1559 + __vlan_flush(vg);
1560 + RCU_INIT_POINTER(br->vlgrp, NULL);
1561 +diff --git a/net/core/dev.c b/net/core/dev.c
1562 +index 138951d28643..e4b4cb40da00 100644
1563 +--- a/net/core/dev.c
1564 ++++ b/net/core/dev.c
1565 +@@ -9510,6 +9510,8 @@ static void __net_exit default_device_exit(struct net *net)
1566 +
1567 + /* Push remaining network devices to init_net */
1568 + snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex);
1569 ++ if (__dev_get_by_name(&init_net, fb_name))
1570 ++ snprintf(fb_name, IFNAMSIZ, "dev%%d");
1571 + err = dev_change_net_namespace(dev, &init_net, fb_name);
1572 + if (err) {
1573 + pr_emerg("%s: failed to move %s to init_net: %d\n",
1574 +diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
1575 +index c891235b4966..4368282eb6f8 100644
1576 +--- a/net/ipv4/ipip.c
1577 ++++ b/net/ipv4/ipip.c
1578 +@@ -281,6 +281,9 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb,
1579 + const struct iphdr *tiph = &tunnel->parms.iph;
1580 + u8 ipproto;
1581 +
1582 ++ if (!pskb_inet_may_pull(skb))
1583 ++ goto tx_error;
1584 ++
1585 + switch (skb->protocol) {
1586 + case htons(ETH_P_IP):
1587 + ipproto = IPPROTO_IPIP;
1588 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
1589 +index 01ecd510014f..a53ef079a539 100644
1590 +--- a/net/ipv6/ip6_gre.c
1591 ++++ b/net/ipv6/ip6_gre.c
1592 +@@ -680,12 +680,13 @@ static int prepare_ip6gre_xmit_ipv6(struct sk_buff *skb,
1593 + struct flowi6 *fl6, __u8 *dsfield,
1594 + int *encap_limit)
1595 + {
1596 +- struct ipv6hdr *ipv6h = ipv6_hdr(skb);
1597 ++ struct ipv6hdr *ipv6h;
1598 + struct ip6_tnl *t = netdev_priv(dev);
1599 + __u16 offset;
1600 +
1601 + offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb));
1602 + /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */
1603 ++ ipv6h = ipv6_hdr(skb);
1604 +
1605 + if (offset > 0) {
1606 + struct ipv6_tlv_tnl_enc_lim *tel;
1607 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
1608 +index ade1390c6348..d0ad85b8650d 100644
1609 +--- a/net/ipv6/ip6_tunnel.c
1610 ++++ b/net/ipv6/ip6_tunnel.c
1611 +@@ -1283,12 +1283,11 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1612 + }
1613 +
1614 + fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL);
1615 ++ dsfield = INET_ECN_encapsulate(dsfield, ipv4_get_dsfield(iph));
1616 +
1617 + if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
1618 + return -1;
1619 +
1620 +- dsfield = INET_ECN_encapsulate(dsfield, ipv4_get_dsfield(iph));
1621 +-
1622 + skb_set_inner_ipproto(skb, IPPROTO_IPIP);
1623 +
1624 + err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
1625 +@@ -1372,12 +1371,11 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1626 + }
1627 +
1628 + fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL);
1629 ++ dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h));
1630 +
1631 + if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
1632 + return -1;
1633 +
1634 +- dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h));
1635 +-
1636 + skb_set_inner_ipproto(skb, IPPROTO_IPV6);
1637 +
1638 + err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
1639 +diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
1640 +index 04d9946dcdba..c0956781665e 100644
1641 +--- a/net/l2tp/l2tp_ppp.c
1642 ++++ b/net/l2tp/l2tp_ppp.c
1643 +@@ -1686,6 +1686,9 @@ static const struct proto_ops pppol2tp_ops = {
1644 + .recvmsg = pppol2tp_recvmsg,
1645 + .mmap = sock_no_mmap,
1646 + .ioctl = pppox_ioctl,
1647 ++#ifdef CONFIG_COMPAT
1648 ++ .compat_ioctl = pppox_compat_ioctl,
1649 ++#endif
1650 + };
1651 +
1652 + static const struct pppox_proto pppol2tp_proto = {
1653 +diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
1654 +index 0c68bc9cf0b4..20fae5ca87fa 100644
1655 +--- a/net/sched/act_bpf.c
1656 ++++ b/net/sched/act_bpf.c
1657 +@@ -287,6 +287,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
1658 + struct tcf_bpf *prog;
1659 + bool is_bpf, is_ebpf;
1660 + int ret, res = 0;
1661 ++ u32 index;
1662 +
1663 + if (!nla)
1664 + return -EINVAL;
1665 +@@ -299,13 +300,13 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
1666 + return -EINVAL;
1667 +
1668 + parm = nla_data(tb[TCA_ACT_BPF_PARMS]);
1669 +-
1670 +- ret = tcf_idr_check_alloc(tn, &parm->index, act, bind);
1671 ++ index = parm->index;
1672 ++ ret = tcf_idr_check_alloc(tn, &index, act, bind);
1673 + if (!ret) {
1674 +- ret = tcf_idr_create(tn, parm->index, est, act,
1675 ++ ret = tcf_idr_create(tn, index, est, act,
1676 + &act_bpf_ops, bind, true);
1677 + if (ret < 0) {
1678 +- tcf_idr_cleanup(tn, parm->index);
1679 ++ tcf_idr_cleanup(tn, index);
1680 + return ret;
1681 + }
1682 +
1683 +diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
1684 +index 6f0f273f1139..605436747978 100644
1685 +--- a/net/sched/act_connmark.c
1686 ++++ b/net/sched/act_connmark.c
1687 +@@ -104,6 +104,7 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
1688 + struct tcf_connmark_info *ci;
1689 + struct tc_connmark *parm;
1690 + int ret = 0;
1691 ++ u32 index;
1692 +
1693 + if (!nla)
1694 + return -EINVAL;
1695 +@@ -117,13 +118,13 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
1696 + return -EINVAL;
1697 +
1698 + parm = nla_data(tb[TCA_CONNMARK_PARMS]);
1699 +-
1700 +- ret = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1701 ++ index = parm->index;
1702 ++ ret = tcf_idr_check_alloc(tn, &index, a, bind);
1703 + if (!ret) {
1704 +- ret = tcf_idr_create(tn, parm->index, est, a,
1705 ++ ret = tcf_idr_create(tn, index, est, a,
1706 + &act_connmark_ops, bind, false);
1707 + if (ret) {
1708 +- tcf_idr_cleanup(tn, parm->index);
1709 ++ tcf_idr_cleanup(tn, index);
1710 + return ret;
1711 + }
1712 +
1713 +diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
1714 +index b8a67ae3105a..40437197e053 100644
1715 +--- a/net/sched/act_csum.c
1716 ++++ b/net/sched/act_csum.c
1717 +@@ -55,6 +55,7 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
1718 + struct tc_csum *parm;
1719 + struct tcf_csum *p;
1720 + int ret = 0, err;
1721 ++ u32 index;
1722 +
1723 + if (nla == NULL)
1724 + return -EINVAL;
1725 +@@ -66,13 +67,13 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
1726 + if (tb[TCA_CSUM_PARMS] == NULL)
1727 + return -EINVAL;
1728 + parm = nla_data(tb[TCA_CSUM_PARMS]);
1729 +-
1730 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1731 ++ index = parm->index;
1732 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1733 + if (!err) {
1734 +- ret = tcf_idr_create(tn, parm->index, est, a,
1735 ++ ret = tcf_idr_create(tn, index, est, a,
1736 + &act_csum_ops, bind, true);
1737 + if (ret) {
1738 +- tcf_idr_cleanup(tn, parm->index);
1739 ++ tcf_idr_cleanup(tn, index);
1740 + return ret;
1741 + }
1742 + ret = ACT_P_CREATED;
1743 +diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
1744 +index cd1d9bd32ef9..72d3347bdd41 100644
1745 +--- a/net/sched/act_gact.c
1746 ++++ b/net/sched/act_gact.c
1747 +@@ -64,6 +64,7 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
1748 + struct tc_gact *parm;
1749 + struct tcf_gact *gact;
1750 + int ret = 0;
1751 ++ u32 index;
1752 + int err;
1753 + #ifdef CONFIG_GACT_PROB
1754 + struct tc_gact_p *p_parm = NULL;
1755 +@@ -79,6 +80,7 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
1756 + if (tb[TCA_GACT_PARMS] == NULL)
1757 + return -EINVAL;
1758 + parm = nla_data(tb[TCA_GACT_PARMS]);
1759 ++ index = parm->index;
1760 +
1761 + #ifndef CONFIG_GACT_PROB
1762 + if (tb[TCA_GACT_PROB] != NULL)
1763 +@@ -91,12 +93,12 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
1764 + }
1765 + #endif
1766 +
1767 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1768 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1769 + if (!err) {
1770 +- ret = tcf_idr_create(tn, parm->index, est, a,
1771 ++ ret = tcf_idr_create(tn, index, est, a,
1772 + &act_gact_ops, bind, true);
1773 + if (ret) {
1774 +- tcf_idr_cleanup(tn, parm->index);
1775 ++ tcf_idr_cleanup(tn, index);
1776 + return ret;
1777 + }
1778 + ret = ACT_P_CREATED;
1779 +diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
1780 +index 06a3d4801878..24047e0e5db0 100644
1781 +--- a/net/sched/act_ife.c
1782 ++++ b/net/sched/act_ife.c
1783 +@@ -482,8 +482,14 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
1784 + u8 *saddr = NULL;
1785 + bool exists = false;
1786 + int ret = 0;
1787 ++ u32 index;
1788 + int err;
1789 +
1790 ++ if (!nla) {
1791 ++ NL_SET_ERR_MSG_MOD(extack, "IFE requires attributes to be passed");
1792 ++ return -EINVAL;
1793 ++ }
1794 ++
1795 + err = nla_parse_nested(tb, TCA_IFE_MAX, nla, ife_policy, NULL);
1796 + if (err < 0)
1797 + return err;
1798 +@@ -504,7 +510,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
1799 + if (!p)
1800 + return -ENOMEM;
1801 +
1802 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1803 ++ index = parm->index;
1804 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1805 + if (err < 0) {
1806 + kfree(p);
1807 + return err;
1808 +@@ -516,10 +523,10 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
1809 + }
1810 +
1811 + if (!exists) {
1812 +- ret = tcf_idr_create(tn, parm->index, est, a, &act_ife_ops,
1813 ++ ret = tcf_idr_create(tn, index, est, a, &act_ife_ops,
1814 + bind, true);
1815 + if (ret) {
1816 +- tcf_idr_cleanup(tn, parm->index);
1817 ++ tcf_idr_cleanup(tn, index);
1818 + kfree(p);
1819 + return ret;
1820 + }
1821 +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
1822 +index f767e78e38c9..548614bd9366 100644
1823 +--- a/net/sched/act_mirred.c
1824 ++++ b/net/sched/act_mirred.c
1825 +@@ -104,6 +104,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
1826 + struct net_device *dev;
1827 + bool exists = false;
1828 + int ret, err;
1829 ++ u32 index;
1830 +
1831 + if (!nla) {
1832 + NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed");
1833 +@@ -117,8 +118,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
1834 + return -EINVAL;
1835 + }
1836 + parm = nla_data(tb[TCA_MIRRED_PARMS]);
1837 +-
1838 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1839 ++ index = parm->index;
1840 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1841 + if (err < 0)
1842 + return err;
1843 + exists = err;
1844 +@@ -135,21 +136,21 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
1845 + if (exists)
1846 + tcf_idr_release(*a, bind);
1847 + else
1848 +- tcf_idr_cleanup(tn, parm->index);
1849 ++ tcf_idr_cleanup(tn, index);
1850 + NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option");
1851 + return -EINVAL;
1852 + }
1853 +
1854 + if (!exists) {
1855 + if (!parm->ifindex) {
1856 +- tcf_idr_cleanup(tn, parm->index);
1857 ++ tcf_idr_cleanup(tn, index);
1858 + NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist");
1859 + return -EINVAL;
1860 + }
1861 +- ret = tcf_idr_create(tn, parm->index, est, a,
1862 ++ ret = tcf_idr_create(tn, index, est, a,
1863 + &act_mirred_ops, bind, true);
1864 + if (ret) {
1865 +- tcf_idr_cleanup(tn, parm->index);
1866 ++ tcf_idr_cleanup(tn, index);
1867 + return ret;
1868 + }
1869 + ret = ACT_P_CREATED;
1870 +diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
1871 +index 4313aa102440..619828920b97 100644
1872 +--- a/net/sched/act_nat.c
1873 ++++ b/net/sched/act_nat.c
1874 +@@ -45,6 +45,7 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
1875 + struct tc_nat *parm;
1876 + int ret = 0, err;
1877 + struct tcf_nat *p;
1878 ++ u32 index;
1879 +
1880 + if (nla == NULL)
1881 + return -EINVAL;
1882 +@@ -56,13 +57,13 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
1883 + if (tb[TCA_NAT_PARMS] == NULL)
1884 + return -EINVAL;
1885 + parm = nla_data(tb[TCA_NAT_PARMS]);
1886 +-
1887 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1888 ++ index = parm->index;
1889 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1890 + if (!err) {
1891 +- ret = tcf_idr_create(tn, parm->index, est, a,
1892 ++ ret = tcf_idr_create(tn, index, est, a,
1893 + &act_nat_ops, bind, false);
1894 + if (ret) {
1895 +- tcf_idr_cleanup(tn, parm->index);
1896 ++ tcf_idr_cleanup(tn, index);
1897 + return ret;
1898 + }
1899 + ret = ACT_P_CREATED;
1900 +diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
1901 +index ca535a8585bc..82d258b2a75a 100644
1902 +--- a/net/sched/act_pedit.c
1903 ++++ b/net/sched/act_pedit.c
1904 +@@ -149,6 +149,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
1905 + struct tcf_pedit *p;
1906 + int ret = 0, err;
1907 + int ksize;
1908 ++ u32 index;
1909 +
1910 + if (!nla) {
1911 + NL_SET_ERR_MSG_MOD(extack, "Pedit requires attributes to be passed");
1912 +@@ -178,18 +179,19 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
1913 + if (IS_ERR(keys_ex))
1914 + return PTR_ERR(keys_ex);
1915 +
1916 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1917 ++ index = parm->index;
1918 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1919 + if (!err) {
1920 + if (!parm->nkeys) {
1921 +- tcf_idr_cleanup(tn, parm->index);
1922 ++ tcf_idr_cleanup(tn, index);
1923 + NL_SET_ERR_MSG_MOD(extack, "Pedit requires keys to be passed");
1924 + ret = -EINVAL;
1925 + goto out_free;
1926 + }
1927 +- ret = tcf_idr_create(tn, parm->index, est, a,
1928 ++ ret = tcf_idr_create(tn, index, est, a,
1929 + &act_pedit_ops, bind, false);
1930 + if (ret) {
1931 +- tcf_idr_cleanup(tn, parm->index);
1932 ++ tcf_idr_cleanup(tn, index);
1933 + goto out_free;
1934 + }
1935 + ret = ACT_P_CREATED;
1936 +diff --git a/net/sched/act_police.c b/net/sched/act_police.c
1937 +index 5d8bfa878477..997c34db1491 100644
1938 +--- a/net/sched/act_police.c
1939 ++++ b/net/sched/act_police.c
1940 +@@ -85,6 +85,7 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
1941 + struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL;
1942 + struct tc_action_net *tn = net_generic(net, police_net_id);
1943 + bool exists = false;
1944 ++ u32 index;
1945 + int size;
1946 +
1947 + if (nla == NULL)
1948 +@@ -101,7 +102,8 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
1949 + return -EINVAL;
1950 +
1951 + parm = nla_data(tb[TCA_POLICE_TBF]);
1952 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1953 ++ index = parm->index;
1954 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1955 + if (err < 0)
1956 + return err;
1957 + exists = err;
1958 +@@ -109,10 +111,10 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
1959 + return 0;
1960 +
1961 + if (!exists) {
1962 +- ret = tcf_idr_create(tn, parm->index, NULL, a,
1963 ++ ret = tcf_idr_create(tn, index, NULL, a,
1964 + &act_police_ops, bind, false);
1965 + if (ret) {
1966 +- tcf_idr_cleanup(tn, parm->index);
1967 ++ tcf_idr_cleanup(tn, index);
1968 + return ret;
1969 + }
1970 + ret = ACT_P_CREATED;
1971 +diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
1972 +index c7f5d630d97c..ac37654ca292 100644
1973 +--- a/net/sched/act_sample.c
1974 ++++ b/net/sched/act_sample.c
1975 +@@ -43,7 +43,7 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
1976 + struct tc_action_net *tn = net_generic(net, sample_net_id);
1977 + struct nlattr *tb[TCA_SAMPLE_MAX + 1];
1978 + struct psample_group *psample_group;
1979 +- u32 psample_group_num, rate;
1980 ++ u32 psample_group_num, rate, index;
1981 + struct tc_sample *parm;
1982 + struct tcf_sample *s;
1983 + bool exists = false;
1984 +@@ -59,8 +59,8 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
1985 + return -EINVAL;
1986 +
1987 + parm = nla_data(tb[TCA_SAMPLE_PARMS]);
1988 +-
1989 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
1990 ++ index = parm->index;
1991 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
1992 + if (err < 0)
1993 + return err;
1994 + exists = err;
1995 +@@ -68,10 +68,10 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
1996 + return 0;
1997 +
1998 + if (!exists) {
1999 +- ret = tcf_idr_create(tn, parm->index, est, a,
2000 ++ ret = tcf_idr_create(tn, index, est, a,
2001 + &act_sample_ops, bind, true);
2002 + if (ret) {
2003 +- tcf_idr_cleanup(tn, parm->index);
2004 ++ tcf_idr_cleanup(tn, index);
2005 + return ret;
2006 + }
2007 + ret = ACT_P_CREATED;
2008 +diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
2009 +index 52400d49f81f..658efae71a09 100644
2010 +--- a/net/sched/act_simple.c
2011 ++++ b/net/sched/act_simple.c
2012 +@@ -88,6 +88,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
2013 + struct tcf_defact *d;
2014 + bool exists = false;
2015 + int ret = 0, err;
2016 ++ u32 index;
2017 +
2018 + if (nla == NULL)
2019 + return -EINVAL;
2020 +@@ -100,7 +101,8 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
2021 + return -EINVAL;
2022 +
2023 + parm = nla_data(tb[TCA_DEF_PARMS]);
2024 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
2025 ++ index = parm->index;
2026 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
2027 + if (err < 0)
2028 + return err;
2029 + exists = err;
2030 +@@ -111,15 +113,15 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
2031 + if (exists)
2032 + tcf_idr_release(*a, bind);
2033 + else
2034 +- tcf_idr_cleanup(tn, parm->index);
2035 ++ tcf_idr_cleanup(tn, index);
2036 + return -EINVAL;
2037 + }
2038 +
2039 + if (!exists) {
2040 +- ret = tcf_idr_create(tn, parm->index, est, a,
2041 ++ ret = tcf_idr_create(tn, index, est, a,
2042 + &act_simp_ops, bind, false);
2043 + if (ret) {
2044 +- tcf_idr_cleanup(tn, parm->index);
2045 ++ tcf_idr_cleanup(tn, index);
2046 + return ret;
2047 + }
2048 +
2049 +diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
2050 +index 86d90fc5e97e..7709710a41f7 100644
2051 +--- a/net/sched/act_skbedit.c
2052 ++++ b/net/sched/act_skbedit.c
2053 +@@ -107,6 +107,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
2054 + u16 *queue_mapping = NULL, *ptype = NULL;
2055 + bool exists = false;
2056 + int ret = 0, err;
2057 ++ u32 index;
2058 +
2059 + if (nla == NULL)
2060 + return -EINVAL;
2061 +@@ -153,8 +154,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
2062 + }
2063 +
2064 + parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
2065 +-
2066 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
2067 ++ index = parm->index;
2068 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
2069 + if (err < 0)
2070 + return err;
2071 + exists = err;
2072 +@@ -165,15 +166,15 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
2073 + if (exists)
2074 + tcf_idr_release(*a, bind);
2075 + else
2076 +- tcf_idr_cleanup(tn, parm->index);
2077 ++ tcf_idr_cleanup(tn, index);
2078 + return -EINVAL;
2079 + }
2080 +
2081 + if (!exists) {
2082 +- ret = tcf_idr_create(tn, parm->index, est, a,
2083 ++ ret = tcf_idr_create(tn, index, est, a,
2084 + &act_skbedit_ops, bind, true);
2085 + if (ret) {
2086 +- tcf_idr_cleanup(tn, parm->index);
2087 ++ tcf_idr_cleanup(tn, index);
2088 + return ret;
2089 + }
2090 +
2091 +diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
2092 +index 588077fafd6c..3038493d18ca 100644
2093 +--- a/net/sched/act_skbmod.c
2094 ++++ b/net/sched/act_skbmod.c
2095 +@@ -88,12 +88,12 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
2096 + struct nlattr *tb[TCA_SKBMOD_MAX + 1];
2097 + struct tcf_skbmod_params *p, *p_old;
2098 + struct tc_skbmod *parm;
2099 ++ u32 lflags = 0, index;
2100 + struct tcf_skbmod *d;
2101 + bool exists = false;
2102 + u8 *daddr = NULL;
2103 + u8 *saddr = NULL;
2104 + u16 eth_type = 0;
2105 +- u32 lflags = 0;
2106 + int ret = 0, err;
2107 +
2108 + if (!nla)
2109 +@@ -122,10 +122,11 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
2110 + }
2111 +
2112 + parm = nla_data(tb[TCA_SKBMOD_PARMS]);
2113 ++ index = parm->index;
2114 + if (parm->flags & SKBMOD_F_SWAPMAC)
2115 + lflags = SKBMOD_F_SWAPMAC;
2116 +
2117 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
2118 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
2119 + if (err < 0)
2120 + return err;
2121 + exists = err;
2122 +@@ -136,15 +137,15 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
2123 + if (exists)
2124 + tcf_idr_release(*a, bind);
2125 + else
2126 +- tcf_idr_cleanup(tn, parm->index);
2127 ++ tcf_idr_cleanup(tn, index);
2128 + return -EINVAL;
2129 + }
2130 +
2131 + if (!exists) {
2132 +- ret = tcf_idr_create(tn, parm->index, est, a,
2133 ++ ret = tcf_idr_create(tn, index, est, a,
2134 + &act_skbmod_ops, bind, true);
2135 + if (ret) {
2136 +- tcf_idr_cleanup(tn, parm->index);
2137 ++ tcf_idr_cleanup(tn, index);
2138 + return ret;
2139 + }
2140 +
2141 +diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
2142 +index 72d9c432e8b4..66bfe57e74ae 100644
2143 +--- a/net/sched/act_tunnel_key.c
2144 ++++ b/net/sched/act_tunnel_key.c
2145 +@@ -224,6 +224,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
2146 + __be16 flags;
2147 + u8 tos, ttl;
2148 + int ret = 0;
2149 ++ u32 index;
2150 + int err;
2151 +
2152 + if (!nla) {
2153 +@@ -244,7 +245,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
2154 + }
2155 +
2156 + parm = nla_data(tb[TCA_TUNNEL_KEY_PARMS]);
2157 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
2158 ++ index = parm->index;
2159 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
2160 + if (err < 0)
2161 + return err;
2162 + exists = err;
2163 +@@ -338,7 +340,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
2164 + }
2165 +
2166 + if (!exists) {
2167 +- ret = tcf_idr_create(tn, parm->index, est, a,
2168 ++ ret = tcf_idr_create(tn, index, est, a,
2169 + &act_tunnel_key_ops, bind, true);
2170 + if (ret) {
2171 + NL_SET_ERR_MSG(extack, "Cannot create TC IDR");
2172 +@@ -384,7 +386,7 @@ err_out:
2173 + if (exists)
2174 + tcf_idr_release(*a, bind);
2175 + else
2176 +- tcf_idr_cleanup(tn, parm->index);
2177 ++ tcf_idr_cleanup(tn, index);
2178 + return ret;
2179 + }
2180 +
2181 +diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
2182 +index 033d273afe50..da993edd2e40 100644
2183 +--- a/net/sched/act_vlan.c
2184 ++++ b/net/sched/act_vlan.c
2185 +@@ -118,6 +118,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2186 + u8 push_prio = 0;
2187 + bool exists = false;
2188 + int ret = 0, err;
2189 ++ u32 index;
2190 +
2191 + if (!nla)
2192 + return -EINVAL;
2193 +@@ -129,7 +130,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2194 + if (!tb[TCA_VLAN_PARMS])
2195 + return -EINVAL;
2196 + parm = nla_data(tb[TCA_VLAN_PARMS]);
2197 +- err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
2198 ++ index = parm->index;
2199 ++ err = tcf_idr_check_alloc(tn, &index, a, bind);
2200 + if (err < 0)
2201 + return err;
2202 + exists = err;
2203 +@@ -145,7 +147,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2204 + if (exists)
2205 + tcf_idr_release(*a, bind);
2206 + else
2207 +- tcf_idr_cleanup(tn, parm->index);
2208 ++ tcf_idr_cleanup(tn, index);
2209 + return -EINVAL;
2210 + }
2211 + push_vid = nla_get_u16(tb[TCA_VLAN_PUSH_VLAN_ID]);
2212 +@@ -153,7 +155,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2213 + if (exists)
2214 + tcf_idr_release(*a, bind);
2215 + else
2216 +- tcf_idr_cleanup(tn, parm->index);
2217 ++ tcf_idr_cleanup(tn, index);
2218 + return -ERANGE;
2219 + }
2220 +
2221 +@@ -167,7 +169,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2222 + if (exists)
2223 + tcf_idr_release(*a, bind);
2224 + else
2225 +- tcf_idr_cleanup(tn, parm->index);
2226 ++ tcf_idr_cleanup(tn, index);
2227 + return -EPROTONOSUPPORT;
2228 + }
2229 + } else {
2230 +@@ -181,16 +183,16 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
2231 + if (exists)
2232 + tcf_idr_release(*a, bind);
2233 + else
2234 +- tcf_idr_cleanup(tn, parm->index);
2235 ++ tcf_idr_cleanup(tn, index);
2236 + return -EINVAL;
2237 + }
2238 + action = parm->v_action;
2239 +
2240 + if (!exists) {
2241 +- ret = tcf_idr_create(tn, parm->index, est, a,
2242 ++ ret = tcf_idr_create(tn, index, est, a,
2243 + &act_vlan_ops, bind, true);
2244 + if (ret) {
2245 +- tcf_idr_cleanup(tn, parm->index);
2246 ++ tcf_idr_cleanup(tn, index);
2247 + return ret;
2248 + }
2249 +
2250 +@@ -296,6 +298,14 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index,
2251 + return tcf_idr_search(tn, a, index);
2252 + }
2253 +
2254 ++static size_t tcf_vlan_get_fill_size(const struct tc_action *act)
2255 ++{
2256 ++ return nla_total_size(sizeof(struct tc_vlan))
2257 ++ + nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_ID */
2258 ++ + nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_PROTOCOL */
2259 ++ + nla_total_size(sizeof(u8)); /* TCA_VLAN_PUSH_VLAN_PRIORITY */
2260 ++}
2261 ++
2262 + static struct tc_action_ops act_vlan_ops = {
2263 + .kind = "vlan",
2264 + .type = TCA_ACT_VLAN,
2265 +@@ -305,6 +315,7 @@ static struct tc_action_ops act_vlan_ops = {
2266 + .init = tcf_vlan_init,
2267 + .cleanup = tcf_vlan_cleanup,
2268 + .walk = tcf_vlan_walker,
2269 ++ .get_fill_size = tcf_vlan_get_fill_size,
2270 + .lookup = tcf_vlan_search,
2271 + .size = sizeof(struct tcf_vlan),
2272 + };
2273 +diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c
2274 +index 17cd81f84b5d..77fae0b7c6ee 100644
2275 +--- a/net/sched/sch_codel.c
2276 ++++ b/net/sched/sch_codel.c
2277 +@@ -71,10 +71,10 @@ static struct sk_buff *dequeue_func(struct codel_vars *vars, void *ctx)
2278 + struct Qdisc *sch = ctx;
2279 + struct sk_buff *skb = __qdisc_dequeue_head(&sch->q);
2280 +
2281 +- if (skb)
2282 ++ if (skb) {
2283 + sch->qstats.backlog -= qdisc_pkt_len(skb);
2284 +-
2285 +- prefetch(&skb->end); /* we'll need skb_shinfo() */
2286 ++ prefetch(&skb->end); /* we'll need skb_shinfo() */
2287 ++ }
2288 + return skb;
2289 + }
2290 +
2291 +diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
2292 +index 9bbab6ba2dab..26dcd02b2d0c 100644
2293 +--- a/net/smc/af_smc.c
2294 ++++ b/net/smc/af_smc.c
2295 +@@ -1680,14 +1680,18 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
2296 + }
2297 + break;
2298 + case TCP_NODELAY:
2299 +- if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
2300 ++ if (sk->sk_state != SMC_INIT &&
2301 ++ sk->sk_state != SMC_LISTEN &&
2302 ++ sk->sk_state != SMC_CLOSED) {
2303 + if (val && !smc->use_fallback)
2304 + mod_delayed_work(system_wq, &smc->conn.tx_work,
2305 + 0);
2306 + }
2307 + break;
2308 + case TCP_CORK:
2309 +- if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
2310 ++ if (sk->sk_state != SMC_INIT &&
2311 ++ sk->sk_state != SMC_LISTEN &&
2312 ++ sk->sk_state != SMC_CLOSED) {
2313 + if (!val && !smc->use_fallback)
2314 + mod_delayed_work(system_wq, &smc->conn.tx_work,
2315 + 0);
2316 +diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
2317 +index 85ebb675600c..318c541970ec 100644
2318 +--- a/net/tipc/netlink_compat.c
2319 ++++ b/net/tipc/netlink_compat.c
2320 +@@ -55,6 +55,7 @@ struct tipc_nl_compat_msg {
2321 + int rep_type;
2322 + int rep_size;
2323 + int req_type;
2324 ++ int req_size;
2325 + struct net *net;
2326 + struct sk_buff *rep;
2327 + struct tlv_desc *req;
2328 +@@ -257,7 +258,8 @@ static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
2329 + int err;
2330 + struct sk_buff *arg;
2331 +
2332 +- if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type))
2333 ++ if (msg->req_type && (!msg->req_size ||
2334 ++ !TLV_CHECK_TYPE(msg->req, msg->req_type)))
2335 + return -EINVAL;
2336 +
2337 + msg->rep = tipc_tlv_alloc(msg->rep_size);
2338 +@@ -354,7 +356,8 @@ static int tipc_nl_compat_doit(struct tipc_nl_compat_cmd_doit *cmd,
2339 + {
2340 + int err;
2341 +
2342 +- if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type))
2343 ++ if (msg->req_type && (!msg->req_size ||
2344 ++ !TLV_CHECK_TYPE(msg->req, msg->req_type)))
2345 + return -EINVAL;
2346 +
2347 + err = __tipc_nl_compat_doit(cmd, msg);
2348 +@@ -1276,8 +1279,8 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
2349 + goto send;
2350 + }
2351 +
2352 +- len = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN);
2353 +- if (!len || !TLV_OK(msg.req, len)) {
2354 ++ msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN);
2355 ++ if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) {
2356 + msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED);
2357 + err = -EOPNOTSUPP;
2358 + goto send;