Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Wed, 29 Jan 2020 16:14:34
Message-Id: 1580314449.bfc45014998185f009ebc0ac2fb653866cf02793.mpagano@gentoo
1 commit: bfc45014998185f009ebc0ac2fb653866cf02793
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 29 16:14:09 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 29 16:14:09 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=bfc45014
7
8 Linux patch 4.14.169
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1168_linux-4.14.169.patch | 1600 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1604 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index ea6db7d..0793c3f 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -715,6 +715,10 @@ Patch: 1167_linux-4.14.168.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.168
23
24 +Patch: 1168_linux-4.14.169.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.169
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/1168_linux-4.14.169.patch b/1168_linux-4.14.169.patch
33 new file mode 100644
34 index 0000000..c563312
35 --- /dev/null
36 +++ b/1168_linux-4.14.169.patch
37 @@ -0,0 +1,1600 @@
38 +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
39 +index 933465eff40e..7e0a4be3503d 100644
40 +--- a/Documentation/admin-guide/kernel-parameters.txt
41 ++++ b/Documentation/admin-guide/kernel-parameters.txt
42 +@@ -1845,6 +1845,12 @@
43 + Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y,
44 + the default is off.
45 +
46 ++ kpti= [ARM64] Control page table isolation of user
47 ++ and kernel address spaces.
48 ++ Default: enabled on cores which need mitigation.
49 ++ 0: force disabled
50 ++ 1: force enabled
51 ++
52 + kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs.
53 + Default is 0 (don't ignore, but inject #GP)
54 +
55 +diff --git a/Makefile b/Makefile
56 +index 1e74ba09cdda..795d93bfe156 100644
57 +--- a/Makefile
58 ++++ b/Makefile
59 +@@ -1,7 +1,7 @@
60 + # SPDX-License-Identifier: GPL-2.0
61 + VERSION = 4
62 + PATCHLEVEL = 14
63 +-SUBLEVEL = 168
64 ++SUBLEVEL = 169
65 + EXTRAVERSION =
66 + NAME = Petit Gorille
67 +
68 +diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
69 +index 6b6368a56526..0e449ee11ac7 100644
70 +--- a/drivers/atm/firestream.c
71 ++++ b/drivers/atm/firestream.c
72 +@@ -927,6 +927,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
73 + }
74 + if (!to) {
75 + printk ("No more free channels for FS50..\n");
76 ++ kfree(vcc);
77 + return -EBUSY;
78 + }
79 + vcc->channo = dev->channo;
80 +@@ -937,6 +938,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
81 + if (((DO_DIRECTION(rxtp) && dev->atm_vccs[vcc->channo])) ||
82 + ( DO_DIRECTION(txtp) && test_bit (vcc->channo, dev->tx_inuse))) {
83 + printk ("Channel is in use for FS155.\n");
84 ++ kfree(vcc);
85 + return -EBUSY;
86 + }
87 + }
88 +@@ -950,6 +952,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
89 + tc, sizeof (struct fs_transmit_config));
90 + if (!tc) {
91 + fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n");
92 ++ kfree(vcc);
93 + return -ENOMEM;
94 + }
95 +
96 +diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
97 +index 37db2eb66ed7..d7d1f2467100 100644
98 +--- a/drivers/hwmon/adt7475.c
99 ++++ b/drivers/hwmon/adt7475.c
100 +@@ -297,9 +297,10 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn)
101 + long reg;
102 +
103 + if (bypass_attn & (1 << channel))
104 +- reg = (volt * 1024) / 2250;
105 ++ reg = DIV_ROUND_CLOSEST(volt * 1024, 2250);
106 + else
107 +- reg = (volt * r[1] * 1024) / ((r[0] + r[1]) * 2250);
108 ++ reg = DIV_ROUND_CLOSEST(volt * r[1] * 1024,
109 ++ (r[0] + r[1]) * 2250);
110 + return clamp_val(reg, 0, 1023) & (0xff << 2);
111 + }
112 +
113 +diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
114 +index 7b53065e9882..652973d83a07 100644
115 +--- a/drivers/hwmon/hwmon.c
116 ++++ b/drivers/hwmon/hwmon.c
117 +@@ -51,6 +51,7 @@ struct hwmon_device_attribute {
118 +
119 + #define to_hwmon_attr(d) \
120 + container_of(d, struct hwmon_device_attribute, dev_attr)
121 ++#define to_dev_attr(a) container_of(a, struct device_attribute, attr)
122 +
123 + /*
124 + * Thermal zone information
125 +@@ -58,7 +59,7 @@ struct hwmon_device_attribute {
126 + * also provides the sensor index.
127 + */
128 + struct hwmon_thermal_data {
129 +- struct hwmon_device *hwdev; /* Reference to hwmon device */
130 ++ struct device *dev; /* Reference to hwmon device */
131 + int index; /* sensor index */
132 + };
133 +
134 +@@ -95,9 +96,27 @@ static const struct attribute_group *hwmon_dev_attr_groups[] = {
135 + NULL
136 + };
137 +
138 ++static void hwmon_free_attrs(struct attribute **attrs)
139 ++{
140 ++ int i;
141 ++
142 ++ for (i = 0; attrs[i]; i++) {
143 ++ struct device_attribute *dattr = to_dev_attr(attrs[i]);
144 ++ struct hwmon_device_attribute *hattr = to_hwmon_attr(dattr);
145 ++
146 ++ kfree(hattr);
147 ++ }
148 ++ kfree(attrs);
149 ++}
150 ++
151 + static void hwmon_dev_release(struct device *dev)
152 + {
153 +- kfree(to_hwmon_device(dev));
154 ++ struct hwmon_device *hwdev = to_hwmon_device(dev);
155 ++
156 ++ if (hwdev->group.attrs)
157 ++ hwmon_free_attrs(hwdev->group.attrs);
158 ++ kfree(hwdev->groups);
159 ++ kfree(hwdev);
160 + }
161 +
162 + static struct class hwmon_class = {
163 +@@ -121,11 +140,11 @@ static DEFINE_IDA(hwmon_ida);
164 + static int hwmon_thermal_get_temp(void *data, int *temp)
165 + {
166 + struct hwmon_thermal_data *tdata = data;
167 +- struct hwmon_device *hwdev = tdata->hwdev;
168 ++ struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
169 + int ret;
170 + long t;
171 +
172 +- ret = hwdev->chip->ops->read(&hwdev->dev, hwmon_temp, hwmon_temp_input,
173 ++ ret = hwdev->chip->ops->read(tdata->dev, hwmon_temp, hwmon_temp_input,
174 + tdata->index, &t);
175 + if (ret < 0)
176 + return ret;
177 +@@ -139,26 +158,31 @@ static const struct thermal_zone_of_device_ops hwmon_thermal_ops = {
178 + .get_temp = hwmon_thermal_get_temp,
179 + };
180 +
181 +-static int hwmon_thermal_add_sensor(struct device *dev,
182 +- struct hwmon_device *hwdev, int index)
183 ++static int hwmon_thermal_add_sensor(struct device *dev, int index)
184 + {
185 + struct hwmon_thermal_data *tdata;
186 ++ struct thermal_zone_device *tzd;
187 +
188 + tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL);
189 + if (!tdata)
190 + return -ENOMEM;
191 +
192 +- tdata->hwdev = hwdev;
193 ++ tdata->dev = dev;
194 + tdata->index = index;
195 +
196 +- devm_thermal_zone_of_sensor_register(&hwdev->dev, index, tdata,
197 +- &hwmon_thermal_ops);
198 ++ tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
199 ++ &hwmon_thermal_ops);
200 ++ /*
201 ++ * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
202 ++ * so ignore that error but forward any other error.
203 ++ */
204 ++ if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
205 ++ return PTR_ERR(tzd);
206 +
207 + return 0;
208 + }
209 + #else
210 +-static int hwmon_thermal_add_sensor(struct device *dev,
211 +- struct hwmon_device *hwdev, int index)
212 ++static int hwmon_thermal_add_sensor(struct device *dev, int index)
213 + {
214 + return 0;
215 + }
216 +@@ -235,8 +259,7 @@ static bool is_string_attr(enum hwmon_sensor_types type, u32 attr)
217 + (type == hwmon_fan && attr == hwmon_fan_label);
218 + }
219 +
220 +-static struct attribute *hwmon_genattr(struct device *dev,
221 +- const void *drvdata,
222 ++static struct attribute *hwmon_genattr(const void *drvdata,
223 + enum hwmon_sensor_types type,
224 + u32 attr,
225 + int index,
226 +@@ -264,7 +287,7 @@ static struct attribute *hwmon_genattr(struct device *dev,
227 + if ((mode & S_IWUGO) && !ops->write)
228 + return ERR_PTR(-EINVAL);
229 +
230 +- hattr = devm_kzalloc(dev, sizeof(*hattr), GFP_KERNEL);
231 ++ hattr = kzalloc(sizeof(*hattr), GFP_KERNEL);
232 + if (!hattr)
233 + return ERR_PTR(-ENOMEM);
234 +
235 +@@ -467,8 +490,7 @@ static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
236 + return n;
237 + }
238 +
239 +-static int hwmon_genattrs(struct device *dev,
240 +- const void *drvdata,
241 ++static int hwmon_genattrs(const void *drvdata,
242 + struct attribute **attrs,
243 + const struct hwmon_ops *ops,
244 + const struct hwmon_channel_info *info)
245 +@@ -494,7 +516,7 @@ static int hwmon_genattrs(struct device *dev,
246 + attr_mask &= ~BIT(attr);
247 + if (attr >= template_size)
248 + return -EINVAL;
249 +- a = hwmon_genattr(dev, drvdata, info->type, attr, i,
250 ++ a = hwmon_genattr(drvdata, info->type, attr, i,
251 + templates[attr], ops);
252 + if (IS_ERR(a)) {
253 + if (PTR_ERR(a) != -ENOENT)
254 +@@ -508,8 +530,7 @@ static int hwmon_genattrs(struct device *dev,
255 + }
256 +
257 + static struct attribute **
258 +-__hwmon_create_attrs(struct device *dev, const void *drvdata,
259 +- const struct hwmon_chip_info *chip)
260 ++__hwmon_create_attrs(const void *drvdata, const struct hwmon_chip_info *chip)
261 + {
262 + int ret, i, aindex = 0, nattrs = 0;
263 + struct attribute **attrs;
264 +@@ -520,15 +541,17 @@ __hwmon_create_attrs(struct device *dev, const void *drvdata,
265 + if (nattrs == 0)
266 + return ERR_PTR(-EINVAL);
267 +
268 +- attrs = devm_kcalloc(dev, nattrs + 1, sizeof(*attrs), GFP_KERNEL);
269 ++ attrs = kcalloc(nattrs + 1, sizeof(*attrs), GFP_KERNEL);
270 + if (!attrs)
271 + return ERR_PTR(-ENOMEM);
272 +
273 + for (i = 0; chip->info[i]; i++) {
274 +- ret = hwmon_genattrs(dev, drvdata, &attrs[aindex], chip->ops,
275 ++ ret = hwmon_genattrs(drvdata, &attrs[aindex], chip->ops,
276 + chip->info[i]);
277 +- if (ret < 0)
278 ++ if (ret < 0) {
279 ++ hwmon_free_attrs(attrs);
280 + return ERR_PTR(ret);
281 ++ }
282 + aindex += ret;
283 + }
284 +
285 +@@ -570,14 +593,13 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
286 + for (i = 0; groups[i]; i++)
287 + ngroups++;
288 +
289 +- hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups),
290 +- GFP_KERNEL);
291 ++ hwdev->groups = kcalloc(ngroups, sizeof(*groups), GFP_KERNEL);
292 + if (!hwdev->groups) {
293 + err = -ENOMEM;
294 + goto free_hwmon;
295 + }
296 +
297 +- attrs = __hwmon_create_attrs(dev, drvdata, chip);
298 ++ attrs = __hwmon_create_attrs(drvdata, chip);
299 + if (IS_ERR(attrs)) {
300 + err = PTR_ERR(attrs);
301 + goto free_hwmon;
302 +@@ -621,8 +643,13 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
303 + if (!chip->ops->is_visible(drvdata, hwmon_temp,
304 + hwmon_temp_input, j))
305 + continue;
306 +- if (info[i]->config[j] & HWMON_T_INPUT)
307 +- hwmon_thermal_add_sensor(dev, hwdev, j);
308 ++ if (info[i]->config[j] & HWMON_T_INPUT) {
309 ++ err = hwmon_thermal_add_sensor(hdev, j);
310 ++ if (err) {
311 ++ device_unregister(hdev);
312 ++ goto ida_remove;
313 ++ }
314 ++ }
315 + }
316 + }
317 + }
318 +@@ -630,7 +657,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
319 + return hdev;
320 +
321 + free_hwmon:
322 +- kfree(hwdev);
323 ++ hwmon_dev_release(hdev);
324 + ida_remove:
325 + ida_simple_remove(&hwmon_ida, id);
326 + return ERR_PTR(err);
327 +diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
328 +index 38ffbdb0a85f..779ec8fdfae0 100644
329 +--- a/drivers/hwmon/nct7802.c
330 ++++ b/drivers/hwmon/nct7802.c
331 +@@ -32,8 +32,8 @@
332 + static const u8 REG_VOLTAGE[5] = { 0x09, 0x0a, 0x0c, 0x0d, 0x0e };
333 +
334 + static const u8 REG_VOLTAGE_LIMIT_LSB[2][5] = {
335 +- { 0x40, 0x00, 0x42, 0x44, 0x46 },
336 +- { 0x3f, 0x00, 0x41, 0x43, 0x45 },
337 ++ { 0x46, 0x00, 0x40, 0x42, 0x44 },
338 ++ { 0x45, 0x00, 0x3f, 0x41, 0x43 },
339 + };
340 +
341 + static const u8 REG_VOLTAGE_LIMIT_MSB[5] = { 0x48, 0x00, 0x47, 0x47, 0x48 };
342 +diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
343 +index d14a9cb7959a..cb675a596302 100644
344 +--- a/drivers/hwtracing/coresight/coresight-etb10.c
345 ++++ b/drivers/hwtracing/coresight/coresight-etb10.c
346 +@@ -287,9 +287,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
347 + int node;
348 + struct cs_buffers *buf;
349 +
350 +- if (cpu == -1)
351 +- cpu = smp_processor_id();
352 +- node = cpu_to_node(cpu);
353 ++ node = (cpu == -1) ? NUMA_NO_NODE : cpu_to_node(cpu);
354 +
355 + buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
356 + if (!buf)
357 +diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
358 +index 336194d059fe..0a00f4e941fb 100644
359 +--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
360 ++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
361 +@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,
362 + int node;
363 + struct cs_buffers *buf;
364 +
365 +- if (cpu == -1)
366 +- cpu = smp_processor_id();
367 +- node = cpu_to_node(cpu);
368 ++ node = (cpu == -1) ? NUMA_NO_NODE : cpu_to_node(cpu);
369 +
370 + /* Allocate memory structure for interaction with Perf */
371 + buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
372 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
373 +index ee3f630c9217..9b5691f306a2 100644
374 +--- a/drivers/infiniband/ulp/isert/ib_isert.c
375 ++++ b/drivers/infiniband/ulp/isert/ib_isert.c
376 +@@ -2582,17 +2582,6 @@ isert_wait4logout(struct isert_conn *isert_conn)
377 + }
378 + }
379 +
380 +-static void
381 +-isert_wait4cmds(struct iscsi_conn *conn)
382 +-{
383 +- isert_info("iscsi_conn %p\n", conn);
384 +-
385 +- if (conn->sess) {
386 +- target_sess_cmd_list_set_waiting(conn->sess->se_sess);
387 +- target_wait_for_sess_cmds(conn->sess->se_sess);
388 +- }
389 +-}
390 +-
391 + /**
392 + * isert_put_unsol_pending_cmds() - Drop commands waiting for
393 + * unsolicitate dataout
394 +@@ -2640,7 +2629,6 @@ static void isert_wait_conn(struct iscsi_conn *conn)
395 +
396 + ib_drain_qp(isert_conn->qp);
397 + isert_put_unsol_pending_cmds(conn);
398 +- isert_wait4cmds(conn);
399 + isert_wait4logout(isert_conn);
400 +
401 + queue_work(isert_release_wq, &isert_conn->release_work);
402 +diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
403 +index 77c47d6325fe..a9ee813eef10 100644
404 +--- a/drivers/input/misc/keyspan_remote.c
405 ++++ b/drivers/input/misc/keyspan_remote.c
406 +@@ -344,7 +344,8 @@ static int keyspan_setup(struct usb_device* dev)
407 + int retval = 0;
408 +
409 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
410 +- 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0);
411 ++ 0x11, 0x40, 0x5601, 0x0, NULL, 0,
412 ++ USB_CTRL_SET_TIMEOUT);
413 + if (retval) {
414 + dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n",
415 + __func__, retval);
416 +@@ -352,7 +353,8 @@ static int keyspan_setup(struct usb_device* dev)
417 + }
418 +
419 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
420 +- 0x44, 0x40, 0x0, 0x0, NULL, 0, 0);
421 ++ 0x44, 0x40, 0x0, 0x0, NULL, 0,
422 ++ USB_CTRL_SET_TIMEOUT);
423 + if (retval) {
424 + dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n",
425 + __func__, retval);
426 +@@ -360,7 +362,8 @@ static int keyspan_setup(struct usb_device* dev)
427 + }
428 +
429 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
430 +- 0x22, 0x40, 0x0, 0x0, NULL, 0, 0);
431 ++ 0x22, 0x40, 0x0, 0x0, NULL, 0,
432 ++ USB_CTRL_SET_TIMEOUT);
433 + if (retval) {
434 + dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n",
435 + __func__, retval);
436 +diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
437 +index 7dd1c1fbe42a..27b3db154a33 100644
438 +--- a/drivers/input/misc/pm8xxx-vibrator.c
439 ++++ b/drivers/input/misc/pm8xxx-vibrator.c
440 +@@ -98,7 +98,7 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on)
441 +
442 + if (regs->enable_mask)
443 + rc = regmap_update_bits(vib->regmap, regs->enable_addr,
444 +- on ? regs->enable_mask : 0, val);
445 ++ regs->enable_mask, on ? ~0 : 0);
446 +
447 + return rc;
448 + }
449 +diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
450 +index 4b2466cf2fb1..b6ccf39c6a7b 100644
451 +--- a/drivers/input/rmi4/rmi_smbus.c
452 ++++ b/drivers/input/rmi4/rmi_smbus.c
453 +@@ -166,6 +166,7 @@ static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr,
454 + /* prepare to write next block of bytes */
455 + cur_len -= SMB_MAX_COUNT;
456 + databuff += SMB_MAX_COUNT;
457 ++ rmiaddr += SMB_MAX_COUNT;
458 + }
459 + exit:
460 + mutex_unlock(&rmi_smb->page_mutex);
461 +@@ -217,6 +218,7 @@ static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr,
462 + /* prepare to read next block of bytes */
463 + cur_len -= SMB_MAX_COUNT;
464 + databuff += SMB_MAX_COUNT;
465 ++ rmiaddr += SMB_MAX_COUNT;
466 + }
467 +
468 + retval = 0;
469 +diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
470 +index 0b55e1f375b3..fbe2df91aad3 100644
471 +--- a/drivers/input/tablet/aiptek.c
472 ++++ b/drivers/input/tablet/aiptek.c
473 +@@ -1822,14 +1822,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
474 + input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0);
475 +
476 + /* Verify that a device really has an endpoint */
477 +- if (intf->altsetting[0].desc.bNumEndpoints < 1) {
478 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) {
479 + dev_err(&intf->dev,
480 + "interface has %d endpoints, but must have minimum 1\n",
481 +- intf->altsetting[0].desc.bNumEndpoints);
482 ++ intf->cur_altsetting->desc.bNumEndpoints);
483 + err = -EINVAL;
484 + goto fail3;
485 + }
486 +- endpoint = &intf->altsetting[0].endpoint[0].desc;
487 ++ endpoint = &intf->cur_altsetting->endpoint[0].desc;
488 +
489 + /* Go set up our URB, which is called when the tablet receives
490 + * input.
491 +diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
492 +index 35031228a6d0..799c94dda651 100644
493 +--- a/drivers/input/tablet/gtco.c
494 ++++ b/drivers/input/tablet/gtco.c
495 +@@ -875,18 +875,14 @@ static int gtco_probe(struct usb_interface *usbinterface,
496 + }
497 +
498 + /* Sanity check that a device has an endpoint */
499 +- if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) {
500 ++ if (usbinterface->cur_altsetting->desc.bNumEndpoints < 1) {
501 + dev_err(&usbinterface->dev,
502 + "Invalid number of endpoints\n");
503 + error = -EINVAL;
504 + goto err_free_urb;
505 + }
506 +
507 +- /*
508 +- * The endpoint is always altsetting 0, we know this since we know
509 +- * this device only has one interrupt endpoint
510 +- */
511 +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
512 ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc;
513 +
514 + /* Some debug */
515 + dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting);
516 +@@ -973,7 +969,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
517 + input_dev->dev.parent = &usbinterface->dev;
518 +
519 + /* Setup the URB, it will be posted later on open of input device */
520 +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
521 ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc;
522 +
523 + usb_fill_int_urb(gtco->urbinfo,
524 + udev,
525 +diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
526 +index 47de5a81172f..2319144802c9 100644
527 +--- a/drivers/input/tablet/pegasus_notetaker.c
528 ++++ b/drivers/input/tablet/pegasus_notetaker.c
529 +@@ -260,7 +260,7 @@ static int pegasus_probe(struct usb_interface *intf,
530 + return -ENODEV;
531 +
532 + /* Sanity check that the device has an endpoint */
533 +- if (intf->altsetting[0].desc.bNumEndpoints < 1) {
534 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) {
535 + dev_err(&intf->dev, "Invalid number of endpoints\n");
536 + return -EINVAL;
537 + }
538 +diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
539 +index d2e14d9e5975..ab44eb0352d0 100644
540 +--- a/drivers/input/touchscreen/sun4i-ts.c
541 ++++ b/drivers/input/touchscreen/sun4i-ts.c
542 +@@ -246,6 +246,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
543 + struct device *dev = &pdev->dev;
544 + struct device_node *np = dev->of_node;
545 + struct device *hwmon;
546 ++ struct thermal_zone_device *thermal;
547 + int error;
548 + u32 reg;
549 + bool ts_attached;
550 +@@ -365,7 +366,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
551 + if (IS_ERR(hwmon))
552 + return PTR_ERR(hwmon);
553 +
554 +- devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
555 ++ thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
556 ++ &sun4i_ts_tz_ops);
557 ++ if (IS_ERR(thermal))
558 ++ return PTR_ERR(thermal);
559 +
560 + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
561 +
562 +diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
563 +index f16f8358c70a..98e03d0ca03c 100644
564 +--- a/drivers/input/touchscreen/sur40.c
565 ++++ b/drivers/input/touchscreen/sur40.c
566 +@@ -537,7 +537,7 @@ static int sur40_probe(struct usb_interface *interface,
567 + int error;
568 +
569 + /* Check if we really have the right interface. */
570 +- iface_desc = &interface->altsetting[0];
571 ++ iface_desc = interface->cur_altsetting;
572 + if (iface_desc->desc.bInterfaceClass != 0xFF)
573 + return -ENODEV;
574 +
575 +diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
576 +index 0cabf31fb163..7eb76a1a2505 100644
577 +--- a/drivers/md/bitmap.c
578 ++++ b/drivers/md/bitmap.c
579 +@@ -1729,7 +1729,7 @@ void bitmap_flush(struct mddev *mddev)
580 + /*
581 + * free memory that was allocated
582 + */
583 +-void bitmap_free(struct bitmap *bitmap)
584 ++void md_bitmap_free(struct bitmap *bitmap)
585 + {
586 + unsigned long k, pages;
587 + struct bitmap_page *bp;
588 +@@ -1763,7 +1763,7 @@ void bitmap_free(struct bitmap *bitmap)
589 + kfree(bp);
590 + kfree(bitmap);
591 + }
592 +-EXPORT_SYMBOL(bitmap_free);
593 ++EXPORT_SYMBOL(md_bitmap_free);
594 +
595 + void bitmap_wait_behind_writes(struct mddev *mddev)
596 + {
597 +@@ -1796,7 +1796,7 @@ void bitmap_destroy(struct mddev *mddev)
598 + if (mddev->thread)
599 + mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
600 +
601 +- bitmap_free(bitmap);
602 ++ md_bitmap_free(bitmap);
603 + }
604 +
605 + /*
606 +@@ -1887,7 +1887,7 @@ struct bitmap *bitmap_create(struct mddev *mddev, int slot)
607 +
608 + return bitmap;
609 + error:
610 +- bitmap_free(bitmap);
611 ++ md_bitmap_free(bitmap);
612 + return ERR_PTR(err);
613 + }
614 +
615 +@@ -1958,7 +1958,7 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
616 +
617 + rv = bitmap_init_from_disk(bitmap, 0);
618 + if (rv) {
619 +- bitmap_free(bitmap);
620 ++ md_bitmap_free(bitmap);
621 + return ERR_PTR(rv);
622 + }
623 +
624 +diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
625 +index 5df35ca90f58..dd53a978c5f2 100644
626 +--- a/drivers/md/bitmap.h
627 ++++ b/drivers/md/bitmap.h
628 +@@ -271,7 +271,7 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
629 + struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot);
630 + int bitmap_copy_from_slot(struct mddev *mddev, int slot,
631 + sector_t *lo, sector_t *hi, bool clear_bits);
632 +-void bitmap_free(struct bitmap *bitmap);
633 ++void md_bitmap_free(struct bitmap *bitmap);
634 + void bitmap_wait_behind_writes(struct mddev *mddev);
635 + #endif
636 +
637 +diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
638 +index 717aaffc227d..10057ac85476 100644
639 +--- a/drivers/md/md-cluster.c
640 ++++ b/drivers/md/md-cluster.c
641 +@@ -1128,7 +1128,7 @@ int cluster_check_sync_size(struct mddev *mddev)
642 + bm_lockres = lockres_init(mddev, str, NULL, 1);
643 + if (!bm_lockres) {
644 + pr_err("md-cluster: Cannot initialize %s\n", str);
645 +- bitmap_free(bitmap);
646 ++ md_bitmap_free(bitmap);
647 + return -1;
648 + }
649 + bm_lockres->flags |= DLM_LKF_NOQUEUE;
650 +@@ -1142,11 +1142,11 @@ int cluster_check_sync_size(struct mddev *mddev)
651 + sync_size = sb->sync_size;
652 + else if (sync_size != sb->sync_size) {
653 + kunmap_atomic(sb);
654 +- bitmap_free(bitmap);
655 ++ md_bitmap_free(bitmap);
656 + return -1;
657 + }
658 + kunmap_atomic(sb);
659 +- bitmap_free(bitmap);
660 ++ md_bitmap_free(bitmap);
661 + }
662 +
663 + return (my_sync_size == sync_size) ? 0 : -1;
664 +diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
665 +index 7cafc8a57950..8eb52139684a 100644
666 +--- a/drivers/media/v4l2-core/v4l2-ioctl.c
667 ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c
668 +@@ -1496,12 +1496,12 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
669 + case V4L2_BUF_TYPE_VBI_CAPTURE:
670 + if (unlikely(!ops->vidioc_s_fmt_vbi_cap))
671 + break;
672 +- CLEAR_AFTER_FIELD(p, fmt.vbi);
673 ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
674 + return ops->vidioc_s_fmt_vbi_cap(file, fh, arg);
675 + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
676 + if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_cap))
677 + break;
678 +- CLEAR_AFTER_FIELD(p, fmt.sliced);
679 ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
680 + return ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, arg);
681 + case V4L2_BUF_TYPE_VIDEO_OUTPUT:
682 + if (unlikely(!ops->vidioc_s_fmt_vid_out))
683 +@@ -1524,22 +1524,22 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
684 + case V4L2_BUF_TYPE_VBI_OUTPUT:
685 + if (unlikely(!ops->vidioc_s_fmt_vbi_out))
686 + break;
687 +- CLEAR_AFTER_FIELD(p, fmt.vbi);
688 ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
689 + return ops->vidioc_s_fmt_vbi_out(file, fh, arg);
690 + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
691 + if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_out))
692 + break;
693 +- CLEAR_AFTER_FIELD(p, fmt.sliced);
694 ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
695 + return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg);
696 + case V4L2_BUF_TYPE_SDR_CAPTURE:
697 + if (unlikely(!ops->vidioc_s_fmt_sdr_cap))
698 + break;
699 +- CLEAR_AFTER_FIELD(p, fmt.sdr);
700 ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
701 + return ops->vidioc_s_fmt_sdr_cap(file, fh, arg);
702 + case V4L2_BUF_TYPE_SDR_OUTPUT:
703 + if (unlikely(!ops->vidioc_s_fmt_sdr_out))
704 + break;
705 +- CLEAR_AFTER_FIELD(p, fmt.sdr);
706 ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
707 + return ops->vidioc_s_fmt_sdr_out(file, fh, arg);
708 + case V4L2_BUF_TYPE_META_CAPTURE:
709 + if (unlikely(!ops->vidioc_s_fmt_meta_cap))
710 +@@ -1583,12 +1583,12 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
711 + case V4L2_BUF_TYPE_VBI_CAPTURE:
712 + if (unlikely(!ops->vidioc_try_fmt_vbi_cap))
713 + break;
714 +- CLEAR_AFTER_FIELD(p, fmt.vbi);
715 ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
716 + return ops->vidioc_try_fmt_vbi_cap(file, fh, arg);
717 + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
718 + if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap))
719 + break;
720 +- CLEAR_AFTER_FIELD(p, fmt.sliced);
721 ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
722 + return ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg);
723 + case V4L2_BUF_TYPE_VIDEO_OUTPUT:
724 + if (unlikely(!ops->vidioc_try_fmt_vid_out))
725 +@@ -1611,22 +1611,22 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
726 + case V4L2_BUF_TYPE_VBI_OUTPUT:
727 + if (unlikely(!ops->vidioc_try_fmt_vbi_out))
728 + break;
729 +- CLEAR_AFTER_FIELD(p, fmt.vbi);
730 ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags);
731 + return ops->vidioc_try_fmt_vbi_out(file, fh, arg);
732 + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
733 + if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out))
734 + break;
735 +- CLEAR_AFTER_FIELD(p, fmt.sliced);
736 ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size);
737 + return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg);
738 + case V4L2_BUF_TYPE_SDR_CAPTURE:
739 + if (unlikely(!ops->vidioc_try_fmt_sdr_cap))
740 + break;
741 +- CLEAR_AFTER_FIELD(p, fmt.sdr);
742 ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
743 + return ops->vidioc_try_fmt_sdr_cap(file, fh, arg);
744 + case V4L2_BUF_TYPE_SDR_OUTPUT:
745 + if (unlikely(!ops->vidioc_try_fmt_sdr_out))
746 + break;
747 +- CLEAR_AFTER_FIELD(p, fmt.sdr);
748 ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);
749 + return ops->vidioc_try_fmt_sdr_out(file, fh, arg);
750 + case V4L2_BUF_TYPE_META_CAPTURE:
751 + if (unlikely(!ops->vidioc_try_fmt_meta_cap))
752 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
753 +index ce3f344d2b66..d2b0a62bfce1 100644
754 +--- a/drivers/mmc/host/sdhci-tegra.c
755 ++++ b/drivers/mmc/host/sdhci-tegra.c
756 +@@ -177,7 +177,7 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
757 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50;
758 + if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104)
759 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104;
760 +- if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50)
761 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50)
762 + clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
763 + }
764 +
765 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
766 +index 645775dd4edb..4f1c884c0b50 100644
767 +--- a/drivers/mmc/host/sdhci.c
768 ++++ b/drivers/mmc/host/sdhci.c
769 +@@ -3592,11 +3592,13 @@ int sdhci_setup_host(struct sdhci_host *host)
770 + if (host->ops->get_min_clock)
771 + mmc->f_min = host->ops->get_min_clock(host);
772 + else if (host->version >= SDHCI_SPEC_300) {
773 +- if (host->clk_mul) {
774 +- mmc->f_min = (host->max_clk * host->clk_mul) / 1024;
775 ++ if (host->clk_mul)
776 + max_clk = host->max_clk * host->clk_mul;
777 +- } else
778 +- mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
779 ++ /*
780 ++ * Divided Clock Mode minimum clock rate is always less than
781 ++ * Programmable Clock Mode minimum clock rate.
782 ++ */
783 ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
784 + } else
785 + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
786 +
787 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
788 +index a42737b4ac79..35564a9561b7 100644
789 +--- a/drivers/net/can/slcan.c
790 ++++ b/drivers/net/can/slcan.c
791 +@@ -343,9 +343,16 @@ static void slcan_transmit(struct work_struct *work)
792 + */
793 + static void slcan_write_wakeup(struct tty_struct *tty)
794 + {
795 +- struct slcan *sl = tty->disc_data;
796 ++ struct slcan *sl;
797 ++
798 ++ rcu_read_lock();
799 ++ sl = rcu_dereference(tty->disc_data);
800 ++ if (!sl)
801 ++ goto out;
802 +
803 + schedule_work(&sl->tx_work);
804 ++out:
805 ++ rcu_read_unlock();
806 + }
807 +
808 + /* Send a can_frame to a TTY queue. */
809 +@@ -640,10 +647,11 @@ static void slcan_close(struct tty_struct *tty)
810 + return;
811 +
812 + spin_lock_bh(&sl->lock);
813 +- tty->disc_data = NULL;
814 ++ rcu_assign_pointer(tty->disc_data, NULL);
815 + sl->tty = NULL;
816 + spin_unlock_bh(&sl->lock);
817 +
818 ++ synchronize_rcu();
819 + flush_work(&sl->tx_work);
820 +
821 + /* Flush network side */
822 +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
823 +index 338683e5ef1e..b8779afb8550 100644
824 +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
825 ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
826 +@@ -2449,6 +2449,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
827 +
828 + if (!is_offload(adapter))
829 + return -EOPNOTSUPP;
830 ++ if (!capable(CAP_NET_ADMIN))
831 ++ return -EPERM;
832 + if (!(adapter->flags & FULL_INIT_DONE))
833 + return -EIO; /* need the memory controllers */
834 + if (copy_from_user(&t, useraddr, sizeof(t)))
835 +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
836 +index 25be27826a22..3840f21dd635 100644
837 +--- a/drivers/net/gtp.c
838 ++++ b/drivers/net/gtp.c
839 +@@ -807,19 +807,21 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,
840 + return NULL;
841 + }
842 +
843 +- if (sock->sk->sk_protocol != IPPROTO_UDP) {
844 ++ sk = sock->sk;
845 ++ if (sk->sk_protocol != IPPROTO_UDP ||
846 ++ sk->sk_type != SOCK_DGRAM ||
847 ++ (sk->sk_family != AF_INET && sk->sk_family != AF_INET6)) {
848 + pr_debug("socket fd=%d not UDP\n", fd);
849 + sk = ERR_PTR(-EINVAL);
850 + goto out_sock;
851 + }
852 +
853 +- lock_sock(sock->sk);
854 +- if (sock->sk->sk_user_data) {
855 ++ lock_sock(sk);
856 ++ if (sk->sk_user_data) {
857 + sk = ERR_PTR(-EBUSY);
858 + goto out_rel_sock;
859 + }
860 +
861 +- sk = sock->sk;
862 + sock_hold(sk);
863 +
864 + tuncfg.sk_user_data = gtp;
865 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
866 +index d6dc00b4ba55..b07f367abd91 100644
867 +--- a/drivers/net/slip/slip.c
868 ++++ b/drivers/net/slip/slip.c
869 +@@ -452,9 +452,16 @@ static void slip_transmit(struct work_struct *work)
870 + */
871 + static void slip_write_wakeup(struct tty_struct *tty)
872 + {
873 +- struct slip *sl = tty->disc_data;
874 ++ struct slip *sl;
875 ++
876 ++ rcu_read_lock();
877 ++ sl = rcu_dereference(tty->disc_data);
878 ++ if (!sl)
879 ++ goto out;
880 +
881 + schedule_work(&sl->tx_work);
882 ++out:
883 ++ rcu_read_unlock();
884 + }
885 +
886 + static void sl_tx_timeout(struct net_device *dev)
887 +@@ -886,10 +893,11 @@ static void slip_close(struct tty_struct *tty)
888 + return;
889 +
890 + spin_lock_bh(&sl->lock);
891 +- tty->disc_data = NULL;
892 ++ rcu_assign_pointer(tty->disc_data, NULL);
893 + sl->tty = NULL;
894 + spin_unlock_bh(&sl->lock);
895 +
896 ++ synchronize_rcu();
897 + flush_work(&sl->tx_work);
898 +
899 + /* VSV = very important to remove timers */
900 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
901 +index ee7194a9e231..b179a96ea08c 100644
902 +--- a/drivers/net/usb/lan78xx.c
903 ++++ b/drivers/net/usb/lan78xx.c
904 +@@ -31,6 +31,7 @@
905 + #include <linux/mdio.h>
906 + #include <linux/phy.h>
907 + #include <net/ip6_checksum.h>
908 ++#include <net/vxlan.h>
909 + #include <linux/interrupt.h>
910 + #include <linux/irqdomain.h>
911 + #include <linux/irq.h>
912 +@@ -3525,6 +3526,19 @@ static void lan78xx_tx_timeout(struct net_device *net)
913 + tasklet_schedule(&dev->bh);
914 + }
915 +
916 ++static netdev_features_t lan78xx_features_check(struct sk_buff *skb,
917 ++ struct net_device *netdev,
918 ++ netdev_features_t features)
919 ++{
920 ++ if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE)
921 ++ features &= ~NETIF_F_GSO_MASK;
922 ++
923 ++ features = vlan_features_check(skb, features);
924 ++ features = vxlan_features_check(skb, features);
925 ++
926 ++ return features;
927 ++}
928 ++
929 + static const struct net_device_ops lan78xx_netdev_ops = {
930 + .ndo_open = lan78xx_open,
931 + .ndo_stop = lan78xx_stop,
932 +@@ -3538,6 +3552,7 @@ static const struct net_device_ops lan78xx_netdev_ops = {
933 + .ndo_set_features = lan78xx_set_features,
934 + .ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid,
935 + .ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid,
936 ++ .ndo_features_check = lan78xx_features_check,
937 + };
938 +
939 + static void lan78xx_stat_monitor(unsigned long param)
940 +diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
941 +index 9f3a7b512673..4ffc188d2ffd 100644
942 +--- a/drivers/net/wireless/marvell/libertas/cfg.c
943 ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
944 +@@ -273,6 +273,10 @@ add_ie_rates(u8 *tlv, const u8 *ie, int *nrates)
945 + int hw, ap, ap_max = ie[1];
946 + u8 hw_rate;
947 +
948 ++ if (ap_max > MAX_RATES) {
949 ++ lbs_deb_assoc("invalid rates\n");
950 ++ return tlv;
951 ++ }
952 + /* Advance past IE header */
953 + ie += 2;
954 +
955 +@@ -1720,6 +1724,9 @@ static int lbs_ibss_join_existing(struct lbs_private *priv,
956 + struct cmd_ds_802_11_ad_hoc_join cmd;
957 + u8 preamble = RADIO_PREAMBLE_SHORT;
958 + int ret = 0;
959 ++ int hw, i;
960 ++ u8 rates_max;
961 ++ u8 *rates;
962 +
963 + /* TODO: set preamble based on scan result */
964 + ret = lbs_set_radio(priv, preamble, 1);
965 +@@ -1778,9 +1785,12 @@ static int lbs_ibss_join_existing(struct lbs_private *priv,
966 + if (!rates_eid) {
967 + lbs_add_rates(cmd.bss.rates);
968 + } else {
969 +- int hw, i;
970 +- u8 rates_max = rates_eid[1];
971 +- u8 *rates = cmd.bss.rates;
972 ++ rates_max = rates_eid[1];
973 ++ if (rates_max > MAX_RATES) {
974 ++ lbs_deb_join("invalid rates");
975 ++ goto out;
976 ++ }
977 ++ rates = cmd.bss.rates;
978 + for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) {
979 + u8 hw_rate = lbs_rates[hw].bitrate / 5;
980 + for (i = 0; i < rates_max; i++) {
981 +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
982 +index b4d06bd9ed51..95d71e301a53 100644
983 +--- a/drivers/scsi/scsi_transport_iscsi.c
984 ++++ b/drivers/scsi/scsi_transport_iscsi.c
985 +@@ -37,6 +37,8 @@
986 +
987 + #define ISCSI_TRANSPORT_VERSION "2.0-870"
988 +
989 ++#define ISCSI_SEND_MAX_ALLOWED 10
990 ++
991 + static int dbg_session;
992 + module_param_named(debug_session, dbg_session, int,
993 + S_IRUGO | S_IWUSR);
994 +@@ -3680,6 +3682,7 @@ iscsi_if_rx(struct sk_buff *skb)
995 + struct nlmsghdr *nlh;
996 + struct iscsi_uevent *ev;
997 + uint32_t group;
998 ++ int retries = ISCSI_SEND_MAX_ALLOWED;
999 +
1000 + nlh = nlmsg_hdr(skb);
1001 + if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) ||
1002 +@@ -3710,6 +3713,10 @@ iscsi_if_rx(struct sk_buff *skb)
1003 + break;
1004 + err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
1005 + ev, sizeof(*ev));
1006 ++ if (err == -EAGAIN && --retries < 0) {
1007 ++ printk(KERN_WARNING "Send reply failed, error %d\n", err);
1008 ++ break;
1009 ++ }
1010 + } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH);
1011 + skb_pull(skb, rlen);
1012 + }
1013 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
1014 +index 2955b856e9ec..e8c2afbb82e9 100644
1015 +--- a/drivers/scsi/sd.c
1016 ++++ b/drivers/scsi/sd.c
1017 +@@ -1981,9 +1981,13 @@ static int sd_done(struct scsi_cmnd *SCpnt)
1018 + }
1019 + break;
1020 + case REQ_OP_ZONE_REPORT:
1021 ++ /* To avoid that the block layer performs an incorrect
1022 ++ * bio_advance() call and restart of the remainder of
1023 ++ * incomplete report zone BIOs, always indicate a full
1024 ++ * completion of REQ_OP_ZONE_REPORT.
1025 ++ */
1026 + if (!result) {
1027 +- good_bytes = scsi_bufflen(SCpnt)
1028 +- - scsi_get_resid(SCpnt);
1029 ++ good_bytes = scsi_bufflen(SCpnt);
1030 + scsi_set_resid(SCpnt, 0);
1031 + } else {
1032 + good_bytes = 0;
1033 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
1034 +index 21ce92ee1652..37d64acea5e1 100644
1035 +--- a/drivers/target/iscsi/iscsi_target.c
1036 ++++ b/drivers/target/iscsi/iscsi_target.c
1037 +@@ -4155,9 +4155,6 @@ int iscsit_close_connection(
1038 + iscsit_stop_nopin_response_timer(conn);
1039 + iscsit_stop_nopin_timer(conn);
1040 +
1041 +- if (conn->conn_transport->iscsit_wait_conn)
1042 +- conn->conn_transport->iscsit_wait_conn(conn);
1043 +-
1044 + /*
1045 + * During Connection recovery drop unacknowledged out of order
1046 + * commands for this connection, and prepare the other commands
1047 +@@ -4243,6 +4240,9 @@ int iscsit_close_connection(
1048 + target_sess_cmd_list_set_waiting(sess->se_sess);
1049 + target_wait_for_sess_cmds(sess->se_sess);
1050 +
1051 ++ if (conn->conn_transport->iscsit_wait_conn)
1052 ++ conn->conn_transport->iscsit_wait_conn(conn);
1053 ++
1054 + ahash_request_free(conn->conn_tx_hash);
1055 + if (conn->conn_rx_hash) {
1056 + struct crypto_ahash *tfm;
1057 +diff --git a/fs/namei.c b/fs/namei.c
1058 +index d1e467b7b9de..d648d6d2b635 100644
1059 +--- a/fs/namei.c
1060 ++++ b/fs/namei.c
1061 +@@ -1023,7 +1023,8 @@ static int may_linkat(struct path *link)
1062 + * may_create_in_sticky - Check whether an O_CREAT open in a sticky directory
1063 + * should be allowed, or not, on files that already
1064 + * exist.
1065 +- * @dir: the sticky parent directory
1066 ++ * @dir_mode: mode bits of directory
1067 ++ * @dir_uid: owner of directory
1068 + * @inode: the inode of the file to open
1069 + *
1070 + * Block an O_CREAT open of a FIFO (or a regular file) when:
1071 +@@ -1039,18 +1040,18 @@ static int may_linkat(struct path *link)
1072 + *
1073 + * Returns 0 if the open is allowed, -ve on error.
1074 + */
1075 +-static int may_create_in_sticky(struct dentry * const dir,
1076 ++static int may_create_in_sticky(umode_t dir_mode, kuid_t dir_uid,
1077 + struct inode * const inode)
1078 + {
1079 + if ((!sysctl_protected_fifos && S_ISFIFO(inode->i_mode)) ||
1080 + (!sysctl_protected_regular && S_ISREG(inode->i_mode)) ||
1081 +- likely(!(dir->d_inode->i_mode & S_ISVTX)) ||
1082 +- uid_eq(inode->i_uid, dir->d_inode->i_uid) ||
1083 ++ likely(!(dir_mode & S_ISVTX)) ||
1084 ++ uid_eq(inode->i_uid, dir_uid) ||
1085 + uid_eq(current_fsuid(), inode->i_uid))
1086 + return 0;
1087 +
1088 +- if (likely(dir->d_inode->i_mode & 0002) ||
1089 +- (dir->d_inode->i_mode & 0020 &&
1090 ++ if (likely(dir_mode & 0002) ||
1091 ++ (dir_mode & 0020 &&
1092 + ((sysctl_protected_fifos >= 2 && S_ISFIFO(inode->i_mode)) ||
1093 + (sysctl_protected_regular >= 2 && S_ISREG(inode->i_mode))))) {
1094 + return -EACCES;
1095 +@@ -3265,6 +3266,8 @@ static int do_last(struct nameidata *nd,
1096 + int *opened)
1097 + {
1098 + struct dentry *dir = nd->path.dentry;
1099 ++ kuid_t dir_uid = dir->d_inode->i_uid;
1100 ++ umode_t dir_mode = dir->d_inode->i_mode;
1101 + int open_flag = op->open_flag;
1102 + bool will_truncate = (open_flag & O_TRUNC) != 0;
1103 + bool got_write = false;
1104 +@@ -3400,7 +3403,7 @@ finish_open:
1105 + error = -EISDIR;
1106 + if (d_is_dir(nd->path.dentry))
1107 + goto out;
1108 +- error = may_create_in_sticky(dir,
1109 ++ error = may_create_in_sticky(dir_mode, dir_uid,
1110 + d_backing_inode(nd->path.dentry));
1111 + if (unlikely(error))
1112 + goto out;
1113 +diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
1114 +index aec255fb62aa..10a4dd02221d 100644
1115 +--- a/include/linux/bitmap.h
1116 ++++ b/include/linux/bitmap.h
1117 +@@ -86,6 +86,14 @@
1118 + * contain all bit positions from 0 to 'bits' - 1.
1119 + */
1120 +
1121 ++/*
1122 ++ * Allocation and deallocation of bitmap.
1123 ++ * Provided in lib/bitmap.c to avoid circular dependency.
1124 ++ */
1125 ++extern unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
1126 ++extern unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
1127 ++extern void bitmap_free(const unsigned long *bitmap);
1128 ++
1129 + /*
1130 + * lib/bitmap.c provides these functions:
1131 + */
1132 +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
1133 +index 8818291815bc..31fc54757bf2 100644
1134 +--- a/include/linux/netdevice.h
1135 ++++ b/include/linux/netdevice.h
1136 +@@ -3313,6 +3313,7 @@ int dev_set_alias(struct net_device *, const char *, size_t);
1137 + int dev_change_net_namespace(struct net_device *, struct net *, const char *);
1138 + int __dev_set_mtu(struct net_device *, int);
1139 + int dev_set_mtu(struct net_device *, int);
1140 ++int dev_validate_mtu(struct net_device *dev, int mtu);
1141 + void dev_set_group(struct net_device *, int);
1142 + int dev_set_mac_address(struct net_device *, struct sockaddr *);
1143 + int dev_change_carrier(struct net_device *, bool new_carrier);
1144 +diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
1145 +index 91a533bd3eb1..b7246b7e0bf4 100644
1146 +--- a/include/linux/netfilter/ipset/ip_set.h
1147 ++++ b/include/linux/netfilter/ipset/ip_set.h
1148 +@@ -445,13 +445,6 @@ ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
1149 + sizeof(*addr));
1150 + }
1151 +
1152 +-/* Calculate the bytes required to store the inclusive range of a-b */
1153 +-static inline int
1154 +-bitmap_bytes(u32 a, u32 b)
1155 +-{
1156 +- return 4 * ((((b - a + 8) / 8) + 3) / 4);
1157 +-}
1158 +-
1159 + #include <linux/netfilter/ipset/ip_set_timeout.h>
1160 + #include <linux/netfilter/ipset/ip_set_comment.h>
1161 + #include <linux/netfilter/ipset/ip_set_counter.h>
1162 +diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
1163 +index 2ec9064a2bb7..e5150fc67e91 100644
1164 +--- a/include/trace/events/xen.h
1165 ++++ b/include/trace/events/xen.h
1166 +@@ -66,7 +66,11 @@ TRACE_EVENT(xen_mc_callback,
1167 + TP_PROTO(xen_mc_callback_fn_t fn, void *data),
1168 + TP_ARGS(fn, data),
1169 + TP_STRUCT__entry(
1170 +- __field(xen_mc_callback_fn_t, fn)
1171 ++ /*
1172 ++ * Use field_struct to avoid is_signed_type()
1173 ++ * comparison of a function pointer.
1174 ++ */
1175 ++ __field_struct(xen_mc_callback_fn_t, fn)
1176 + __field(void *, data)
1177 + ),
1178 + TP_fast_assign(
1179 +diff --git a/lib/bitmap.c b/lib/bitmap.c
1180 +index 2a9373ef4054..fbe38a83acb3 100644
1181 +--- a/lib/bitmap.c
1182 ++++ b/lib/bitmap.c
1183 +@@ -13,6 +13,7 @@
1184 + #include <linux/bitops.h>
1185 + #include <linux/bug.h>
1186 + #include <linux/kernel.h>
1187 ++#include <linux/slab.h>
1188 + #include <linux/string.h>
1189 + #include <linux/uaccess.h>
1190 +
1191 +@@ -1212,3 +1213,22 @@ void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int n
1192 + }
1193 + EXPORT_SYMBOL(bitmap_copy_le);
1194 + #endif
1195 ++
1196 ++unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags)
1197 ++{
1198 ++ return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long),
1199 ++ flags);
1200 ++}
1201 ++EXPORT_SYMBOL(bitmap_alloc);
1202 ++
1203 ++unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags)
1204 ++{
1205 ++ return bitmap_alloc(nbits, flags | __GFP_ZERO);
1206 ++}
1207 ++EXPORT_SYMBOL(bitmap_zalloc);
1208 ++
1209 ++void bitmap_free(const unsigned long *bitmap)
1210 ++{
1211 ++ kfree(bitmap);
1212 ++}
1213 ++EXPORT_SYMBOL(bitmap_free);
1214 +diff --git a/net/core/dev.c b/net/core/dev.c
1215 +index f9f05b3df460..36d926d2d5f0 100644
1216 +--- a/net/core/dev.c
1217 ++++ b/net/core/dev.c
1218 +@@ -6896,18 +6896,9 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
1219 + if (new_mtu == dev->mtu)
1220 + return 0;
1221 +
1222 +- /* MTU must be positive, and in range */
1223 +- if (new_mtu < 0 || new_mtu < dev->min_mtu) {
1224 +- net_err_ratelimited("%s: Invalid MTU %d requested, hw min %d\n",
1225 +- dev->name, new_mtu, dev->min_mtu);
1226 +- return -EINVAL;
1227 +- }
1228 +-
1229 +- if (dev->max_mtu > 0 && new_mtu > dev->max_mtu) {
1230 +- net_err_ratelimited("%s: Invalid MTU %d requested, hw max %d\n",
1231 +- dev->name, new_mtu, dev->max_mtu);
1232 +- return -EINVAL;
1233 +- }
1234 ++ err = dev_validate_mtu(dev, new_mtu);
1235 ++ if (err)
1236 ++ return err;
1237 +
1238 + if (!netif_device_present(dev))
1239 + return -ENODEV;
1240 +@@ -7667,8 +7658,10 @@ int register_netdevice(struct net_device *dev)
1241 + goto err_uninit;
1242 +
1243 + ret = netdev_register_kobject(dev);
1244 +- if (ret)
1245 ++ if (ret) {
1246 ++ dev->reg_state = NETREG_UNREGISTERED;
1247 + goto err_uninit;
1248 ++ }
1249 + dev->reg_state = NETREG_REGISTERED;
1250 +
1251 + __netdev_update_features(dev);
1252 +@@ -7767,6 +7760,23 @@ int init_dummy_netdev(struct net_device *dev)
1253 + EXPORT_SYMBOL_GPL(init_dummy_netdev);
1254 +
1255 +
1256 ++int dev_validate_mtu(struct net_device *dev, int new_mtu)
1257 ++{
1258 ++ /* MTU must be positive, and in range */
1259 ++ if (new_mtu < 0 || new_mtu < dev->min_mtu) {
1260 ++ net_err_ratelimited("%s: Invalid MTU %d requested, hw min %d\n",
1261 ++ dev->name, new_mtu, dev->min_mtu);
1262 ++ return -EINVAL;
1263 ++ }
1264 ++
1265 ++ if (dev->max_mtu > 0 && new_mtu > dev->max_mtu) {
1266 ++ net_err_ratelimited("%s: Invalid MTU %d requested, hw max %d\n",
1267 ++ dev->name, new_mtu, dev->max_mtu);
1268 ++ return -EINVAL;
1269 ++ }
1270 ++ return 0;
1271 ++}
1272 ++
1273 + /**
1274 + * register_netdev - register a network device
1275 + * @dev: device to register
1276 +diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
1277 +index dee57c5ff738..baf771d2d088 100644
1278 +--- a/net/core/net-sysfs.c
1279 ++++ b/net/core/net-sysfs.c
1280 +@@ -911,25 +911,30 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)
1281 + struct kobject *kobj = &queue->kobj;
1282 + int error = 0;
1283 +
1284 ++ /* Kobject_put later will trigger rx_queue_release call which
1285 ++ * decreases dev refcount: Take that reference here
1286 ++ */
1287 ++ dev_hold(queue->dev);
1288 ++
1289 + kobj->kset = dev->queues_kset;
1290 + error = kobject_init_and_add(kobj, &rx_queue_ktype, NULL,
1291 + "rx-%u", index);
1292 + if (error)
1293 +- return error;
1294 +-
1295 +- dev_hold(queue->dev);
1296 ++ goto err;
1297 +
1298 + if (dev->sysfs_rx_queue_group) {
1299 + error = sysfs_create_group(kobj, dev->sysfs_rx_queue_group);
1300 +- if (error) {
1301 +- kobject_put(kobj);
1302 +- return error;
1303 +- }
1304 ++ if (error)
1305 ++ goto err;
1306 + }
1307 +
1308 + kobject_uevent(kobj, KOBJ_ADD);
1309 +
1310 + return error;
1311 ++
1312 ++err:
1313 ++ kobject_put(kobj);
1314 ++ return error;
1315 + }
1316 + #endif /* CONFIG_SYSFS */
1317 +
1318 +@@ -1322,25 +1327,29 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)
1319 + struct kobject *kobj = &queue->kobj;
1320 + int error = 0;
1321 +
1322 ++ /* Kobject_put later will trigger netdev_queue_release call
1323 ++ * which decreases dev refcount: Take that reference here
1324 ++ */
1325 ++ dev_hold(queue->dev);
1326 ++
1327 + kobj->kset = dev->queues_kset;
1328 + error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL,
1329 + "tx-%u", index);
1330 + if (error)
1331 +- return error;
1332 +-
1333 +- dev_hold(queue->dev);
1334 ++ goto err;
1335 +
1336 + #ifdef CONFIG_BQL
1337 + error = sysfs_create_group(kobj, &dql_group);
1338 +- if (error) {
1339 +- kobject_put(kobj);
1340 +- return error;
1341 +- }
1342 ++ if (error)
1343 ++ goto err;
1344 + #endif
1345 +
1346 + kobject_uevent(kobj, KOBJ_ADD);
1347 +-
1348 + return 0;
1349 ++
1350 ++err:
1351 ++ kobject_put(kobj);
1352 ++ return error;
1353 + }
1354 + #endif /* CONFIG_SYSFS */
1355 +
1356 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
1357 +index b598e9909fec..7c479c1ffd77 100644
1358 +--- a/net/core/rtnetlink.c
1359 ++++ b/net/core/rtnetlink.c
1360 +@@ -2466,8 +2466,17 @@ struct net_device *rtnl_create_link(struct net *net,
1361 + dev->rtnl_link_ops = ops;
1362 + dev->rtnl_link_state = RTNL_LINK_INITIALIZING;
1363 +
1364 +- if (tb[IFLA_MTU])
1365 +- dev->mtu = nla_get_u32(tb[IFLA_MTU]);
1366 ++ if (tb[IFLA_MTU]) {
1367 ++ u32 mtu = nla_get_u32(tb[IFLA_MTU]);
1368 ++ int err;
1369 ++
1370 ++ err = dev_validate_mtu(dev, mtu);
1371 ++ if (err) {
1372 ++ free_netdev(dev);
1373 ++ return ERR_PTR(err);
1374 ++ }
1375 ++ dev->mtu = mtu;
1376 ++ }
1377 + if (tb[IFLA_ADDRESS]) {
1378 + memcpy(dev->dev_addr, nla_data(tb[IFLA_ADDRESS]),
1379 + nla_len(tb[IFLA_ADDRESS]));
1380 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
1381 +index f1784162acc2..404dc765f2bf 100644
1382 +--- a/net/ipv4/ip_tunnel.c
1383 ++++ b/net/ipv4/ip_tunnel.c
1384 +@@ -1202,10 +1202,8 @@ int ip_tunnel_init(struct net_device *dev)
1385 + iph->version = 4;
1386 + iph->ihl = 5;
1387 +
1388 +- if (tunnel->collect_md) {
1389 +- dev->features |= NETIF_F_NETNS_LOCAL;
1390 ++ if (tunnel->collect_md)
1391 + netif_keep_dst(dev);
1392 +- }
1393 + return 0;
1394 + }
1395 + EXPORT_SYMBOL_GPL(ip_tunnel_init);
1396 +diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
1397 +index 06f247ca9197..434ad1e72447 100644
1398 +--- a/net/ipv4/tcp_bbr.c
1399 ++++ b/net/ipv4/tcp_bbr.c
1400 +@@ -678,8 +678,7 @@ static void bbr_update_bw(struct sock *sk, const struct rate_sample *rs)
1401 + * bandwidth sample. Delivered is in packets and interval_us in uS and
1402 + * ratio will be <<1 for most connections. So delivered is first scaled.
1403 + */
1404 +- bw = (u64)rs->delivered * BW_UNIT;
1405 +- do_div(bw, rs->interval_us);
1406 ++ bw = div64_long((u64)rs->delivered * BW_UNIT, rs->interval_us);
1407 +
1408 + /* If this sample is application-limited, it is likely to have a very
1409 + * low delivered count that represents application behavior rather than
1410 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
1411 +index 5bc2788e6ba4..c2644405bab1 100644
1412 +--- a/net/ipv6/ip6_tunnel.c
1413 ++++ b/net/ipv6/ip6_tunnel.c
1414 +@@ -1878,10 +1878,8 @@ static int ip6_tnl_dev_init(struct net_device *dev)
1415 + if (err)
1416 + return err;
1417 + ip6_tnl_link_config(t);
1418 +- if (t->parms.collect_md) {
1419 +- dev->features |= NETIF_F_NETNS_LOCAL;
1420 ++ if (t->parms.collect_md)
1421 + netif_keep_dst(dev);
1422 +- }
1423 + return 0;
1424 + }
1425 +
1426 +diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
1427 +index 825b8e01f947..9a01f72d907f 100644
1428 +--- a/net/ipv6/seg6_local.c
1429 ++++ b/net/ipv6/seg6_local.c
1430 +@@ -27,6 +27,7 @@
1431 + #include <net/addrconf.h>
1432 + #include <net/ip6_route.h>
1433 + #include <net/dst_cache.h>
1434 ++#include <net/ip_tunnels.h>
1435 + #ifdef CONFIG_IPV6_SEG6_HMAC
1436 + #include <net/seg6_hmac.h>
1437 + #endif
1438 +@@ -126,7 +127,8 @@ static bool decap_and_validate(struct sk_buff *skb, int proto)
1439 +
1440 + skb_reset_network_header(skb);
1441 + skb_reset_transport_header(skb);
1442 +- skb->encapsulation = 0;
1443 ++ if (iptunnel_pull_offloads(skb))
1444 ++ return false;
1445 +
1446 + return true;
1447 + }
1448 +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
1449 +index b0701f6259cc..3c0e345367a5 100644
1450 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
1451 ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
1452 +@@ -79,7 +79,7 @@ mtype_flush(struct ip_set *set)
1453 +
1454 + if (set->extensions & IPSET_EXT_DESTROY)
1455 + mtype_ext_cleanup(set);
1456 +- memset(map->members, 0, map->memsize);
1457 ++ bitmap_zero(map->members, map->elements);
1458 + set->elements = 0;
1459 + set->ext_size = 0;
1460 + }
1461 +diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c
1462 +index 4783efff0bde..a4c104a4977f 100644
1463 +--- a/net/netfilter/ipset/ip_set_bitmap_ip.c
1464 ++++ b/net/netfilter/ipset/ip_set_bitmap_ip.c
1465 +@@ -40,7 +40,7 @@ MODULE_ALIAS("ip_set_bitmap:ip");
1466 +
1467 + /* Type structure */
1468 + struct bitmap_ip {
1469 +- void *members; /* the set members */
1470 ++ unsigned long *members; /* the set members */
1471 + u32 first_ip; /* host byte order, included in range */
1472 + u32 last_ip; /* host byte order, included in range */
1473 + u32 elements; /* number of max elements in the set */
1474 +@@ -222,7 +222,7 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map,
1475 + u32 first_ip, u32 last_ip,
1476 + u32 elements, u32 hosts, u8 netmask)
1477 + {
1478 +- map->members = ip_set_alloc(map->memsize);
1479 ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN);
1480 + if (!map->members)
1481 + return false;
1482 + map->first_ip = first_ip;
1483 +@@ -315,7 +315,7 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
1484 + if (!map)
1485 + return -ENOMEM;
1486 +
1487 +- map->memsize = bitmap_bytes(0, elements - 1);
1488 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
1489 + set->variant = &bitmap_ip;
1490 + if (!init_map_ip(set, map, first_ip, last_ip,
1491 + elements, hosts, netmask)) {
1492 +diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
1493 +index 9a065f672d3a..8e58e7e34981 100644
1494 +--- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c
1495 ++++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
1496 +@@ -46,7 +46,7 @@ enum {
1497 +
1498 + /* Type structure */
1499 + struct bitmap_ipmac {
1500 +- void *members; /* the set members */
1501 ++ unsigned long *members; /* the set members */
1502 + u32 first_ip; /* host byte order, included in range */
1503 + u32 last_ip; /* host byte order, included in range */
1504 + u32 elements; /* number of max elements in the set */
1505 +@@ -299,7 +299,7 @@ static bool
1506 + init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map,
1507 + u32 first_ip, u32 last_ip, u32 elements)
1508 + {
1509 +- map->members = ip_set_alloc(map->memsize);
1510 ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN);
1511 + if (!map->members)
1512 + return false;
1513 + map->first_ip = first_ip;
1514 +@@ -363,7 +363,7 @@ bitmap_ipmac_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
1515 + if (!map)
1516 + return -ENOMEM;
1517 +
1518 +- map->memsize = bitmap_bytes(0, elements - 1);
1519 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
1520 + set->variant = &bitmap_ipmac;
1521 + if (!init_map_ipmac(set, map, first_ip, last_ip, elements)) {
1522 + kfree(map);
1523 +diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c
1524 +index 7f0c733358a4..6771b362a123 100644
1525 +--- a/net/netfilter/ipset/ip_set_bitmap_port.c
1526 ++++ b/net/netfilter/ipset/ip_set_bitmap_port.c
1527 +@@ -34,7 +34,7 @@ MODULE_ALIAS("ip_set_bitmap:port");
1528 +
1529 + /* Type structure */
1530 + struct bitmap_port {
1531 +- void *members; /* the set members */
1532 ++ unsigned long *members; /* the set members */
1533 + u16 first_port; /* host byte order, included in range */
1534 + u16 last_port; /* host byte order, included in range */
1535 + u32 elements; /* number of max elements in the set */
1536 +@@ -207,7 +207,7 @@ static bool
1537 + init_map_port(struct ip_set *set, struct bitmap_port *map,
1538 + u16 first_port, u16 last_port)
1539 + {
1540 +- map->members = ip_set_alloc(map->memsize);
1541 ++ map->members = bitmap_zalloc(map->elements, GFP_KERNEL | __GFP_NOWARN);
1542 + if (!map->members)
1543 + return false;
1544 + map->first_port = first_port;
1545 +@@ -250,7 +250,7 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
1546 + return -ENOMEM;
1547 +
1548 + map->elements = elements;
1549 +- map->memsize = bitmap_bytes(0, map->elements);
1550 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
1551 + set->variant = &bitmap_port;
1552 + if (!init_map_port(set, map, first_port, last_port)) {
1553 + kfree(map);
1554 +diff --git a/net/sched/ematch.c b/net/sched/ematch.c
1555 +index 03b677bc0700..60f2354c1789 100644
1556 +--- a/net/sched/ematch.c
1557 ++++ b/net/sched/ematch.c
1558 +@@ -267,12 +267,12 @@ static int tcf_em_validate(struct tcf_proto *tp,
1559 + }
1560 + em->data = (unsigned long) v;
1561 + }
1562 ++ em->datalen = data_len;
1563 + }
1564 + }
1565 +
1566 + em->matchid = em_hdr->matchid;
1567 + em->flags = em_hdr->flags;
1568 +- em->datalen = data_len;
1569 + em->net = net;
1570 +
1571 + err = 0;
1572 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
1573 +index a156b6dc3a72..f4fa33b84cde 100644
1574 +--- a/net/x25/af_x25.c
1575 ++++ b/net/x25/af_x25.c
1576 +@@ -764,6 +764,10 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
1577 + if (sk->sk_state == TCP_ESTABLISHED)
1578 + goto out;
1579 +
1580 ++ rc = -EALREADY; /* Do nothing if call is already in progress */
1581 ++ if (sk->sk_state == TCP_SYN_SENT)
1582 ++ goto out;
1583 ++
1584 + sk->sk_state = TCP_CLOSE;
1585 + sock->state = SS_UNCONNECTED;
1586 +
1587 +@@ -810,7 +814,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
1588 + /* Now the loop */
1589 + rc = -EINPROGRESS;
1590 + if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
1591 +- goto out_put_neigh;
1592 ++ goto out;
1593 +
1594 + rc = x25_wait_for_connection_establishment(sk);
1595 + if (rc)
1596 +diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
1597 +index 16e086dcc567..a4888e955466 100644
1598 +--- a/scripts/recordmcount.c
1599 ++++ b/scripts/recordmcount.c
1600 +@@ -53,6 +53,10 @@
1601 + #define R_AARCH64_ABS64 257
1602 + #endif
1603 +
1604 ++#define R_ARM_PC24 1
1605 ++#define R_ARM_THM_CALL 10
1606 ++#define R_ARM_CALL 28
1607 ++
1608 + static int fd_map; /* File descriptor for file being modified. */
1609 + static int mmap_failed; /* Boolean flag. */
1610 + static char gpfx; /* prefix for global symbol name (sometimes '_') */
1611 +@@ -428,6 +432,18 @@ is_mcounted_section_name(char const *const txtname)
1612 + #define RECORD_MCOUNT_64
1613 + #include "recordmcount.h"
1614 +
1615 ++static int arm_is_fake_mcount(Elf32_Rel const *rp)
1616 ++{
1617 ++ switch (ELF32_R_TYPE(w(rp->r_info))) {
1618 ++ case R_ARM_THM_CALL:
1619 ++ case R_ARM_CALL:
1620 ++ case R_ARM_PC24:
1621 ++ return 0;
1622 ++ }
1623 ++
1624 ++ return 1;
1625 ++}
1626 ++
1627 + /* 64-bit EM_MIPS has weird ELF64_Rela.r_info.
1628 + * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
1629 + * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40]
1630 +@@ -529,6 +545,7 @@ do_file(char const *const fname)
1631 + altmcount = "__gnu_mcount_nc";
1632 + make_nop = make_nop_arm;
1633 + rel_type_nop = R_ARM_NONE;
1634 ++ is_fake_mcount32 = arm_is_fake_mcount;
1635 + break;
1636 + case EM_AARCH64:
1637 + reltype = R_AARCH64_ABS64;