Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 30 Jun 2021 14:29:05
Message-Id: 1625063329.187ad3ce7424083662d9a830ab9fbdd38ff0fc36.mpagano@gentoo
1 commit: 187ad3ce7424083662d9a830ab9fbdd38ff0fc36
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 30 14:28:49 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 30 14:28:49 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=187ad3ce
7
8 Linux patch 4.4.274
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1273_linux-4.4.274.patch | 1405 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1409 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index acc47c7..b63a9bc 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1135,6 +1135,10 @@ Patch: 1272_linux-4.4.273.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.273
23
24 +Patch: 1273_linux-4.4.274.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.274
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/1273_linux-4.4.274.patch b/1273_linux-4.4.274.patch
33 new file mode 100644
34 index 0000000..d14cd83
35 --- /dev/null
36 +++ b/1273_linux-4.4.274.patch
37 @@ -0,0 +1,1405 @@
38 +diff --git a/Makefile b/Makefile
39 +index 78a317e69e7fa..3d1fc6eb95eca 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 273
46 ++SUBLEVEL = 274
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +@@ -716,12 +716,11 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
51 + # See modpost pattern 2
52 + KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
53 + KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
54 +-else
55 ++endif
56 +
57 + # These warnings generated too much noise in a regular build.
58 + # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
59 + KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
60 +-endif
61 +
62 + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
63 + ifdef CONFIG_FRAME_POINTER
64 +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
65 +index e9c3d38d995d2..ad72e83e11d16 100644
66 +--- a/arch/arm/kernel/setup.c
67 ++++ b/arch/arm/kernel/setup.c
68 +@@ -479,9 +479,11 @@ void notrace cpu_init(void)
69 + * In Thumb-2, msr with an immediate value is not allowed.
70 + */
71 + #ifdef CONFIG_THUMB2_KERNEL
72 +-#define PLC "r"
73 ++#define PLC_l "l"
74 ++#define PLC_r "r"
75 + #else
76 +-#define PLC "I"
77 ++#define PLC_l "I"
78 ++#define PLC_r "I"
79 + #endif
80 +
81 + /*
82 +@@ -503,15 +505,15 @@ void notrace cpu_init(void)
83 + "msr cpsr_c, %9"
84 + :
85 + : "r" (stk),
86 +- PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
87 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
88 + "I" (offsetof(struct stack, irq[0])),
89 +- PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
90 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
91 + "I" (offsetof(struct stack, abt[0])),
92 +- PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
93 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE),
94 + "I" (offsetof(struct stack, und[0])),
95 +- PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
96 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
97 + "I" (offsetof(struct stack, fiq[0])),
98 +- PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
99 ++ PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
100 + : "r14");
101 + #endif
102 + }
103 +diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
104 +index b6443a4e0c780..68af9d9566cba 100644
105 +--- a/arch/arm/mach-omap2/board-n8x0.c
106 ++++ b/arch/arm/mach-omap2/board-n8x0.c
107 +@@ -328,6 +328,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot)
108 +
109 + static void n8x0_mmc_callback(void *data, u8 card_mask)
110 + {
111 ++#ifdef CONFIG_MMC_OMAP
112 + int bit, *openp, index;
113 +
114 + if (board_is_n800()) {
115 +@@ -345,7 +346,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
116 + else
117 + *openp = 0;
118 +
119 +-#ifdef CONFIG_MMC_OMAP
120 + omap_mmc_notify_cover_event(mmc_device, index, *openp);
121 + #else
122 + pr_warn("MMC: notify cover event not available\n");
123 +diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
124 +index 8fc842dae3b39..9a1489b927827 100644
125 +--- a/arch/x86/kernel/fpu/signal.c
126 ++++ b/arch/x86/kernel/fpu/signal.c
127 +@@ -262,15 +262,23 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
128 + return 0;
129 + }
130 +
131 +- if (!access_ok(VERIFY_READ, buf, size))
132 ++ if (!access_ok(VERIFY_READ, buf, size)) {
133 ++ fpu__clear(fpu);
134 + return -EACCES;
135 ++ }
136 +
137 + fpu__activate_curr(fpu);
138 +
139 +- if (!static_cpu_has(X86_FEATURE_FPU))
140 +- return fpregs_soft_set(current, NULL,
141 +- 0, sizeof(struct user_i387_ia32_struct),
142 +- NULL, buf) != 0;
143 ++ if (!static_cpu_has(X86_FEATURE_FPU)) {
144 ++ int ret = fpregs_soft_set(current, NULL, 0,
145 ++ sizeof(struct user_i387_ia32_struct),
146 ++ NULL, buf);
147 ++
148 ++ if (ret)
149 ++ fpu__clear(fpu);
150 ++
151 ++ return ret != 0;
152 ++ }
153 +
154 + if (use_xsave()) {
155 + struct _fpx_sw_bytes fx_sw_user;
156 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
157 +index 7f66ae1945b24..6ea993478ddd1 100644
158 +--- a/drivers/dma/pl330.c
159 ++++ b/drivers/dma/pl330.c
160 +@@ -2531,13 +2531,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
161 + for (i = 0; i < len / period_len; i++) {
162 + desc = pl330_get_desc(pch);
163 + if (!desc) {
164 ++ unsigned long iflags;
165 ++
166 + dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n",
167 + __func__, __LINE__);
168 +
169 + if (!first)
170 + return NULL;
171 +
172 +- spin_lock_irqsave(&pl330->pool_lock, flags);
173 ++ spin_lock_irqsave(&pl330->pool_lock, iflags);
174 +
175 + while (!list_empty(&first->node)) {
176 + desc = list_entry(first->node.next,
177 +@@ -2547,7 +2549,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
178 +
179 + list_move_tail(&first->node, &pl330->desc_pool);
180 +
181 +- spin_unlock_irqrestore(&pl330->pool_lock, flags);
182 ++ spin_unlock_irqrestore(&pl330->pool_lock, iflags);
183 +
184 + return NULL;
185 + }
186 +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
187 +index 0fede051f4e1c..e6d3ed1de374a 100644
188 +--- a/drivers/dma/ste_dma40.c
189 ++++ b/drivers/dma/ste_dma40.c
190 +@@ -3715,6 +3715,9 @@ failure:
191 +
192 + kfree(base->lcla_pool.base_unaligned);
193 +
194 ++ if (base->lcpa_base)
195 ++ iounmap(base->lcpa_base);
196 ++
197 + if (base->phy_lcpa)
198 + release_mem_region(base->phy_lcpa,
199 + base->lcpa_size);
200 +diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
201 +index b35ebabd6a9f8..eab985fdcfbd7 100644
202 +--- a/drivers/gpu/drm/radeon/radeon_uvd.c
203 ++++ b/drivers/gpu/drm/radeon/radeon_uvd.c
204 +@@ -242,7 +242,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
205 + if (rdev->uvd.vcpu_bo == NULL)
206 + return -EINVAL;
207 +
208 +- memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
209 ++ memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
210 +
211 + size = radeon_bo_size(rdev->uvd.vcpu_bo);
212 + size -= rdev->uvd_fw->size;
213 +@@ -250,7 +250,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
214 + ptr = rdev->uvd.cpu_addr;
215 + ptr += rdev->uvd_fw->size;
216 +
217 +- memset(ptr, 0, size);
218 ++ memset_io((void __iomem *)ptr, 0, size);
219 +
220 + return 0;
221 + }
222 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
223 +index 25544a08fa838..1dd97f4b449af 100644
224 +--- a/drivers/hid/hid-core.c
225 ++++ b/drivers/hid/hid-core.c
226 +@@ -1765,6 +1765,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
227 + case BUS_I2C:
228 + bus = "I2C";
229 + break;
230 ++ case BUS_VIRTUAL:
231 ++ bus = "VIRTUAL";
232 ++ break;
233 + default:
234 + bus = "<UNKNOWN>";
235 + }
236 +diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c
237 +index 0d6f135e266c2..2991957bbb7fc 100644
238 +--- a/drivers/hid/hid-gt683r.c
239 ++++ b/drivers/hid/hid-gt683r.c
240 +@@ -64,6 +64,7 @@ static const struct hid_device_id gt683r_led_id[] = {
241 + { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
242 + { }
243 + };
244 ++MODULE_DEVICE_TABLE(hid, gt683r_led_id);
245 +
246 + static void gt683r_brightness_set(struct led_classdev *led_cdev,
247 + enum led_brightness brightness)
248 +diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
249 +index 83e45d5801a98..ce4e9b34af980 100644
250 +--- a/drivers/hid/hid-sensor-hub.c
251 ++++ b/drivers/hid/hid-sensor-hub.c
252 +@@ -222,16 +222,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
253 + buffer_size = buffer_size / sizeof(__s32);
254 + if (buffer_size) {
255 + for (i = 0; i < buffer_size; ++i) {
256 +- hid_set_field(report->field[field_index], i,
257 +- (__force __s32)cpu_to_le32(*buf32));
258 ++ ret = hid_set_field(report->field[field_index], i,
259 ++ (__force __s32)cpu_to_le32(*buf32));
260 ++ if (ret)
261 ++ goto done_proc;
262 ++
263 + ++buf32;
264 + }
265 + }
266 + if (remaining_bytes) {
267 + value = 0;
268 + memcpy(&value, (u8 *)buf32, remaining_bytes);
269 +- hid_set_field(report->field[field_index], i,
270 +- (__force __s32)cpu_to_le32(value));
271 ++ ret = hid_set_field(report->field[field_index], i,
272 ++ (__force __s32)cpu_to_le32(value));
273 ++ if (ret)
274 ++ goto done_proc;
275 + }
276 + hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
277 + hid_hw_wait(hsdev->hdev);
278 +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
279 +index b0eeb5090c91e..d51fc2be0e10c 100644
280 +--- a/drivers/hid/usbhid/hid-core.c
281 ++++ b/drivers/hid/usbhid/hid-core.c
282 +@@ -372,7 +372,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
283 + raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report;
284 + dir = usbhid->ctrl[usbhid->ctrltail].dir;
285 +
286 +- len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
287 ++ len = hid_report_len(report);
288 + if (dir == USB_DIR_OUT) {
289 + usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0);
290 + usbhid->urbctrl->transfer_buffer_length = len;
291 +diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
292 +index ced9c6a308d12..09f27060feca6 100644
293 +--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
294 ++++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
295 +@@ -89,7 +89,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
296 + }
297 + }
298 +
299 +- ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
300 ++ ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
301 + if (ret) {
302 + dev_err(&adapter->dev, "failure sending STOP\n");
303 + return -EREMOTEIO;
304 +@@ -159,7 +159,7 @@ static int osif_probe(struct usb_interface *interface,
305 + * Set bus frequency. The frequency is:
306 + * 120,000,000 / ( 16 + 2 * div * 4^prescale).
307 + * Using dev = 52, prescale = 0 give 100KHz */
308 +- ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
309 ++ ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
310 + NULL, 0);
311 + if (ret) {
312 + dev_err(&interface->dev, "failure sending bit rate");
313 +diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
314 +index 32834dad0b836..1243c2e5a86a2 100644
315 +--- a/drivers/net/caif/caif_serial.c
316 ++++ b/drivers/net/caif/caif_serial.c
317 +@@ -362,6 +362,7 @@ static int ldisc_open(struct tty_struct *tty)
318 + rtnl_lock();
319 + result = register_netdevice(dev);
320 + if (result) {
321 ++ tty_kref_put(tty);
322 + rtnl_unlock();
323 + free_netdev(dev);
324 + return -ENODEV;
325 +diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c
326 +index f7b42483921c5..0ade0c6d81ee3 100644
327 +--- a/drivers/net/ethernet/ec_bhf.c
328 ++++ b/drivers/net/ethernet/ec_bhf.c
329 +@@ -589,10 +589,12 @@ static void ec_bhf_remove(struct pci_dev *dev)
330 + struct ec_bhf_priv *priv = netdev_priv(net_dev);
331 +
332 + unregister_netdev(net_dev);
333 +- free_netdev(net_dev);
334 +
335 + pci_iounmap(dev, priv->dma_io);
336 + pci_iounmap(dev, priv->io);
337 ++
338 ++ free_netdev(net_dev);
339 ++
340 + pci_release_regions(dev);
341 + pci_clear_master(dev);
342 + pci_disable_device(dev);
343 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
344 +index 7cd39324106dc..398b9bd09400b 100644
345 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
346 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
347 +@@ -5878,6 +5878,7 @@ drv_cleanup:
348 + unmap_bars:
349 + be_unmap_pci_bars(adapter);
350 + free_netdev:
351 ++ pci_disable_pcie_error_reporting(pdev);
352 + free_netdev(netdev);
353 + rel_reg:
354 + pci_release_regions(pdev);
355 +diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
356 +index 1231816125955..031d4b3a544c0 100644
357 +--- a/drivers/net/ethernet/freescale/fec_ptp.c
358 ++++ b/drivers/net/ethernet/freescale/fec_ptp.c
359 +@@ -586,6 +586,10 @@ void fec_ptp_init(struct platform_device *pdev)
360 + fep->ptp_caps.enable = fec_ptp_enable;
361 +
362 + fep->cycle_speed = clk_get_rate(fep->clk_ptp);
363 ++ if (!fep->cycle_speed) {
364 ++ fep->cycle_speed = NSEC_PER_SEC;
365 ++ dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n");
366 ++ }
367 + fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
368 +
369 + spin_lock_init(&fep->tmreg_lock);
370 +diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
371 +index 8ebf3611aba3c..9ecb99a1de35d 100644
372 +--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
373 ++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
374 +@@ -4051,6 +4051,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
375 + dev_err(&pdev->dev,
376 + "invalid sram_size %dB or board span %ldB\n",
377 + mgp->sram_size, mgp->board_span);
378 ++ status = -EINVAL;
379 + goto abort_with_ioremap;
380 + }
381 + memcpy_fromio(mgp->eeprom_strings,
382 +diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
383 +index f5fc0c416e510..f89441f9bd8d1 100644
384 +--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
385 ++++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
386 +@@ -1616,6 +1616,8 @@ err_out_free_netdev:
387 + free_netdev(netdev);
388 +
389 + err_out_free_res:
390 ++ if (NX_IS_REVISION_P3(pdev->revision))
391 ++ pci_disable_pcie_error_reporting(pdev);
392 + pci_release_regions(pdev);
393 +
394 + err_out_disable_pdev:
395 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
396 +index a4b10776f8346..11274b7ea36c9 100644
397 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
398 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
399 +@@ -2706,6 +2706,7 @@ err_out_free_hw_res:
400 + kfree(ahw);
401 +
402 + err_out_free_res:
403 ++ pci_disable_pcie_error_reporting(pdev);
404 + pci_release_regions(pdev);
405 +
406 + err_out_disable_pdev:
407 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
408 +index f3a685d3f6497..55b0f11bf2a02 100644
409 +--- a/drivers/net/ethernet/realtek/r8169.c
410 ++++ b/drivers/net/ethernet/realtek/r8169.c
411 +@@ -2314,7 +2314,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data)
412 + {
413 + switch(stringset) {
414 + case ETH_SS_STATS:
415 +- memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings));
416 ++ memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings));
417 + break;
418 + }
419 + }
420 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
421 +index 614b83c7ce817..1942264b621bc 100644
422 +--- a/drivers/net/ethernet/renesas/sh_eth.c
423 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
424 +@@ -2210,7 +2210,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
425 + {
426 + switch (stringset) {
427 + case ETH_SS_STATS:
428 +- memcpy(data, *sh_eth_gstrings_stats,
429 ++ memcpy(data, sh_eth_gstrings_stats,
430 + sizeof(sh_eth_gstrings_stats));
431 + break;
432 + }
433 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
434 +index b3fe0575ff6b7..db2a341ae4b31 100644
435 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
436 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
437 +@@ -83,10 +83,10 @@ enum power_event {
438 + #define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */
439 +
440 + /* GMAC HW ADDR regs */
441 +-#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \
442 +- (reg * 8))
443 +-#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \
444 +- (reg * 8))
445 ++#define GMAC_ADDR_HIGH(reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \
446 ++ 0x00000040 + (reg * 8))
447 ++#define GMAC_ADDR_LOW(reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \
448 ++ 0x00000044 + (reg * 8))
449 + #define GMAC_MAX_PERFECT_ADDRESSES 1
450 +
451 + /* PCS registers (AN/TBI/SGMII/RGMII) offset */
452 +diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
453 +index ed6a88cf3281c..98a1c712b62a7 100644
454 +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
455 ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
456 +@@ -735,6 +735,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
457 + /* Kick off the transfer */
458 + lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
459 +
460 ++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
461 ++ netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
462 ++ netif_stop_queue(ndev);
463 ++ }
464 ++
465 + return NETDEV_TX_OK;
466 + }
467 +
468 +diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
469 +index 470d416f2b86a..078eb110381c2 100644
470 +--- a/drivers/net/hamradio/mkiss.c
471 ++++ b/drivers/net/hamradio/mkiss.c
472 +@@ -810,6 +810,7 @@ static void mkiss_close(struct tty_struct *tty)
473 + ax->tty = NULL;
474 +
475 + unregister_netdev(ax->dev);
476 ++ free_netdev(ax->dev);
477 + }
478 +
479 + /* Perform I/O control on an active ax25 channel. */
480 +diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
481 +index f7180f8db39e1..9c15e1a1261be 100644
482 +--- a/drivers/net/usb/cdc_eem.c
483 ++++ b/drivers/net/usb/cdc_eem.c
484 +@@ -138,10 +138,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
485 + }
486 +
487 + skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
488 ++ dev_kfree_skb_any(skb);
489 + if (!skb2)
490 + return NULL;
491 +
492 +- dev_kfree_skb_any(skb);
493 + skb = skb2;
494 +
495 + done:
496 +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
497 +index 8de7797ea7e71..8bef8c3dd2a3e 100644
498 +--- a/drivers/net/usb/cdc_ncm.c
499 ++++ b/drivers/net/usb/cdc_ncm.c
500 +@@ -1580,7 +1580,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
501 + static const struct driver_info cdc_ncm_info = {
502 + .description = "CDC NCM",
503 + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
504 +- | FLAG_LINK_INTR,
505 ++ | FLAG_LINK_INTR | FLAG_ETHER,
506 + .bind = cdc_ncm_bind,
507 + .unbind = cdc_ncm_unbind,
508 + .manage_power = usbnet_manage_power,
509 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
510 +index 27e9c089b2fc2..5baaa82916243 100644
511 +--- a/drivers/net/usb/r8152.c
512 ++++ b/drivers/net/usb/r8152.c
513 +@@ -3820,7 +3820,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data)
514 + {
515 + switch (stringset) {
516 + case ETH_SS_STATS:
517 +- memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings));
518 ++ memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings));
519 + break;
520 + }
521 + }
522 +diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
523 +index 850bb147f4b08..9fe6a8d899b00 100644
524 +--- a/drivers/net/usb/smsc75xx.c
525 ++++ b/drivers/net/usb/smsc75xx.c
526 +@@ -1485,7 +1485,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
527 + ret = smsc75xx_wait_ready(dev, 0);
528 + if (ret < 0) {
529 + netdev_warn(dev->net, "device not ready in smsc75xx_bind\n");
530 +- goto err;
531 ++ goto free_pdata;
532 + }
533 +
534 + smsc75xx_init_mac_address(dev);
535 +@@ -1494,7 +1494,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
536 + ret = smsc75xx_reset(dev);
537 + if (ret < 0) {
538 + netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret);
539 +- goto err;
540 ++ goto cancel_work;
541 + }
542 +
543 + dev->net->netdev_ops = &smsc75xx_netdev_ops;
544 +@@ -1504,8 +1504,11 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
545 + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
546 + return 0;
547 +
548 +-err:
549 ++cancel_work:
550 ++ cancel_work_sync(&pdata->set_multicast);
551 ++free_pdata:
552 + kfree(pdata);
553 ++ dev->data[0] = 0;
554 + return ret;
555 + }
556 +
557 +@@ -1516,7 +1519,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)
558 + cancel_work_sync(&pdata->set_multicast);
559 + netif_dbg(dev, ifdown, dev->net, "free pdata\n");
560 + kfree(pdata);
561 +- pdata = NULL;
562 + dev->data[0] = 0;
563 + }
564 + }
565 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
566 +index 22e8172f373d3..b7f65fc54dc2c 100644
567 +--- a/drivers/pci/pci.c
568 ++++ b/drivers/pci/pci.c
569 +@@ -1328,11 +1328,21 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
570 + int err;
571 + int i, bars = 0;
572 +
573 +- if (atomic_inc_return(&dev->enable_cnt) > 1) {
574 +- pci_update_current_state(dev, dev->current_state);
575 +- return 0; /* already enabled */
576 ++ /*
577 ++ * Power state could be unknown at this point, either due to a fresh
578 ++ * boot or a device removal call. So get the current power state
579 ++ * so that things like MSI message writing will behave as expected
580 ++ * (e.g. if the device really is in D0 at enable time).
581 ++ */
582 ++ if (dev->pm_cap) {
583 ++ u16 pmcsr;
584 ++ pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
585 ++ dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
586 + }
587 +
588 ++ if (atomic_inc_return(&dev->enable_cnt) > 1)
589 ++ return 0; /* already enabled */
590 ++
591 + bridge = pci_upstream_bridge(dev);
592 + if (bridge)
593 + pci_enable_bridge(bridge);
594 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
595 +index bc0aa0849e72e..e65eec0644a76 100644
596 +--- a/drivers/pci/quirks.c
597 ++++ b/drivers/pci/quirks.c
598 +@@ -3144,6 +3144,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev)
599 + dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
600 + }
601 +
602 ++/*
603 ++ * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be
604 ++ * prevented for those affected devices.
605 ++ */
606 ++static void quirk_nvidia_no_bus_reset(struct pci_dev *dev)
607 ++{
608 ++ if ((dev->device & 0xffc0) == 0x2340)
609 ++ quirk_no_bus_reset(dev);
610 ++}
611 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
612 ++ quirk_nvidia_no_bus_reset);
613 ++
614 + /*
615 + * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset.
616 + * The device will throw a Link Down error on AER-capable systems and
617 +@@ -3157,6 +3169,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);
618 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
619 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
620 +
621 ++/*
622 ++ * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS
623 ++ * automatically disables LTSSM when Secondary Bus Reset is received and
624 ++ * the device stops working. Prevent bus reset for these devices. With
625 ++ * this change, the device can be assigned to VMs with VFIO, but it will
626 ++ * leak state between VMs. Reference
627 ++ * https://e2e.ti.com/support/processors/f/791/t/954382
628 ++ */
629 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset);
630 ++
631 + static void quirk_no_pm_reset(struct pci_dev *dev)
632 + {
633 + /*
634 +diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
635 +index fb4b6034f6444..6365480300468 100644
636 +--- a/drivers/scsi/hosts.c
637 ++++ b/drivers/scsi/hosts.c
638 +@@ -259,12 +259,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
639 +
640 + device_enable_async_suspend(&shost->shost_dev);
641 +
642 ++ get_device(&shost->shost_gendev);
643 + error = device_add(&shost->shost_dev);
644 + if (error)
645 + goto out_del_gendev;
646 +
647 +- get_device(&shost->shost_gendev);
648 +-
649 + if (shost->transportt->host_size) {
650 + shost->shost_data = kzalloc(shost->transportt->host_size,
651 + GFP_KERNEL);
652 +@@ -300,6 +299,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
653 + out_del_dev:
654 + device_del(&shost->shost_dev);
655 + out_del_gendev:
656 ++ /*
657 ++ * Host state is SHOST_RUNNING so we have to explicitly release
658 ++ * ->shost_dev.
659 ++ */
660 ++ put_device(&shost->shost_dev);
661 + device_del(&shost->shost_gendev);
662 + out_destroy_freelist:
663 + scsi_destroy_command_freelist(shost);
664 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
665 +index 96cf2448a1f4f..6c6aa23ced45f 100644
666 +--- a/drivers/target/target_core_transport.c
667 ++++ b/drivers/target/target_core_transport.c
668 +@@ -2757,9 +2757,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
669 + __releases(&cmd->t_state_lock)
670 + __acquires(&cmd->t_state_lock)
671 + {
672 +-
673 +- assert_spin_locked(&cmd->t_state_lock);
674 +- WARN_ON_ONCE(!irqs_disabled());
675 ++ lockdep_assert_held(&cmd->t_state_lock);
676 +
677 + if (fabric_stop)
678 + cmd->transport_state |= CMD_T_FABRIC_STOP;
679 +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
680 +index 8e8695eb652af..f115ce93dfb42 100644
681 +--- a/fs/gfs2/glock.c
682 ++++ b/fs/gfs2/glock.c
683 +@@ -1342,6 +1342,7 @@ __acquires(&lru_lock)
684 + while(!list_empty(list)) {
685 + gl = list_entry(list->next, struct gfs2_glock, gl_lru);
686 + list_del_init(&gl->gl_lru);
687 ++ clear_bit(GLF_LRU, &gl->gl_flags);
688 + if (!spin_trylock(&gl->gl_lockref.lock)) {
689 + add_back_to_lru:
690 + list_add(&gl->gl_lru, &lru_list);
691 +@@ -1388,7 +1389,6 @@ static long gfs2_scan_glock_lru(int nr)
692 + if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
693 + list_move(&gl->gl_lru, &dispose);
694 + atomic_dec(&lru_count);
695 +- clear_bit(GLF_LRU, &gl->gl_flags);
696 + freed++;
697 + continue;
698 + }
699 +diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
700 +index bbb0dcc35905c..c3b629eec294a 100644
701 +--- a/fs/nilfs2/sysfs.c
702 ++++ b/fs/nilfs2/sysfs.c
703 +@@ -1062,6 +1062,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)
704 + nilfs_sysfs_delete_superblock_group(nilfs);
705 + nilfs_sysfs_delete_segctor_group(nilfs);
706 + kobject_del(&nilfs->ns_dev_kobj);
707 ++ kobject_put(&nilfs->ns_dev_kobj);
708 + kfree(nilfs->ns_dev_subgroups);
709 + }
710 +
711 +diff --git a/include/linux/hid.h b/include/linux/hid.h
712 +index 19c53b64e07a1..6adea5a397245 100644
713 +--- a/include/linux/hid.h
714 ++++ b/include/linux/hid.h
715 +@@ -1119,8 +1119,7 @@ static inline void hid_hw_wait(struct hid_device *hdev)
716 + */
717 + static inline u32 hid_report_len(struct hid_report *report)
718 + {
719 +- /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
720 +- return ((report->size - 1) >> 3) + 1 + (report->id > 0);
721 ++ return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
722 + }
723 +
724 + int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
725 +diff --git a/include/net/sock.h b/include/net/sock.h
726 +index 31198b32d9122..1b657a3a30b51 100644
727 +--- a/include/net/sock.h
728 ++++ b/include/net/sock.h
729 +@@ -1728,7 +1728,8 @@ static inline u32 net_tx_rndhash(void)
730 +
731 + static inline void sk_set_txhash(struct sock *sk)
732 + {
733 +- sk->sk_txhash = net_tx_rndhash();
734 ++ /* This pairs with READ_ONCE() in skb_set_hash_from_sk() */
735 ++ WRITE_ONCE(sk->sk_txhash, net_tx_rndhash());
736 + }
737 +
738 + static inline void sk_rethink_txhash(struct sock *sk)
739 +@@ -1980,9 +1981,12 @@ static inline void sock_poll_wait(struct file *filp,
740 +
741 + static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
742 + {
743 +- if (sk->sk_txhash) {
744 ++ /* This pairs with WRITE_ONCE() in sk_set_txhash() */
745 ++ u32 txhash = READ_ONCE(sk->sk_txhash);
746 ++
747 ++ if (txhash) {
748 + skb->l4_hash = 1;
749 +- skb->hash = sk->sk_txhash;
750 ++ skb->hash = txhash;
751 + }
752 + }
753 +
754 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
755 +index 9483bd5272475..bc8b1fdbf1bb7 100644
756 +--- a/kernel/trace/trace.c
757 ++++ b/kernel/trace/trace.c
758 +@@ -1369,9 +1369,6 @@ struct saved_cmdlines_buffer {
759 + };
760 + static struct saved_cmdlines_buffer *savedcmd;
761 +
762 +-/* temporary disable recording */
763 +-static atomic_t trace_record_cmdline_disabled __read_mostly;
764 +-
765 + static inline char *get_saved_cmdlines(int idx)
766 + {
767 + return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
768 +@@ -1635,9 +1632,6 @@ void trace_find_cmdline(int pid, char comm[])
769 +
770 + void tracing_record_cmdline(struct task_struct *tsk)
771 + {
772 +- if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
773 +- return;
774 +-
775 + if (!__this_cpu_read(trace_cmdline_save))
776 + return;
777 +
778 +@@ -2500,9 +2494,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
779 + return ERR_PTR(-EBUSY);
780 + #endif
781 +
782 +- if (!iter->snapshot)
783 +- atomic_inc(&trace_record_cmdline_disabled);
784 +-
785 + if (*pos != iter->pos) {
786 + iter->ent = NULL;
787 + iter->cpu = 0;
788 +@@ -2545,9 +2536,6 @@ static void s_stop(struct seq_file *m, void *p)
789 + return;
790 + #endif
791 +
792 +- if (!iter->snapshot)
793 +- atomic_dec(&trace_record_cmdline_disabled);
794 +-
795 + trace_access_unlock(iter->cpu_file);
796 + trace_event_read_unlock();
797 + }
798 +diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
799 +index b67ea5eed2a89..b70233a9563f8 100644
800 +--- a/kernel/trace/trace_clock.c
801 ++++ b/kernel/trace/trace_clock.c
802 +@@ -113,9 +113,9 @@ u64 notrace trace_clock_global(void)
803 + prev_time = READ_ONCE(trace_clock_struct.prev_time);
804 + now = sched_clock_cpu(this_cpu);
805 +
806 +- /* Make sure that now is always greater than prev_time */
807 ++ /* Make sure that now is always greater than or equal to prev_time */
808 + if ((s64)(now - prev_time) < 0)
809 +- now = prev_time + 1;
810 ++ now = prev_time;
811 +
812 + /*
813 + * If in an NMI context then dont risk lockups and simply return
814 +@@ -129,7 +129,7 @@ u64 notrace trace_clock_global(void)
815 + /* Reread prev_time in case it was already updated */
816 + prev_time = READ_ONCE(trace_clock_struct.prev_time);
817 + if ((s64)(now - prev_time) < 0)
818 +- now = prev_time + 1;
819 ++ now = prev_time;
820 +
821 + trace_clock_struct.prev_time = now;
822 +
823 +diff --git a/net/can/bcm.c b/net/can/bcm.c
824 +index 1f15622d3c657..c6fee58baac4c 100644
825 +--- a/net/can/bcm.c
826 ++++ b/net/can/bcm.c
827 +@@ -121,7 +121,7 @@ struct bcm_sock {
828 + struct sock sk;
829 + int bound;
830 + int ifindex;
831 +- struct notifier_block notifier;
832 ++ struct list_head notifier;
833 + struct list_head rx_ops;
834 + struct list_head tx_ops;
835 + unsigned long dropped_usr_msgs;
836 +@@ -129,6 +129,10 @@ struct bcm_sock {
837 + char procname [32]; /* inode number in decimal with \0 */
838 + };
839 +
840 ++static LIST_HEAD(bcm_notifier_list);
841 ++static DEFINE_SPINLOCK(bcm_notifier_lock);
842 ++static struct bcm_sock *bcm_busy_notifier;
843 ++
844 + static inline struct bcm_sock *bcm_sk(const struct sock *sk)
845 + {
846 + return (struct bcm_sock *)sk;
847 +@@ -392,6 +396,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
848 + if (!op->count && (op->flags & TX_COUNTEVT)) {
849 +
850 + /* create notification to user */
851 ++ memset(&msg_head, 0, sizeof(msg_head));
852 + msg_head.opcode = TX_EXPIRED;
853 + msg_head.flags = op->flags;
854 + msg_head.count = op->count;
855 +@@ -439,6 +444,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data)
856 + /* this element is not throttled anymore */
857 + data->can_dlc &= (BCM_CAN_DLC_MASK|RX_RECV);
858 +
859 ++ memset(&head, 0, sizeof(head));
860 + head.opcode = RX_CHANGED;
861 + head.flags = op->flags;
862 + head.count = op->count;
863 +@@ -550,6 +556,7 @@ static void bcm_rx_timeout_tsklet(unsigned long data)
864 + struct bcm_msg_head msg_head;
865 +
866 + /* create notification to user */
867 ++ memset(&msg_head, 0, sizeof(msg_head));
868 + msg_head.opcode = RX_TIMEOUT;
869 + msg_head.flags = op->flags;
870 + msg_head.count = op->count;
871 +@@ -1385,20 +1392,15 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
872 + /*
873 + * notification handler for netdevice status changes
874 + */
875 +-static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
876 +- void *ptr)
877 ++static void bcm_notify(struct bcm_sock *bo, unsigned long msg,
878 ++ struct net_device *dev)
879 + {
880 +- struct net_device *dev = netdev_notifier_info_to_dev(ptr);
881 +- struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier);
882 + struct sock *sk = &bo->sk;
883 + struct bcm_op *op;
884 + int notify_enodev = 0;
885 +
886 + if (!net_eq(dev_net(dev), &init_net))
887 +- return NOTIFY_DONE;
888 +-
889 +- if (dev->type != ARPHRD_CAN)
890 +- return NOTIFY_DONE;
891 ++ return;
892 +
893 + switch (msg) {
894 +
895 +@@ -1433,7 +1435,28 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
896 + sk->sk_error_report(sk);
897 + }
898 + }
899 ++}
900 +
901 ++static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
902 ++ void *ptr)
903 ++{
904 ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
905 ++
906 ++ if (dev->type != ARPHRD_CAN)
907 ++ return NOTIFY_DONE;
908 ++ if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
909 ++ return NOTIFY_DONE;
910 ++ if (unlikely(bcm_busy_notifier)) /* Check for reentrant bug. */
911 ++ return NOTIFY_DONE;
912 ++
913 ++ spin_lock(&bcm_notifier_lock);
914 ++ list_for_each_entry(bcm_busy_notifier, &bcm_notifier_list, notifier) {
915 ++ spin_unlock(&bcm_notifier_lock);
916 ++ bcm_notify(bcm_busy_notifier, msg, dev);
917 ++ spin_lock(&bcm_notifier_lock);
918 ++ }
919 ++ bcm_busy_notifier = NULL;
920 ++ spin_unlock(&bcm_notifier_lock);
921 + return NOTIFY_DONE;
922 + }
923 +
924 +@@ -1453,9 +1476,9 @@ static int bcm_init(struct sock *sk)
925 + INIT_LIST_HEAD(&bo->rx_ops);
926 +
927 + /* set notifier */
928 +- bo->notifier.notifier_call = bcm_notifier;
929 +-
930 +- register_netdevice_notifier(&bo->notifier);
931 ++ spin_lock(&bcm_notifier_lock);
932 ++ list_add_tail(&bo->notifier, &bcm_notifier_list);
933 ++ spin_unlock(&bcm_notifier_lock);
934 +
935 + return 0;
936 + }
937 +@@ -1476,7 +1499,14 @@ static int bcm_release(struct socket *sock)
938 +
939 + /* remove bcm_ops, timer, rx_unregister(), etc. */
940 +
941 +- unregister_netdevice_notifier(&bo->notifier);
942 ++ spin_lock(&bcm_notifier_lock);
943 ++ while (bcm_busy_notifier == bo) {
944 ++ spin_unlock(&bcm_notifier_lock);
945 ++ schedule_timeout_uninterruptible(1);
946 ++ spin_lock(&bcm_notifier_lock);
947 ++ }
948 ++ list_del(&bo->notifier);
949 ++ spin_unlock(&bcm_notifier_lock);
950 +
951 + lock_sock(sk);
952 +
953 +@@ -1662,6 +1692,10 @@ static const struct can_proto bcm_can_proto = {
954 + .prot = &bcm_proto,
955 + };
956 +
957 ++static struct notifier_block canbcm_notifier = {
958 ++ .notifier_call = bcm_notifier
959 ++};
960 ++
961 + static int __init bcm_module_init(void)
962 + {
963 + int err;
964 +@@ -1676,6 +1710,8 @@ static int __init bcm_module_init(void)
965 +
966 + /* create /proc/net/can-bcm directory */
967 + proc_dir = proc_mkdir("can-bcm", init_net.proc_net);
968 ++ register_netdevice_notifier(&canbcm_notifier);
969 ++
970 + return 0;
971 + }
972 +
973 +@@ -1685,6 +1721,8 @@ static void __exit bcm_module_exit(void)
974 +
975 + if (proc_dir)
976 + remove_proc_entry("can-bcm", init_net.proc_net);
977 ++
978 ++ unregister_netdevice_notifier(&canbcm_notifier);
979 + }
980 +
981 + module_init(bcm_module_init);
982 +diff --git a/net/can/raw.c b/net/can/raw.c
983 +index e9403a26a1d54..2e1d850a7f2a0 100644
984 +--- a/net/can/raw.c
985 ++++ b/net/can/raw.c
986 +@@ -84,7 +84,7 @@ struct raw_sock {
987 + struct sock sk;
988 + int bound;
989 + int ifindex;
990 +- struct notifier_block notifier;
991 ++ struct list_head notifier;
992 + int loopback;
993 + int recv_own_msgs;
994 + int fd_frames;
995 +@@ -96,6 +96,10 @@ struct raw_sock {
996 + struct uniqframe __percpu *uniq;
997 + };
998 +
999 ++static LIST_HEAD(raw_notifier_list);
1000 ++static DEFINE_SPINLOCK(raw_notifier_lock);
1001 ++static struct raw_sock *raw_busy_notifier;
1002 ++
1003 + /*
1004 + * Return pointer to store the extra msg flags for raw_recvmsg().
1005 + * We use the space of one unsigned int beyond the 'struct sockaddr_can'
1006 +@@ -260,21 +264,16 @@ static int raw_enable_allfilters(struct net_device *dev, struct sock *sk)
1007 + return err;
1008 + }
1009 +
1010 +-static int raw_notifier(struct notifier_block *nb,
1011 +- unsigned long msg, void *ptr)
1012 ++static void raw_notify(struct raw_sock *ro, unsigned long msg,
1013 ++ struct net_device *dev)
1014 + {
1015 +- struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1016 +- struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
1017 + struct sock *sk = &ro->sk;
1018 +
1019 + if (!net_eq(dev_net(dev), &init_net))
1020 +- return NOTIFY_DONE;
1021 +-
1022 +- if (dev->type != ARPHRD_CAN)
1023 +- return NOTIFY_DONE;
1024 ++ return;
1025 +
1026 + if (ro->ifindex != dev->ifindex)
1027 +- return NOTIFY_DONE;
1028 ++ return;
1029 +
1030 + switch (msg) {
1031 +
1032 +@@ -303,7 +302,28 @@ static int raw_notifier(struct notifier_block *nb,
1033 + sk->sk_error_report(sk);
1034 + break;
1035 + }
1036 ++}
1037 ++
1038 ++static int raw_notifier(struct notifier_block *nb, unsigned long msg,
1039 ++ void *ptr)
1040 ++{
1041 ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1042 ++
1043 ++ if (dev->type != ARPHRD_CAN)
1044 ++ return NOTIFY_DONE;
1045 ++ if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
1046 ++ return NOTIFY_DONE;
1047 ++ if (unlikely(raw_busy_notifier)) /* Check for reentrant bug. */
1048 ++ return NOTIFY_DONE;
1049 +
1050 ++ spin_lock(&raw_notifier_lock);
1051 ++ list_for_each_entry(raw_busy_notifier, &raw_notifier_list, notifier) {
1052 ++ spin_unlock(&raw_notifier_lock);
1053 ++ raw_notify(raw_busy_notifier, msg, dev);
1054 ++ spin_lock(&raw_notifier_lock);
1055 ++ }
1056 ++ raw_busy_notifier = NULL;
1057 ++ spin_unlock(&raw_notifier_lock);
1058 + return NOTIFY_DONE;
1059 + }
1060 +
1061 +@@ -332,9 +352,9 @@ static int raw_init(struct sock *sk)
1062 + return -ENOMEM;
1063 +
1064 + /* set notifier */
1065 +- ro->notifier.notifier_call = raw_notifier;
1066 +-
1067 +- register_netdevice_notifier(&ro->notifier);
1068 ++ spin_lock(&raw_notifier_lock);
1069 ++ list_add_tail(&ro->notifier, &raw_notifier_list);
1070 ++ spin_unlock(&raw_notifier_lock);
1071 +
1072 + return 0;
1073 + }
1074 +@@ -349,7 +369,14 @@ static int raw_release(struct socket *sock)
1075 +
1076 + ro = raw_sk(sk);
1077 +
1078 +- unregister_netdevice_notifier(&ro->notifier);
1079 ++ spin_lock(&raw_notifier_lock);
1080 ++ while (raw_busy_notifier == ro) {
1081 ++ spin_unlock(&raw_notifier_lock);
1082 ++ schedule_timeout_uninterruptible(1);
1083 ++ spin_lock(&raw_notifier_lock);
1084 ++ }
1085 ++ list_del(&ro->notifier);
1086 ++ spin_unlock(&raw_notifier_lock);
1087 +
1088 + lock_sock(sk);
1089 +
1090 +@@ -857,6 +884,10 @@ static const struct can_proto raw_can_proto = {
1091 + .prot = &raw_proto,
1092 + };
1093 +
1094 ++static struct notifier_block canraw_notifier = {
1095 ++ .notifier_call = raw_notifier
1096 ++};
1097 ++
1098 + static __init int raw_module_init(void)
1099 + {
1100 + int err;
1101 +@@ -866,6 +897,8 @@ static __init int raw_module_init(void)
1102 + err = can_proto_register(&raw_can_proto);
1103 + if (err < 0)
1104 + printk(KERN_ERR "can: registration of raw protocol failed\n");
1105 ++ else
1106 ++ register_netdevice_notifier(&canraw_notifier);
1107 +
1108 + return err;
1109 + }
1110 +@@ -873,6 +906,7 @@ static __init int raw_module_init(void)
1111 + static __exit void raw_module_exit(void)
1112 + {
1113 + can_proto_unregister(&raw_can_proto);
1114 ++ unregister_netdevice_notifier(&canraw_notifier);
1115 + }
1116 +
1117 + module_init(raw_module_init);
1118 +diff --git a/net/compat.c b/net/compat.c
1119 +index 20c5e5f215f23..14459a87fdbce 100644
1120 +--- a/net/compat.c
1121 ++++ b/net/compat.c
1122 +@@ -159,7 +159,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
1123 + if (kcmlen > stackbuf_size)
1124 + kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
1125 + if (kcmsg == NULL)
1126 +- return -ENOBUFS;
1127 ++ return -ENOMEM;
1128 +
1129 + /* Now copy them over neatly. */
1130 + memset(kcmsg, 0, kcmlen);
1131 +diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
1132 +index 2fd4aae8f2858..b9cbab73d0de5 100644
1133 +--- a/net/core/fib_rules.c
1134 ++++ b/net/core/fib_rules.c
1135 +@@ -695,7 +695,7 @@ static void notify_rule_change(int event, struct fib_rule *rule,
1136 + {
1137 + struct net *net;
1138 + struct sk_buff *skb;
1139 +- int err = -ENOBUFS;
1140 ++ int err = -ENOMEM;
1141 +
1142 + net = ops->fro_net;
1143 + skb = nlmsg_new(fib_rule_nlmsg_size(ops, rule), GFP_KERNEL);
1144 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
1145 +index e2a0aed52983e..7d6fe9ba9a248 100644
1146 +--- a/net/core/rtnetlink.c
1147 ++++ b/net/core/rtnetlink.c
1148 +@@ -3240,6 +3240,10 @@ static int rtnl_bridge_notify(struct net_device *dev)
1149 + if (err < 0)
1150 + goto errout;
1151 +
1152 ++ /* Notification info is only filled for bridge ports, not the bridge
1153 ++ * device itself. Therefore, a zero notification length is valid and
1154 ++ * should not result in an error.
1155 ++ */
1156 + if (!skb->len)
1157 + goto errout;
1158 +
1159 +diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
1160 +index 0e83c5b08e0e3..e798e27b3c7d3 100644
1161 +--- a/net/ipv4/cipso_ipv4.c
1162 ++++ b/net/ipv4/cipso_ipv4.c
1163 +@@ -557,6 +557,7 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
1164 + kfree(doi_def->map.std->lvl.local);
1165 + kfree(doi_def->map.std->cat.cipso);
1166 + kfree(doi_def->map.std->cat.local);
1167 ++ kfree(doi_def->map.std);
1168 + break;
1169 + }
1170 + kfree(doi_def);
1171 +diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
1172 +index 60f564db25a3d..173777aa5add8 100644
1173 +--- a/net/ipv4/ipconfig.c
1174 ++++ b/net/ipv4/ipconfig.c
1175 +@@ -890,7 +890,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
1176 +
1177 +
1178 + /*
1179 +- * Copy BOOTP-supplied string if not already set.
1180 ++ * Copy BOOTP-supplied string
1181 + */
1182 + static int __init ic_bootp_string(char *dest, char *src, int len, int max)
1183 + {
1184 +@@ -941,12 +941,15 @@ static void __init ic_do_bootp_ext(u8 *ext)
1185 + }
1186 + break;
1187 + case 12: /* Host name */
1188 +- ic_bootp_string(utsname()->nodename, ext+1, *ext,
1189 +- __NEW_UTS_LEN);
1190 +- ic_host_name_set = 1;
1191 ++ if (!ic_host_name_set) {
1192 ++ ic_bootp_string(utsname()->nodename, ext+1, *ext,
1193 ++ __NEW_UTS_LEN);
1194 ++ ic_host_name_set = 1;
1195 ++ }
1196 + break;
1197 + case 15: /* Domain name (DNS) */
1198 +- ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
1199 ++ if (!ic_domain[0])
1200 ++ ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
1201 + break;
1202 + case 17: /* Root path */
1203 + if (!root_server_path[0])
1204 +diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
1205 +index a3abd136b8e71..56d89dfd8831b 100644
1206 +--- a/net/ipv4/ping.c
1207 ++++ b/net/ipv4/ping.c
1208 +@@ -978,6 +978,7 @@ bool ping_rcv(struct sk_buff *skb)
1209 + struct sock *sk;
1210 + struct net *net = dev_net(skb->dev);
1211 + struct icmphdr *icmph = icmp_hdr(skb);
1212 ++ bool rc = false;
1213 +
1214 + /* We assume the packet has already been checked by icmp_rcv */
1215 +
1216 +@@ -992,14 +993,15 @@ bool ping_rcv(struct sk_buff *skb)
1217 + struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
1218 +
1219 + pr_debug("rcv on socket %p\n", sk);
1220 +- if (skb2)
1221 +- ping_queue_rcv_skb(sk, skb2);
1222 ++ if (skb2 && !ping_queue_rcv_skb(sk, skb2))
1223 ++ rc = true;
1224 + sock_put(sk);
1225 +- return true;
1226 + }
1227 +- pr_debug("no socket, dropping\n");
1228 +
1229 +- return false;
1230 ++ if (!rc)
1231 ++ pr_debug("no socket, dropping\n");
1232 ++
1233 ++ return rc;
1234 + }
1235 + EXPORT_SYMBOL_GPL(ping_rcv);
1236 +
1237 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
1238 +index ea1c319100a5d..2ab2289d97a09 100644
1239 +--- a/net/ipv4/route.c
1240 ++++ b/net/ipv4/route.c
1241 +@@ -70,6 +70,7 @@
1242 + #include <linux/types.h>
1243 + #include <linux/kernel.h>
1244 + #include <linux/mm.h>
1245 ++#include <linux/bootmem.h>
1246 + #include <linux/string.h>
1247 + #include <linux/socket.h>
1248 + #include <linux/sockios.h>
1249 +@@ -463,8 +464,10 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
1250 + return neigh_create(&arp_tbl, pkey, dev);
1251 + }
1252 +
1253 +-#define IP_IDENTS_SZ 2048u
1254 +-
1255 ++/* Hash tables of size 2048..262144 depending on RAM size.
1256 ++ * Each bucket uses 8 bytes.
1257 ++ */
1258 ++static u32 ip_idents_mask __read_mostly;
1259 + static atomic_t *ip_idents __read_mostly;
1260 + static u32 *ip_tstamps __read_mostly;
1261 +
1262 +@@ -474,12 +477,16 @@ static u32 *ip_tstamps __read_mostly;
1263 + */
1264 + u32 ip_idents_reserve(u32 hash, int segs)
1265 + {
1266 +- u32 *p_tstamp = ip_tstamps + hash % IP_IDENTS_SZ;
1267 +- atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
1268 +- u32 old = ACCESS_ONCE(*p_tstamp);
1269 +- u32 now = (u32)jiffies;
1270 ++ u32 bucket, old, now = (u32)jiffies;
1271 ++ atomic_t *p_id;
1272 ++ u32 *p_tstamp;
1273 + u32 delta = 0;
1274 +
1275 ++ bucket = hash & ip_idents_mask;
1276 ++ p_tstamp = ip_tstamps + bucket;
1277 ++ p_id = ip_idents + bucket;
1278 ++ old = ACCESS_ONCE(*p_tstamp);
1279 ++
1280 + if (old != now && cmpxchg(p_tstamp, old, now) == old)
1281 + delta = prandom_u32_max(now - old);
1282 +
1283 +@@ -2936,18 +2943,27 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
1284 +
1285 + int __init ip_rt_init(void)
1286 + {
1287 ++ void *idents_hash;
1288 + int rc = 0;
1289 + int cpu;
1290 +
1291 +- ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL);
1292 +- if (!ip_idents)
1293 +- panic("IP: failed to allocate ip_idents\n");
1294 ++ /* For modern hosts, this will use 2 MB of memory */
1295 ++ idents_hash = alloc_large_system_hash("IP idents",
1296 ++ sizeof(*ip_idents) + sizeof(*ip_tstamps),
1297 ++ 0,
1298 ++ 16, /* one bucket per 64 KB */
1299 ++ 0,
1300 ++ NULL,
1301 ++ &ip_idents_mask,
1302 ++ 2048,
1303 ++ 256*1024);
1304 ++
1305 ++ ip_idents = idents_hash;
1306 +
1307 +- prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
1308 ++ prandom_bytes(ip_idents, (ip_idents_mask + 1) * sizeof(*ip_idents));
1309 +
1310 +- ip_tstamps = kcalloc(IP_IDENTS_SZ, sizeof(*ip_tstamps), GFP_KERNEL);
1311 +- if (!ip_tstamps)
1312 +- panic("IP: failed to allocate ip_tstamps\n");
1313 ++ ip_tstamps = idents_hash + (ip_idents_mask + 1) * sizeof(*ip_idents);
1314 ++ memset(ip_tstamps, 0, (ip_idents_mask + 1) * sizeof(*ip_tstamps));
1315 +
1316 + for_each_possible_cpu(cpu) {
1317 + struct uncached_list *ul = &per_cpu(rt_uncached_list, cpu);
1318 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
1319 +index ae0fba044cd0a..bde924968cd23 100644
1320 +--- a/net/mac80211/rx.c
1321 ++++ b/net/mac80211/rx.c
1322 +@@ -1853,17 +1853,15 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1323 + sc = le16_to_cpu(hdr->seq_ctrl);
1324 + frag = sc & IEEE80211_SCTL_FRAG;
1325 +
1326 +- if (is_multicast_ether_addr(hdr->addr1)) {
1327 +- I802_DEBUG_INC(rx->local->dot11MulticastReceivedFrameCount);
1328 +- goto out_no_led;
1329 +- }
1330 +-
1331 + if (rx->sta)
1332 + cache = &rx->sta->frags;
1333 +
1334 + if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1335 + goto out;
1336 +
1337 ++ if (is_multicast_ether_addr(hdr->addr1))
1338 ++ return RX_DROP_MONITOR;
1339 ++
1340 + I802_DEBUG_INC(rx->local->rx_handlers_fragments);
1341 +
1342 + if (skb_linearize(rx->skb))
1343 +@@ -1992,7 +1990,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1344 +
1345 + out:
1346 + ieee80211_led_rx(rx->local);
1347 +- out_no_led:
1348 + if (rx->sta)
1349 + rx->sta->rx_stats.packets++;
1350 + return RX_CONTINUE;
1351 +diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c
1352 +index c8a4a48bced98..8be604eb69616 100644
1353 +--- a/net/netfilter/nf_synproxy_core.c
1354 ++++ b/net/netfilter/nf_synproxy_core.c
1355 +@@ -34,6 +34,9 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
1356 + int length = (th->doff * 4) - sizeof(*th);
1357 + u8 buf[40], *ptr;
1358 +
1359 ++ if (unlikely(length < 0))
1360 ++ return false;
1361 ++
1362 + ptr = skb_header_pointer(skb, doff + sizeof(*th), length, buf);
1363 + if (ptr == NULL)
1364 + return false;
1365 +@@ -50,6 +53,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
1366 + length--;
1367 + continue;
1368 + default:
1369 ++ if (length < 2)
1370 ++ return true;
1371 + opsize = *ptr++;
1372 + if (opsize < 2)
1373 + return true;
1374 +diff --git a/net/rds/recv.c b/net/rds/recv.c
1375 +index 9bf812509e0e9..1ff4bc3237f01 100644
1376 +--- a/net/rds/recv.c
1377 ++++ b/net/rds/recv.c
1378 +@@ -482,7 +482,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
1379 +
1380 + if (rds_cmsg_recv(inc, msg)) {
1381 + ret = -EFAULT;
1382 +- goto out;
1383 ++ break;
1384 + }
1385 +
1386 + rds_stats_inc(s_recv_delivered);
1387 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
1388 +index ac78c5ac82846..33948cc03ba63 100644
1389 +--- a/net/unix/af_unix.c
1390 ++++ b/net/unix/af_unix.c
1391 +@@ -534,12 +534,14 @@ static void unix_release_sock(struct sock *sk, int embrion)
1392 + u->path.mnt = NULL;
1393 + state = sk->sk_state;
1394 + sk->sk_state = TCP_CLOSE;
1395 ++
1396 ++ skpair = unix_peer(sk);
1397 ++ unix_peer(sk) = NULL;
1398 ++
1399 + unix_state_unlock(sk);
1400 +
1401 + wake_up_interruptible_all(&u->peer_wait);
1402 +
1403 +- skpair = unix_peer(sk);
1404 +-
1405 + if (skpair != NULL) {
1406 + if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
1407 + unix_state_lock(skpair);
1408 +@@ -554,7 +556,6 @@ static void unix_release_sock(struct sock *sk, int embrion)
1409 +
1410 + unix_dgram_peer_wake_disconnect(sk, skpair);
1411 + sock_put(skpair); /* It may now die */
1412 +- unix_peer(sk) = NULL;
1413 + }
1414 +
1415 + /* Try to flush out this socket. Throw out buffers at least */
1416 +diff --git a/net/wireless/util.c b/net/wireless/util.c
1417 +index 915f1fa881e48..73c361fd4a16f 100644
1418 +--- a/net/wireless/util.c
1419 ++++ b/net/wireless/util.c
1420 +@@ -978,6 +978,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
1421 + case NL80211_IFTYPE_MESH_POINT:
1422 + /* mesh should be handled? */
1423 + break;
1424 ++ case NL80211_IFTYPE_OCB:
1425 ++ cfg80211_leave_ocb(rdev, dev);
1426 ++ break;
1427 + default:
1428 + break;
1429 + }
1430 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
1431 +index a9fd95d10e84a..156639be7ed00 100644
1432 +--- a/net/x25/af_x25.c
1433 ++++ b/net/x25/af_x25.c
1434 +@@ -550,7 +550,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
1435 + if (protocol)
1436 + goto out;
1437 +
1438 +- rc = -ENOBUFS;
1439 ++ rc = -ENOMEM;
1440 + if ((sk = x25_alloc_socket(net, kern)) == NULL)
1441 + goto out;
1442 +