Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 28 Feb 2018 15:05:39
Message-Id: 1519830333.01696b90f5bf17cb52dd5fb7e4cd8d91f96278d4.alicef@gentoo
1 commit: 01696b90f5bf17cb52dd5fb7e4cd8d91f96278d4
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 28 15:05:33 2018 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 28 15:05:33 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=01696b90
7
8 linux kernel 4.4.119
9
10 0000_README | 4 +
11 1118_linux-4.4.119.patch | 696 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 700 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 94125fa..e349b72 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -515,6 +515,10 @@ Patch: 1117_linux-4.4.118.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.118
21
22 +Patch: 1118_linux-4.4.119.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.119
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1118_linux-4.4.119.patch b/1118_linux-4.4.119.patch
31 new file mode 100644
32 index 0000000..05db226
33 --- /dev/null
34 +++ b/1118_linux-4.4.119.patch
35 @@ -0,0 +1,696 @@
36 +diff --git a/Makefile b/Makefile
37 +index 1e01148744f3..87f925192c77 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 4
43 +-SUBLEVEL = 118
44 ++SUBLEVEL = 119
45 + EXTRAVERSION =
46 + NAME = Blurry Fish Butt
47 +
48 +diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
49 +index 9119722eb347..5d270ca76aec 100644
50 +--- a/arch/arm64/kernel/traps.c
51 ++++ b/arch/arm64/kernel/traps.c
52 +@@ -49,7 +49,7 @@ static const char *handler[]= {
53 + "Error"
54 + };
55 +
56 +-int show_unhandled_signals = 1;
57 ++int show_unhandled_signals = 0;
58 +
59 + /*
60 + * Dump out the contents of some memory nicely...
61 +diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
62 +index df4a87eb8da4..9eb469bed22b 100644
63 +--- a/arch/powerpc/kernel/setup_64.c
64 ++++ b/arch/powerpc/kernel/setup_64.c
65 +@@ -835,6 +835,7 @@ static int __init disable_hardlockup_detector(void)
66 + return 0;
67 + }
68 + early_initcall(disable_hardlockup_detector);
69 ++#endif
70 +
71 + #ifdef CONFIG_PPC_BOOK3S_64
72 + static enum l1d_flush_type enabled_flush_types;
73 +@@ -973,4 +974,3 @@ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, cha
74 + return sprintf(buf, "Vulnerable\n");
75 + }
76 + #endif /* CONFIG_PPC_BOOK3S_64 */
77 +-#endif
78 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
79 +index 1d2e6392f5fa..f24bd7249536 100644
80 +--- a/arch/x86/oprofile/nmi_int.c
81 ++++ b/arch/x86/oprofile/nmi_int.c
82 +@@ -471,7 +471,7 @@ static int nmi_setup(void)
83 + goto fail;
84 +
85 + for_each_possible_cpu(cpu) {
86 +- if (!cpu)
87 ++ if (!IS_ENABLED(CONFIG_SMP) || !cpu)
88 + continue;
89 +
90 + memcpy(per_cpu(cpu_msrs, cpu).counters,
91 +diff --git a/drivers/android/binder.c b/drivers/android/binder.c
92 +index 55613f6f7c0e..260ce0e60187 100644
93 +--- a/drivers/android/binder.c
94 ++++ b/drivers/android/binder.c
95 +@@ -2622,8 +2622,10 @@ static unsigned int binder_poll(struct file *filp,
96 + binder_lock(__func__);
97 +
98 + thread = binder_get_thread(proc);
99 +- if (!thread)
100 ++ if (!thread) {
101 ++ binder_unlock(__func__);
102 + return POLLERR;
103 ++ }
104 +
105 + wait_for_proc_work = thread->transaction_stack == NULL &&
106 + list_empty(&thread->todo) && thread->return_error == BR_OK;
107 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
108 +index fc9f14747f70..a36230d1331c 100644
109 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
110 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
111 +@@ -1467,8 +1467,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
112 + * ignore it */
113 + vga_client_register(adev->pdev, adev, NULL, amdgpu_vga_set_decode);
114 +
115 +- if (amdgpu_runtime_pm == 1)
116 +- runtime = true;
117 + if (amdgpu_device_is_px(ddev))
118 + runtime = true;
119 + vga_switcheroo_register_client(adev->pdev, &amdgpu_switcheroo_ops, runtime);
120 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
121 +index c0106fd9fae9..c641ed9470e1 100644
122 +--- a/drivers/gpu/drm/drm_edid.c
123 ++++ b/drivers/gpu/drm/drm_edid.c
124 +@@ -106,6 +106,9 @@ static struct edid_quirk {
125 + /* AEO model 0 reports 8 bpc, but is a 6 bpc panel */
126 + { "AEO", 0, EDID_QUIRK_FORCE_6BPC },
127 +
128 ++ /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */
129 ++ { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC },
130 ++
131 + /* Belinea 10 15 55 */
132 + { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },
133 + { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
134 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
135 +index 6861b74e2b61..d07fb967f92b 100644
136 +--- a/drivers/hid/hid-core.c
137 ++++ b/drivers/hid/hid-core.c
138 +@@ -2386,6 +2386,9 @@ static const struct hid_device_id hid_ignore_list[] = {
139 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
140 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
141 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
142 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
143 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
144 ++ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
145 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
146 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
147 + { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
148 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
149 +index b554d17c9156..b316ab7e8996 100644
150 +--- a/drivers/hid/hid-ids.h
151 ++++ b/drivers/hid/hid-ids.h
152 +@@ -570,6 +570,9 @@
153 + #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033
154 + #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035
155 + #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038
156 ++#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040
157 ++#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042
158 ++#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043
159 + #define USB_DEVICE_ID_LD_JWM 0x1080
160 + #define USB_DEVICE_ID_LD_DMMP 0x1081
161 + #define USB_DEVICE_ID_LD_UMIP 0x1090
162 +diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
163 +index f53e9a803a0e..93b99bd93738 100644
164 +--- a/drivers/iio/imu/adis_trigger.c
165 ++++ b/drivers/iio/imu/adis_trigger.c
166 +@@ -47,6 +47,10 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
167 + if (adis->trig == NULL)
168 + return -ENOMEM;
169 +
170 ++ adis->trig->dev.parent = &adis->spi->dev;
171 ++ adis->trig->ops = &adis_trigger_ops;
172 ++ iio_trigger_set_drvdata(adis->trig, adis);
173 ++
174 + ret = request_irq(adis->spi->irq,
175 + &iio_trigger_generic_data_rdy_poll,
176 + IRQF_TRIGGER_RISING,
177 +@@ -55,9 +59,6 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
178 + if (ret)
179 + goto error_free_trig;
180 +
181 +- adis->trig->dev.parent = &adis->spi->dev;
182 +- adis->trig->ops = &adis_trigger_ops;
183 +- iio_trigger_set_drvdata(adis->trig, adis);
184 + ret = iio_trigger_register(adis->trig);
185 +
186 + indio_dev->trig = iio_trigger_get(adis->trig);
187 +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
188 +index 32bb036069eb..961afb5588be 100644
189 +--- a/drivers/iio/industrialio-buffer.c
190 ++++ b/drivers/iio/industrialio-buffer.c
191 +@@ -174,7 +174,7 @@ unsigned int iio_buffer_poll(struct file *filp,
192 + struct iio_dev *indio_dev = filp->private_data;
193 + struct iio_buffer *rb = indio_dev->buffer;
194 +
195 +- if (!indio_dev->info)
196 ++ if (!indio_dev->info || rb == NULL)
197 + return 0;
198 +
199 + poll_wait(filp, &rb->pollq, wait);
200 +diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
201 +index 5a1490b046ac..3f1c4dea8866 100644
202 +--- a/drivers/irqchip/irq-gic-v3.c
203 ++++ b/drivers/irqchip/irq-gic-v3.c
204 +@@ -604,7 +604,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
205 + * Ensure that stores to Normal memory are visible to the
206 + * other CPUs before issuing the IPI.
207 + */
208 +- smp_wmb();
209 ++ wmb();
210 +
211 + for_each_cpu(cpu, mask) {
212 + unsigned long cluster_id = cpu_logical_map(cpu) & ~0xffUL;
213 +diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
214 +index 0aa81bd3de12..fb682e8af74d 100644
215 +--- a/drivers/pci/host/pci-keystone.c
216 ++++ b/drivers/pci/host/pci-keystone.c
217 +@@ -179,14 +179,16 @@ static int ks_pcie_get_irq_controller_info(struct keystone_pcie *ks_pcie,
218 + }
219 +
220 + /* interrupt controller is in a child node */
221 +- *np_temp = of_find_node_by_name(np_pcie, controller);
222 ++ *np_temp = of_get_child_by_name(np_pcie, controller);
223 + if (!(*np_temp)) {
224 + dev_err(dev, "Node for %s is absent\n", controller);
225 + goto out;
226 + }
227 + temp = of_irq_count(*np_temp);
228 +- if (!temp)
229 ++ if (!temp) {
230 ++ of_node_put(*np_temp);
231 + goto out;
232 ++ }
233 + if (temp > max_host_irqs)
234 + dev_warn(dev, "Too many %s interrupts defined %u\n",
235 + (legacy ? "legacy" : "MSI"), temp);
236 +@@ -200,6 +202,9 @@ static int ks_pcie_get_irq_controller_info(struct keystone_pcie *ks_pcie,
237 + if (!host_irqs[temp])
238 + break;
239 + }
240 ++
241 ++ of_node_put(*np_temp);
242 ++
243 + if (temp) {
244 + *num_irqs = temp;
245 + ret = 0;
246 +diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
247 +index 8fae03215a85..543c10266984 100644
248 +--- a/drivers/scsi/ibmvscsi/ibmvfc.h
249 ++++ b/drivers/scsi/ibmvscsi/ibmvfc.h
250 +@@ -366,7 +366,7 @@ enum ibmvfc_fcp_rsp_info_codes {
251 + };
252 +
253 + struct ibmvfc_fcp_rsp_info {
254 +- __be16 reserved;
255 ++ u8 reserved[3];
256 + u8 rsp_code;
257 + u8 reserved2[4];
258 + }__attribute__((packed, aligned (2)));
259 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
260 +index c05c4f877750..774c97bb1c08 100644
261 +--- a/drivers/usb/core/quirks.c
262 ++++ b/drivers/usb/core/quirks.c
263 +@@ -225,6 +225,9 @@ static const struct usb_device_id usb_quirk_list[] = {
264 + { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
265 + USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
266 +
267 ++ /* Corsair K70 RGB */
268 ++ { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
269 ++
270 + /* Corsair Strafe RGB */
271 + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
272 +
273 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
274 +index d3bd1afd6302..b6037a0ae829 100644
275 +--- a/drivers/usb/dwc3/gadget.c
276 ++++ b/drivers/usb/dwc3/gadget.c
277 +@@ -2393,6 +2393,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
278 + break;
279 + }
280 +
281 ++ dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket;
282 ++
283 + /* Enable USB2 LPM Capability */
284 +
285 + if ((dwc->revision > DWC3_REVISION_194A)
286 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
287 +index eb298daf49c7..51c2b05b5dd9 100644
288 +--- a/drivers/usb/gadget/function/f_fs.c
289 ++++ b/drivers/usb/gadget/function/f_fs.c
290 +@@ -2756,10 +2756,8 @@ static int _ffs_func_bind(struct usb_configuration *c,
291 + struct ffs_data *ffs = func->ffs;
292 +
293 + const int full = !!func->ffs->fs_descs_count;
294 +- const int high = gadget_is_dualspeed(func->gadget) &&
295 +- func->ffs->hs_descs_count;
296 +- const int super = gadget_is_superspeed(func->gadget) &&
297 +- func->ffs->ss_descs_count;
298 ++ const int high = !!func->ffs->hs_descs_count;
299 ++ const int super = !!func->ffs->ss_descs_count;
300 +
301 + int fs_len, hs_len, ss_len, ret, i;
302 + struct ffs_ep *eps_ptr;
303 +diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
304 +index 641fed609911..24edb7674710 100644
305 +--- a/drivers/usb/host/ohci-q.c
306 ++++ b/drivers/usb/host/ohci-q.c
307 +@@ -1018,6 +1018,8 @@ skip_ed:
308 + * have modified this list. normally it's just prepending
309 + * entries (which we'd ignore), but paranoia won't hurt.
310 + */
311 ++ *last = ed->ed_next;
312 ++ ed->ed_next = NULL;
313 + modified = 0;
314 +
315 + /* unlink urbs as requested, but rescan the list after
316 +@@ -1076,21 +1078,22 @@ rescan_this:
317 + goto rescan_this;
318 +
319 + /*
320 +- * If no TDs are queued, take ED off the ed_rm_list.
321 ++ * If no TDs are queued, ED is now idle.
322 + * Otherwise, if the HC is running, reschedule.
323 +- * If not, leave it on the list for further dequeues.
324 ++ * If the HC isn't running, add ED back to the
325 ++ * start of the list for later processing.
326 + */
327 + if (list_empty(&ed->td_list)) {
328 +- *last = ed->ed_next;
329 +- ed->ed_next = NULL;
330 + ed->state = ED_IDLE;
331 + list_del(&ed->in_use_list);
332 + } else if (ohci->rh_state == OHCI_RH_RUNNING) {
333 +- *last = ed->ed_next;
334 +- ed->ed_next = NULL;
335 + ed_schedule(ohci, ed);
336 + } else {
337 +- last = &ed->ed_next;
338 ++ ed->ed_next = ohci->ed_rm_list;
339 ++ ohci->ed_rm_list = ed;
340 ++ /* Don't loop on the same ED */
341 ++ if (last == &ohci->ed_rm_list)
342 ++ last = &ed->ed_next;
343 + }
344 +
345 + if (modified)
346 +diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
347 +index cce22ff1c2eb..e9113238d9e3 100644
348 +--- a/drivers/usb/misc/ldusb.c
349 ++++ b/drivers/usb/misc/ldusb.c
350 +@@ -46,6 +46,9 @@
351 + #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 /* USB Product ID of Micro-CASSY Time (reserved) */
352 + #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 /* USB Product ID of Micro-CASSY Temperature */
353 + #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 /* USB Product ID of Micro-CASSY pH */
354 ++#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040 /* USB Product ID of Power Analyser CASSY */
355 ++#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042 /* USB Product ID of Converter Controller CASSY */
356 ++#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043 /* USB Product ID of Machine Test CASSY */
357 + #define USB_DEVICE_ID_LD_JWM 0x1080 /* USB Product ID of Joule and Wattmeter */
358 + #define USB_DEVICE_ID_LD_DMMP 0x1081 /* USB Product ID of Digital Multimeter P (reserved) */
359 + #define USB_DEVICE_ID_LD_UMIP 0x1090 /* USB Product ID of UMI P */
360 +@@ -88,6 +91,9 @@ static const struct usb_device_id ld_usb_table[] = {
361 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },
362 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },
363 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },
364 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },
365 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },
366 ++ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },
367 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },
368 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },
369 + { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
370 +diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
371 +index 8bb9367ada45..6f37966ea54b 100644
372 +--- a/drivers/usb/renesas_usbhs/fifo.c
373 ++++ b/drivers/usb/renesas_usbhs/fifo.c
374 +@@ -999,6 +999,10 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
375 + if ((uintptr_t)pkt->buf & (USBHS_USB_DMAC_XFER_SIZE - 1))
376 + goto usbhsf_pio_prepare_pop;
377 +
378 ++ /* return at this time if the pipe is running */
379 ++ if (usbhs_pipe_is_running(pipe))
380 ++ return 0;
381 ++
382 + usbhs_pipe_config_change_bfre(pipe, 1);
383 +
384 + ret = usbhsf_fifo_select(pipe, fifo, 0);
385 +@@ -1189,6 +1193,7 @@ static int usbhsf_dma_pop_done_with_usb_dmac(struct usbhs_pkt *pkt,
386 + usbhsf_fifo_clear(pipe, fifo);
387 + pkt->actual = usbhs_dma_calc_received_size(pkt, chan, rcv_len);
388 +
389 ++ usbhs_pipe_running(pipe, 0);
390 + usbhsf_dma_stop(pipe, fifo);
391 + usbhsf_dma_unmap(pkt);
392 + usbhsf_fifo_unselect(pipe, pipe->fifo);
393 +diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
394 +index 86a7bdd61d1a..74bc08d82e14 100644
395 +--- a/include/net/ip_tunnels.h
396 ++++ b/include/net/ip_tunnels.h
397 +@@ -13,6 +13,7 @@
398 + #include <net/netns/generic.h>
399 + #include <net/rtnetlink.h>
400 + #include <net/lwtunnel.h>
401 ++#include <net/dst_cache.h>
402 +
403 + #if IS_ENABLED(CONFIG_IPV6)
404 + #include <net/ipv6.h>
405 +@@ -85,11 +86,6 @@ struct ip_tunnel_prl_entry {
406 + struct rcu_head rcu_head;
407 + };
408 +
409 +-struct ip_tunnel_dst {
410 +- struct dst_entry __rcu *dst;
411 +- __be32 saddr;
412 +-};
413 +-
414 + struct metadata_dst;
415 +
416 + struct ip_tunnel {
417 +@@ -108,7 +104,7 @@ struct ip_tunnel {
418 + int tun_hlen; /* Precalculated header length */
419 + int mlink;
420 +
421 +- struct ip_tunnel_dst __percpu *dst_cache;
422 ++ struct dst_cache dst_cache;
423 +
424 + struct ip_tunnel_parm parms;
425 +
426 +@@ -248,7 +244,6 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
427 + int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
428 + struct ip_tunnel_parm *p);
429 + void ip_tunnel_setup(struct net_device *dev, int net_id);
430 +-void ip_tunnel_dst_reset_all(struct ip_tunnel *t);
431 + int ip_tunnel_encap_setup(struct ip_tunnel *t,
432 + struct ip_tunnel_encap *ipencap);
433 +
434 +diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
435 +index 416dfa004cfb..93581bba8643 100644
436 +--- a/net/ipv4/Kconfig
437 ++++ b/net/ipv4/Kconfig
438 +@@ -186,6 +186,7 @@ config NET_IPGRE_DEMUX
439 +
440 + config NET_IP_TUNNEL
441 + tristate
442 ++ select DST_CACHE
443 + default n
444 +
445 + config NET_IPGRE
446 +diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
447 +index 3a819d2cc04b..d35509212013 100644
448 +--- a/net/ipv4/ip_sockglue.c
449 ++++ b/net/ipv4/ip_sockglue.c
450 +@@ -1527,10 +1527,7 @@ int ip_getsockopt(struct sock *sk, int level,
451 + if (get_user(len, optlen))
452 + return -EFAULT;
453 +
454 +- lock_sock(sk);
455 +- err = nf_getsockopt(sk, PF_INET, optname, optval,
456 +- &len);
457 +- release_sock(sk);
458 ++ err = nf_getsockopt(sk, PF_INET, optname, optval, &len);
459 + if (err >= 0)
460 + err = put_user(len, optlen);
461 + return err;
462 +@@ -1562,9 +1559,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
463 + if (get_user(len, optlen))
464 + return -EFAULT;
465 +
466 +- lock_sock(sk);
467 + err = compat_nf_getsockopt(sk, PF_INET, optname, optval, &len);
468 +- release_sock(sk);
469 + if (err >= 0)
470 + err = put_user(len, optlen);
471 + return err;
472 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
473 +index c18245e05d26..80e2d1b0c08c 100644
474 +--- a/net/ipv4/ip_tunnel.c
475 ++++ b/net/ipv4/ip_tunnel.c
476 +@@ -69,61 +69,6 @@ static unsigned int ip_tunnel_hash(__be32 key, __be32 remote)
477 + IP_TNL_HASH_BITS);
478 + }
479 +
480 +-static void __tunnel_dst_set(struct ip_tunnel_dst *idst,
481 +- struct dst_entry *dst, __be32 saddr)
482 +-{
483 +- struct dst_entry *old_dst;
484 +-
485 +- dst_clone(dst);
486 +- old_dst = xchg((__force struct dst_entry **)&idst->dst, dst);
487 +- dst_release(old_dst);
488 +- idst->saddr = saddr;
489 +-}
490 +-
491 +-static noinline void tunnel_dst_set(struct ip_tunnel *t,
492 +- struct dst_entry *dst, __be32 saddr)
493 +-{
494 +- __tunnel_dst_set(raw_cpu_ptr(t->dst_cache), dst, saddr);
495 +-}
496 +-
497 +-static void tunnel_dst_reset(struct ip_tunnel *t)
498 +-{
499 +- tunnel_dst_set(t, NULL, 0);
500 +-}
501 +-
502 +-void ip_tunnel_dst_reset_all(struct ip_tunnel *t)
503 +-{
504 +- int i;
505 +-
506 +- for_each_possible_cpu(i)
507 +- __tunnel_dst_set(per_cpu_ptr(t->dst_cache, i), NULL, 0);
508 +-}
509 +-EXPORT_SYMBOL(ip_tunnel_dst_reset_all);
510 +-
511 +-static struct rtable *tunnel_rtable_get(struct ip_tunnel *t,
512 +- u32 cookie, __be32 *saddr)
513 +-{
514 +- struct ip_tunnel_dst *idst;
515 +- struct dst_entry *dst;
516 +-
517 +- rcu_read_lock();
518 +- idst = raw_cpu_ptr(t->dst_cache);
519 +- dst = rcu_dereference(idst->dst);
520 +- if (dst && !atomic_inc_not_zero(&dst->__refcnt))
521 +- dst = NULL;
522 +- if (dst) {
523 +- if (!dst->obsolete || dst->ops->check(dst, cookie)) {
524 +- *saddr = idst->saddr;
525 +- } else {
526 +- tunnel_dst_reset(t);
527 +- dst_release(dst);
528 +- dst = NULL;
529 +- }
530 +- }
531 +- rcu_read_unlock();
532 +- return (struct rtable *)dst;
533 +-}
534 +-
535 + static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p,
536 + __be16 flags, __be32 key)
537 + {
538 +@@ -382,11 +327,12 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
539 +
540 + if (!IS_ERR(rt)) {
541 + tdev = rt->dst.dev;
542 +- tunnel_dst_set(tunnel, &rt->dst, fl4.saddr);
543 + ip_rt_put(rt);
544 + }
545 + if (dev->type != ARPHRD_ETHER)
546 + dev->flags |= IFF_POINTOPOINT;
547 ++
548 ++ dst_cache_reset(&tunnel->dst_cache);
549 + }
550 +
551 + if (!tdev && tunnel->parms.link)
552 +@@ -733,7 +679,8 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
553 + if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0)
554 + goto tx_error;
555 +
556 +- rt = connected ? tunnel_rtable_get(tunnel, 0, &fl4.saddr) : NULL;
557 ++ rt = connected ? dst_cache_get_ip4(&tunnel->dst_cache, &fl4.saddr) :
558 ++ NULL;
559 +
560 + if (!rt) {
561 + rt = ip_route_output_key(tunnel->net, &fl4);
562 +@@ -743,7 +690,8 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
563 + goto tx_error;
564 + }
565 + if (connected)
566 +- tunnel_dst_set(tunnel, &rt->dst, fl4.saddr);
567 ++ dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
568 ++ fl4.saddr);
569 + }
570 +
571 + if (rt->dst.dev == dev) {
572 +@@ -841,7 +789,7 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn,
573 + if (set_mtu)
574 + dev->mtu = mtu;
575 + }
576 +- ip_tunnel_dst_reset_all(t);
577 ++ dst_cache_reset(&t->dst_cache);
578 + netdev_state_change(dev);
579 + }
580 +
581 +@@ -980,7 +928,7 @@ static void ip_tunnel_dev_free(struct net_device *dev)
582 + struct ip_tunnel *tunnel = netdev_priv(dev);
583 +
584 + gro_cells_destroy(&tunnel->gro_cells);
585 +- free_percpu(tunnel->dst_cache);
586 ++ dst_cache_destroy(&tunnel->dst_cache);
587 + free_percpu(dev->tstats);
588 + free_netdev(dev);
589 + }
590 +@@ -1174,15 +1122,15 @@ int ip_tunnel_init(struct net_device *dev)
591 + if (!dev->tstats)
592 + return -ENOMEM;
593 +
594 +- tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
595 +- if (!tunnel->dst_cache) {
596 ++ err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
597 ++ if (err) {
598 + free_percpu(dev->tstats);
599 +- return -ENOMEM;
600 ++ return err;
601 + }
602 +
603 + err = gro_cells_init(&tunnel->gro_cells, dev);
604 + if (err) {
605 +- free_percpu(tunnel->dst_cache);
606 ++ dst_cache_destroy(&tunnel->dst_cache);
607 + free_percpu(dev->tstats);
608 + return err;
609 + }
610 +@@ -1212,7 +1160,7 @@ void ip_tunnel_uninit(struct net_device *dev)
611 + if (itn->fb_tunnel_dev != dev)
612 + ip_tunnel_del(itn, netdev_priv(dev));
613 +
614 +- ip_tunnel_dst_reset_all(tunnel);
615 ++ dst_cache_reset(&tunnel->dst_cache);
616 + }
617 + EXPORT_SYMBOL_GPL(ip_tunnel_uninit);
618 +
619 +diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
620 +index ede9d0e20538..8d11a034ca3f 100644
621 +--- a/net/ipv6/ipv6_sockglue.c
622 ++++ b/net/ipv6/ipv6_sockglue.c
623 +@@ -1340,10 +1340,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
624 + if (get_user(len, optlen))
625 + return -EFAULT;
626 +
627 +- lock_sock(sk);
628 +- err = nf_getsockopt(sk, PF_INET6, optname, optval,
629 +- &len);
630 +- release_sock(sk);
631 ++ err = nf_getsockopt(sk, PF_INET6, optname, optval, &len);
632 + if (err >= 0)
633 + err = put_user(len, optlen);
634 + }
635 +@@ -1382,10 +1379,7 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
636 + if (get_user(len, optlen))
637 + return -EFAULT;
638 +
639 +- lock_sock(sk);
640 +- err = compat_nf_getsockopt(sk, PF_INET6,
641 +- optname, optval, &len);
642 +- release_sock(sk);
643 ++ err = compat_nf_getsockopt(sk, PF_INET6, optname, optval, &len);
644 + if (err >= 0)
645 + err = put_user(len, optlen);
646 + }
647 +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
648 +index b7ea5eaa4fd1..d17d64edb718 100644
649 +--- a/net/ipv6/sit.c
650 ++++ b/net/ipv6/sit.c
651 +@@ -475,7 +475,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
652 + ipip6_tunnel_unlink(sitn, tunnel);
653 + ipip6_tunnel_del_prl(tunnel, NULL);
654 + }
655 +- ip_tunnel_dst_reset_all(tunnel);
656 ++ dst_cache_reset(&tunnel->dst_cache);
657 + dev_put(dev);
658 + }
659 +
660 +@@ -1098,7 +1098,7 @@ static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p)
661 + t->parms.link = p->link;
662 + ipip6_tunnel_bind_dev(t->dev);
663 + }
664 +- ip_tunnel_dst_reset_all(t);
665 ++ dst_cache_reset(&t->dst_cache);
666 + netdev_state_change(t->dev);
667 + }
668 +
669 +@@ -1129,7 +1129,7 @@ static int ipip6_tunnel_update_6rd(struct ip_tunnel *t,
670 + t->ip6rd.relay_prefix = relay_prefix;
671 + t->ip6rd.prefixlen = ip6rd->prefixlen;
672 + t->ip6rd.relay_prefixlen = ip6rd->relay_prefixlen;
673 +- ip_tunnel_dst_reset_all(t);
674 ++ dst_cache_reset(&t->dst_cache);
675 + netdev_state_change(t->dev);
676 + return 0;
677 + }
678 +@@ -1283,7 +1283,7 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
679 + err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL);
680 + break;
681 + }
682 +- ip_tunnel_dst_reset_all(t);
683 ++ dst_cache_reset(&t->dst_cache);
684 + netdev_state_change(dev);
685 + break;
686 +
687 +@@ -1344,7 +1344,7 @@ static void ipip6_dev_free(struct net_device *dev)
688 + {
689 + struct ip_tunnel *tunnel = netdev_priv(dev);
690 +
691 +- free_percpu(tunnel->dst_cache);
692 ++ dst_cache_destroy(&tunnel->dst_cache);
693 + free_percpu(dev->tstats);
694 + free_netdev(dev);
695 + }
696 +@@ -1377,6 +1377,7 @@ static void ipip6_tunnel_setup(struct net_device *dev)
697 + static int ipip6_tunnel_init(struct net_device *dev)
698 + {
699 + struct ip_tunnel *tunnel = netdev_priv(dev);
700 ++ int err;
701 +
702 + tunnel->dev = dev;
703 + tunnel->net = dev_net(dev);
704 +@@ -1387,11 +1388,11 @@ static int ipip6_tunnel_init(struct net_device *dev)
705 + if (!dev->tstats)
706 + return -ENOMEM;
707 +
708 +- tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
709 +- if (!tunnel->dst_cache) {
710 ++ err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
711 ++ if (err) {
712 + free_percpu(dev->tstats);
713 + dev->tstats = NULL;
714 +- return -ENOMEM;
715 ++ return err;
716 + }
717 +
718 + return 0;
719 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
720 +index 19322c047386..00a8cc572a22 100644
721 +--- a/net/mac80211/cfg.c
722 ++++ b/net/mac80211/cfg.c
723 +@@ -2877,7 +2877,7 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
724 + }
725 + if (beacon->probe_resp_len) {
726 + new_beacon->probe_resp_len = beacon->probe_resp_len;
727 +- beacon->probe_resp = pos;
728 ++ new_beacon->probe_resp = pos;
729 + memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
730 + pos += beacon->probe_resp_len;
731 + }