1 |
commit: 0684bfb696c6fc3e570b4abc6cb2f1067d3aa6fc |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 4 16:49:06 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 4 16:49:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0684bfb6 |
7 |
|
8 |
Linux patch 4.14.162 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1161_linux-4.14.162.patch | 3364 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3368 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index a19bacd..fbedcee 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -687,6 +687,10 @@ Patch: 1160_linux-4.14.161.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.161 |
23 |
|
24 |
+Patch: 1161_linux-4.14.162.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.162 |
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/1161_linux-4.14.162.patch b/1161_linux-4.14.162.patch |
33 |
new file mode 100644 |
34 |
index 0000000..d652257 |
35 |
--- /dev/null |
36 |
+++ b/1161_linux-4.14.162.patch |
37 |
@@ -0,0 +1,3364 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 6b4528888a75..cb57b5c58e2b 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 161 |
47 |
++SUBLEVEL = 162 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h |
52 |
+index b36c0289a308..6a0f1f524466 100644 |
53 |
+--- a/arch/arm/boot/compressed/libfdt_env.h |
54 |
++++ b/arch/arm/boot/compressed/libfdt_env.h |
55 |
+@@ -2,11 +2,13 @@ |
56 |
+ #ifndef _ARM_LIBFDT_ENV_H |
57 |
+ #define _ARM_LIBFDT_ENV_H |
58 |
+ |
59 |
++#include <linux/limits.h> |
60 |
+ #include <linux/types.h> |
61 |
+ #include <linux/string.h> |
62 |
+ #include <asm/byteorder.h> |
63 |
+ |
64 |
+-#define INT_MAX ((int)(~0U>>1)) |
65 |
++#define INT32_MAX S32_MAX |
66 |
++#define UINT32_MAX U32_MAX |
67 |
+ |
68 |
+ typedef __be16 fdt16_t; |
69 |
+ typedef __be32 fdt32_t; |
70 |
+diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h |
71 |
+index 39155d3b2cef..ac5d3c947e04 100644 |
72 |
+--- a/arch/powerpc/boot/libfdt_env.h |
73 |
++++ b/arch/powerpc/boot/libfdt_env.h |
74 |
+@@ -6,6 +6,8 @@ |
75 |
+ #include <string.h> |
76 |
+ |
77 |
+ #define INT_MAX ((int)(~0U>>1)) |
78 |
++#define UINT32_MAX ((u32)~0U) |
79 |
++#define INT32_MAX ((s32)(UINT32_MAX >> 1)) |
80 |
+ |
81 |
+ #include "of.h" |
82 |
+ |
83 |
+diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c |
84 |
+index f5d6541bf8c2..b3f540c9f410 100644 |
85 |
+--- a/arch/powerpc/kernel/security.c |
86 |
++++ b/arch/powerpc/kernel/security.c |
87 |
+@@ -134,32 +134,33 @@ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, cha |
88 |
+ |
89 |
+ thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV); |
90 |
+ |
91 |
+- if (rfi_flush || thread_priv) { |
92 |
++ if (rfi_flush) { |
93 |
+ struct seq_buf s; |
94 |
+ seq_buf_init(&s, buf, PAGE_SIZE - 1); |
95 |
+ |
96 |
+- seq_buf_printf(&s, "Mitigation: "); |
97 |
+- |
98 |
+- if (rfi_flush) |
99 |
+- seq_buf_printf(&s, "RFI Flush"); |
100 |
+- |
101 |
+- if (rfi_flush && thread_priv) |
102 |
+- seq_buf_printf(&s, ", "); |
103 |
+- |
104 |
++ seq_buf_printf(&s, "Mitigation: RFI Flush"); |
105 |
+ if (thread_priv) |
106 |
+- seq_buf_printf(&s, "L1D private per thread"); |
107 |
++ seq_buf_printf(&s, ", L1D private per thread"); |
108 |
+ |
109 |
+ seq_buf_printf(&s, "\n"); |
110 |
+ |
111 |
+ return s.len; |
112 |
+ } |
113 |
+ |
114 |
++ if (thread_priv) |
115 |
++ return sprintf(buf, "Vulnerable: L1D private per thread\n"); |
116 |
++ |
117 |
+ if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) && |
118 |
+ !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)) |
119 |
+ return sprintf(buf, "Not affected\n"); |
120 |
+ |
121 |
+ return sprintf(buf, "Vulnerable\n"); |
122 |
+ } |
123 |
++ |
124 |
++ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf) |
125 |
++{ |
126 |
++ return cpu_show_meltdown(dev, attr, buf); |
127 |
++} |
128 |
+ #endif |
129 |
+ |
130 |
+ ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf) |
131 |
+diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
132 |
+index 14f3f28a089e..66a9987dc0f8 100644 |
133 |
+--- a/arch/powerpc/kernel/time.c |
134 |
++++ b/arch/powerpc/kernel/time.c |
135 |
+@@ -241,7 +241,7 @@ static u64 scan_dispatch_log(u64 stop_tb) |
136 |
+ * Accumulate stolen time by scanning the dispatch trace log. |
137 |
+ * Called on entry from user mode. |
138 |
+ */ |
139 |
+-void accumulate_stolen_time(void) |
140 |
++void notrace accumulate_stolen_time(void) |
141 |
+ { |
142 |
+ u64 sst, ust; |
143 |
+ u8 save_soft_enabled = local_paca->soft_enabled; |
144 |
+diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c |
145 |
+index 58c14749bb0c..387600ecea60 100644 |
146 |
+--- a/arch/powerpc/mm/hash_utils_64.c |
147 |
++++ b/arch/powerpc/mm/hash_utils_64.c |
148 |
+@@ -292,10 +292,18 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, |
149 |
+ ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, |
150 |
+ HPTE_V_BOLTED, psize, psize, |
151 |
+ ssize); |
152 |
+- |
153 |
++ if (ret == -1) { |
154 |
++ /* Try to remove a non bolted entry */ |
155 |
++ ret = mmu_hash_ops.hpte_remove(hpteg); |
156 |
++ if (ret != -1) |
157 |
++ ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, |
158 |
++ HPTE_V_BOLTED, psize, psize, |
159 |
++ ssize); |
160 |
++ } |
161 |
+ if (ret < 0) |
162 |
+ break; |
163 |
+ |
164 |
++ cond_resched(); |
165 |
+ #ifdef CONFIG_DEBUG_PAGEALLOC |
166 |
+ if (debug_pagealloc_enabled() && |
167 |
+ (paddr >> PAGE_SHIFT) < linear_map_hash_count) |
168 |
+diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c |
169 |
+index 4ac419c7eb4c..25224c9e1dc0 100644 |
170 |
+--- a/arch/powerpc/platforms/pseries/cmm.c |
171 |
++++ b/arch/powerpc/platforms/pseries/cmm.c |
172 |
+@@ -425,6 +425,10 @@ static struct bus_type cmm_subsys = { |
173 |
+ .dev_name = "cmm", |
174 |
+ }; |
175 |
+ |
176 |
++static void cmm_release_device(struct device *dev) |
177 |
++{ |
178 |
++} |
179 |
++ |
180 |
+ /** |
181 |
+ * cmm_sysfs_register - Register with sysfs |
182 |
+ * |
183 |
+@@ -440,6 +444,7 @@ static int cmm_sysfs_register(struct device *dev) |
184 |
+ |
185 |
+ dev->id = 0; |
186 |
+ dev->bus = &cmm_subsys; |
187 |
++ dev->release = cmm_release_device; |
188 |
+ |
189 |
+ if ((rc = device_register(dev))) |
190 |
+ goto subsys_unregister; |
191 |
+diff --git a/arch/powerpc/tools/relocs_check.sh b/arch/powerpc/tools/relocs_check.sh |
192 |
+index ec2d5c835170..d6c16e7faa38 100755 |
193 |
+--- a/arch/powerpc/tools/relocs_check.sh |
194 |
++++ b/arch/powerpc/tools/relocs_check.sh |
195 |
+@@ -23,7 +23,7 @@ objdump="$1" |
196 |
+ vmlinux="$2" |
197 |
+ |
198 |
+ bad_relocs=$( |
199 |
+-"$objdump" -R "$vmlinux" | |
200 |
++$objdump -R "$vmlinux" | |
201 |
+ # Only look at relocation lines. |
202 |
+ grep -E '\<R_' | |
203 |
+ # These relocations are okay |
204 |
+diff --git a/arch/powerpc/tools/unrel_branch_check.sh b/arch/powerpc/tools/unrel_branch_check.sh |
205 |
+index 1e972df3107e..77114755dc6f 100755 |
206 |
+--- a/arch/powerpc/tools/unrel_branch_check.sh |
207 |
++++ b/arch/powerpc/tools/unrel_branch_check.sh |
208 |
+@@ -18,14 +18,14 @@ vmlinux="$2" |
209 |
+ #__end_interrupts should be located within the first 64K |
210 |
+ |
211 |
+ end_intr=0x$( |
212 |
+-"$objdump" -R "$vmlinux" -d --start-address=0xc000000000000000 \ |
213 |
++$objdump -R "$vmlinux" -d --start-address=0xc000000000000000 \ |
214 |
+ --stop-address=0xc000000000010000 | |
215 |
+ grep '\<__end_interrupts>:' | |
216 |
+ awk '{print $1}' |
217 |
+ ) |
218 |
+ |
219 |
+ BRANCHES=$( |
220 |
+-"$objdump" -R "$vmlinux" -D --start-address=0xc000000000000000 \ |
221 |
++$objdump -R "$vmlinux" -D --start-address=0xc000000000000000 \ |
222 |
+ --stop-address=${end_intr} | |
223 |
+ grep -e "^c[0-9a-f]*:[[:space:]]*\([0-9a-f][0-9a-f][[:space:]]\)\{4\}[[:space:]]*b" | |
224 |
+ grep -v '\<__start_initialization_multiplatform>' | |
225 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
226 |
+index 2e2fd9535f86..45304085b6ee 100644 |
227 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
228 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
229 |
+@@ -185,7 +185,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
230 |
+ unsigned long num_sdb, gfp_t gfp_flags) |
231 |
+ { |
232 |
+ int i, rc; |
233 |
+- unsigned long *new, *tail; |
234 |
++ unsigned long *new, *tail, *tail_prev = NULL; |
235 |
+ |
236 |
+ if (!sfb->sdbt || !sfb->tail) |
237 |
+ return -EINVAL; |
238 |
+@@ -224,6 +224,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
239 |
+ sfb->num_sdbt++; |
240 |
+ /* Link current page to tail of chain */ |
241 |
+ *tail = (unsigned long)(void *) new + 1; |
242 |
++ tail_prev = tail; |
243 |
+ tail = new; |
244 |
+ } |
245 |
+ |
246 |
+@@ -233,10 +234,22 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
247 |
+ * issue, a new realloc call (if required) might succeed. |
248 |
+ */ |
249 |
+ rc = alloc_sample_data_block(tail, gfp_flags); |
250 |
+- if (rc) |
251 |
++ if (rc) { |
252 |
++ /* Undo last SDBT. An SDBT with no SDB at its first |
253 |
++ * entry but with an SDBT entry instead can not be |
254 |
++ * handled by the interrupt handler code. |
255 |
++ * Avoid this situation. |
256 |
++ */ |
257 |
++ if (tail_prev) { |
258 |
++ sfb->num_sdbt--; |
259 |
++ free_page((unsigned long) new); |
260 |
++ tail = tail_prev; |
261 |
++ } |
262 |
+ break; |
263 |
++ } |
264 |
+ sfb->num_sdb++; |
265 |
+ tail++; |
266 |
++ tail_prev = new = NULL; /* Allocated at least one SBD */ |
267 |
+ } |
268 |
+ |
269 |
+ /* Link sampling buffer to its origin */ |
270 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
271 |
+index c7bd2e549a6a..0b0e44f85393 100644 |
272 |
+--- a/arch/x86/kernel/cpu/mcheck/mce.c |
273 |
++++ b/arch/x86/kernel/cpu/mcheck/mce.c |
274 |
+@@ -802,8 +802,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
275 |
+ if (quirk_no_way_out) |
276 |
+ quirk_no_way_out(i, m, regs); |
277 |
+ |
278 |
++ m->bank = i; |
279 |
+ if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
280 |
+- m->bank = i; |
281 |
+ mce_read_aux(m, i); |
282 |
+ *msg = tmp; |
283 |
+ return 1; |
284 |
+diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c |
285 |
+index 90dd8e7291da..1c90da4af94f 100644 |
286 |
+--- a/drivers/cdrom/cdrom.c |
287 |
++++ b/drivers/cdrom/cdrom.c |
288 |
+@@ -995,6 +995,12 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks) |
289 |
+ tracks->xa = 0; |
290 |
+ tracks->error = 0; |
291 |
+ cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); |
292 |
++ |
293 |
++ if (!CDROM_CAN(CDC_PLAY_AUDIO)) { |
294 |
++ tracks->error = CDS_NO_INFO; |
295 |
++ return; |
296 |
++ } |
297 |
++ |
298 |
+ /* Grab the TOC header so we can see how many tracks there are */ |
299 |
+ ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header); |
300 |
+ if (ret) { |
301 |
+@@ -1161,7 +1167,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, |
302 |
+ ret = open_for_data(cdi); |
303 |
+ if (ret) |
304 |
+ goto err; |
305 |
+- cdrom_mmc3_profile(cdi); |
306 |
++ if (CDROM_CAN(CDC_GENERIC_PACKET)) |
307 |
++ cdrom_mmc3_profile(cdi); |
308 |
+ if (mode & FMODE_WRITE) { |
309 |
+ ret = -EROFS; |
310 |
+ if (cdrom_open_write(cdi)) |
311 |
+@@ -2878,6 +2885,9 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written) |
312 |
+ it doesn't give enough information or fails. then we return |
313 |
+ the toc contents. */ |
314 |
+ use_toc: |
315 |
++ if (!CDROM_CAN(CDC_PLAY_AUDIO)) |
316 |
++ return -ENOSYS; |
317 |
++ |
318 |
+ toc.cdte_format = CDROM_MSF; |
319 |
+ toc.cdte_track = CDROM_LEADOUT; |
320 |
+ if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc))) |
321 |
+diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c |
322 |
+index 25a30194d27a..b67ea86ff156 100644 |
323 |
+--- a/drivers/clk/pxa/clk-pxa27x.c |
324 |
++++ b/drivers/clk/pxa/clk-pxa27x.c |
325 |
+@@ -462,6 +462,7 @@ struct dummy_clk { |
326 |
+ }; |
327 |
+ static struct dummy_clk dummy_clks[] __initdata = { |
328 |
+ DUMMY_CLK(NULL, "pxa27x-gpio", "osc_32_768khz"), |
329 |
++ DUMMY_CLK(NULL, "pxa-rtc", "osc_32_768khz"), |
330 |
+ DUMMY_CLK(NULL, "sa1100-rtc", "osc_32_768khz"), |
331 |
+ DUMMY_CLK("UARTCLK", "pxa2xx-ir", "STUART"), |
332 |
+ }; |
333 |
+diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
334 |
+index 1a0985ae20d2..a93439242565 100644 |
335 |
+--- a/drivers/clk/qcom/clk-rcg2.c |
336 |
++++ b/drivers/clk/qcom/clk-rcg2.c |
337 |
+@@ -212,6 +212,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, |
338 |
+ p = clk_hw_get_parent_by_index(hw, index); |
339 |
+ if (clk_flags & CLK_SET_RATE_PARENT) { |
340 |
+ if (f->pre_div) { |
341 |
++ if (!rate) |
342 |
++ rate = req->rate; |
343 |
+ rate /= 2; |
344 |
+ rate *= f->pre_div + 1; |
345 |
+ } |
346 |
+diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c |
347 |
+index 28ceaf1e9937..ae9352f7706d 100644 |
348 |
+--- a/drivers/clk/qcom/common.c |
349 |
++++ b/drivers/clk/qcom/common.c |
350 |
+@@ -37,6 +37,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate) |
351 |
+ if (!f) |
352 |
+ return NULL; |
353 |
+ |
354 |
++ if (!f->freq) |
355 |
++ return f; |
356 |
++ |
357 |
+ for (; f->freq; f++) |
358 |
+ if (rate <= f->freq) |
359 |
+ return f; |
360 |
+diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c |
361 |
+index 38cd2feb87c4..0ce760776406 100644 |
362 |
+--- a/drivers/clocksource/asm9260_timer.c |
363 |
++++ b/drivers/clocksource/asm9260_timer.c |
364 |
+@@ -198,6 +198,10 @@ static int __init asm9260_timer_init(struct device_node *np) |
365 |
+ } |
366 |
+ |
367 |
+ clk = of_clk_get(np, 0); |
368 |
++ if (IS_ERR(clk)) { |
369 |
++ pr_err("Failed to get clk!\n"); |
370 |
++ return PTR_ERR(clk); |
371 |
++ } |
372 |
+ |
373 |
+ ret = clk_prepare_enable(clk); |
374 |
+ if (ret) { |
375 |
+diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c |
376 |
+index 8c93dec498fa..e7783b852d69 100644 |
377 |
+--- a/drivers/gpio/gpio-mpc8xxx.c |
378 |
++++ b/drivers/gpio/gpio-mpc8xxx.c |
379 |
+@@ -337,7 +337,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) |
380 |
+ * It's assumed that only a single type of gpio controller is available |
381 |
+ * on the current machine, so overwriting global data is fine. |
382 |
+ */ |
383 |
+- mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
384 |
++ if (devtype->irq_set_type) |
385 |
++ mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
386 |
+ |
387 |
+ if (devtype->gpio_dir_out) |
388 |
+ gc->direction_output = devtype->gpio_dir_out; |
389 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
390 |
+index 0c547bf841f4..6a04b56d161b 100644 |
391 |
+--- a/drivers/hid/hid-core.c |
392 |
++++ b/drivers/hid/hid-core.c |
393 |
+@@ -760,6 +760,10 @@ static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) |
394 |
+ if (usage == 0xff0000c5 && parser->global.report_count == 256 && |
395 |
+ parser->global.report_size == 8) |
396 |
+ parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
397 |
++ |
398 |
++ if (usage == 0xff0000c6 && parser->global.report_count == 1 && |
399 |
++ parser->global.report_size == 8) |
400 |
++ parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
401 |
+ } |
402 |
+ |
403 |
+ static void hid_scan_collection(struct hid_parser *parser, unsigned type) |
404 |
+diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
405 |
+index 4706fb852eaf..6ad776b4711b 100644 |
406 |
+--- a/drivers/hid/hid-logitech-hidpp.c |
407 |
++++ b/drivers/hid/hid-logitech-hidpp.c |
408 |
+@@ -978,6 +978,9 @@ static int hidpp20_batterylevel_get_battery_capacity(struct hidpp_device *hidpp, |
409 |
+ ret = hidpp_send_fap_command_sync(hidpp, feature_index, |
410 |
+ CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_LEVEL_STATUS, |
411 |
+ NULL, 0, &response); |
412 |
++ /* Ignore these intermittent errors */ |
413 |
++ if (ret == HIDPP_ERROR_RESOURCE_ERROR) |
414 |
++ return -EIO; |
415 |
+ if (ret > 0) { |
416 |
+ hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", |
417 |
+ __func__, ret); |
418 |
+diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c |
419 |
+index 59aaac43db91..138d1f3b12b2 100644 |
420 |
+--- a/drivers/input/touchscreen/atmel_mxt_ts.c |
421 |
++++ b/drivers/input/touchscreen/atmel_mxt_ts.c |
422 |
+@@ -3257,6 +3257,8 @@ static int __maybe_unused mxt_suspend(struct device *dev) |
423 |
+ |
424 |
+ mutex_unlock(&input_dev->mutex); |
425 |
+ |
426 |
++ disable_irq(data->irq); |
427 |
++ |
428 |
+ return 0; |
429 |
+ } |
430 |
+ |
431 |
+@@ -3269,6 +3271,8 @@ static int __maybe_unused mxt_resume(struct device *dev) |
432 |
+ if (!input_dev) |
433 |
+ return 0; |
434 |
+ |
435 |
++ enable_irq(data->irq); |
436 |
++ |
437 |
+ mutex_lock(&input_dev->mutex); |
438 |
+ |
439 |
+ if (input_dev->users) |
440 |
+diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c |
441 |
+index 40eb8138546a..848dac3e4580 100644 |
442 |
+--- a/drivers/iommu/tegra-smmu.c |
443 |
++++ b/drivers/iommu/tegra-smmu.c |
444 |
+@@ -156,9 +156,9 @@ static bool smmu_dma_addr_valid(struct tegra_smmu *smmu, dma_addr_t addr) |
445 |
+ return (addr & smmu->pfn_mask) == addr; |
446 |
+ } |
447 |
+ |
448 |
+-static dma_addr_t smmu_pde_to_dma(u32 pde) |
449 |
++static dma_addr_t smmu_pde_to_dma(struct tegra_smmu *smmu, u32 pde) |
450 |
+ { |
451 |
+- return pde << 12; |
452 |
++ return (dma_addr_t)(pde & smmu->pfn_mask) << 12; |
453 |
+ } |
454 |
+ |
455 |
+ static void smmu_flush_ptc_all(struct tegra_smmu *smmu) |
456 |
+@@ -543,6 +543,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
457 |
+ dma_addr_t *dmap) |
458 |
+ { |
459 |
+ unsigned int pd_index = iova_pd_index(iova); |
460 |
++ struct tegra_smmu *smmu = as->smmu; |
461 |
+ struct page *pt_page; |
462 |
+ u32 *pd; |
463 |
+ |
464 |
+@@ -551,7 +552,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
465 |
+ return NULL; |
466 |
+ |
467 |
+ pd = page_address(as->pd); |
468 |
+- *dmap = smmu_pde_to_dma(pd[pd_index]); |
469 |
++ *dmap = smmu_pde_to_dma(smmu, pd[pd_index]); |
470 |
+ |
471 |
+ return tegra_smmu_pte_offset(pt_page, iova); |
472 |
+ } |
473 |
+@@ -593,7 +594,7 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, |
474 |
+ } else { |
475 |
+ u32 *pd = page_address(as->pd); |
476 |
+ |
477 |
+- *dmap = smmu_pde_to_dma(pd[pde]); |
478 |
++ *dmap = smmu_pde_to_dma(smmu, pd[pde]); |
479 |
+ } |
480 |
+ |
481 |
+ return tegra_smmu_pte_offset(as->pts[pde], iova); |
482 |
+@@ -618,7 +619,7 @@ static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) |
483 |
+ if (--as->count[pde] == 0) { |
484 |
+ struct tegra_smmu *smmu = as->smmu; |
485 |
+ u32 *pd = page_address(as->pd); |
486 |
+- dma_addr_t pte_dma = smmu_pde_to_dma(pd[pde]); |
487 |
++ dma_addr_t pte_dma = smmu_pde_to_dma(smmu, pd[pde]); |
488 |
+ |
489 |
+ tegra_smmu_set_pde(as, iova, 0); |
490 |
+ |
491 |
+diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c |
492 |
+index 0b9a8b709abf..b32988cac80c 100644 |
493 |
+--- a/drivers/irqchip/irq-bcm7038-l1.c |
494 |
++++ b/drivers/irqchip/irq-bcm7038-l1.c |
495 |
+@@ -284,6 +284,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, |
496 |
+ pr_err("failed to map parent interrupt %d\n", parent_irq); |
497 |
+ return -EINVAL; |
498 |
+ } |
499 |
++ |
500 |
++ if (of_property_read_bool(dn, "brcm,irq-can-wake")) |
501 |
++ enable_irq_wake(parent_irq); |
502 |
++ |
503 |
+ irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle, |
504 |
+ intc); |
505 |
+ |
506 |
+diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c |
507 |
+index fc5953dea509..b2e16dca76a6 100644 |
508 |
+--- a/drivers/irqchip/irq-ingenic.c |
509 |
++++ b/drivers/irqchip/irq-ingenic.c |
510 |
+@@ -117,6 +117,14 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
511 |
+ goto out_unmap_irq; |
512 |
+ } |
513 |
+ |
514 |
++ domain = irq_domain_add_legacy(node, num_chips * 32, |
515 |
++ JZ4740_IRQ_BASE, 0, |
516 |
++ &irq_domain_simple_ops, NULL); |
517 |
++ if (!domain) { |
518 |
++ err = -ENOMEM; |
519 |
++ goto out_unmap_base; |
520 |
++ } |
521 |
++ |
522 |
+ for (i = 0; i < num_chips; i++) { |
523 |
+ /* Mask all irqs */ |
524 |
+ writel(0xffffffff, intc->base + (i * CHIP_SIZE) + |
525 |
+@@ -143,14 +151,11 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
526 |
+ IRQ_NOPROBE | IRQ_LEVEL); |
527 |
+ } |
528 |
+ |
529 |
+- domain = irq_domain_add_legacy(node, num_chips * 32, JZ4740_IRQ_BASE, 0, |
530 |
+- &irq_domain_simple_ops, NULL); |
531 |
+- if (!domain) |
532 |
+- pr_warn("unable to register IRQ domain\n"); |
533 |
+- |
534 |
+ setup_irq(parent_irq, &intc_cascade_action); |
535 |
+ return 0; |
536 |
+ |
537 |
++out_unmap_base: |
538 |
++ iounmap(intc->base); |
539 |
+ out_unmap_irq: |
540 |
+ irq_dispose_mapping(parent_irq); |
541 |
+ out_free: |
542 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
543 |
+index 9406326216f1..96a6583e7b52 100644 |
544 |
+--- a/drivers/md/bcache/btree.c |
545 |
++++ b/drivers/md/bcache/btree.c |
546 |
+@@ -685,6 +685,8 @@ static unsigned long bch_mca_scan(struct shrinker *shrink, |
547 |
+ * IO can always make forward progress: |
548 |
+ */ |
549 |
+ nr /= c->btree_pages; |
550 |
++ if (nr == 0) |
551 |
++ nr = 1; |
552 |
+ nr = min_t(unsigned long, nr, mca_can_free(c)); |
553 |
+ |
554 |
+ i = 0; |
555 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
556 |
+index 5f6602cb191f..fef599eb822b 100644 |
557 |
+--- a/drivers/net/bonding/bond_main.c |
558 |
++++ b/drivers/net/bonding/bond_main.c |
559 |
+@@ -2186,9 +2186,6 @@ static void bond_miimon_commit(struct bonding *bond) |
560 |
+ } else if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { |
561 |
+ /* make it immediately active */ |
562 |
+ bond_set_active_slave(slave); |
563 |
+- } else if (slave != primary) { |
564 |
+- /* prevent it from being the active one */ |
565 |
+- bond_set_backup_slave(slave); |
566 |
+ } |
567 |
+ |
568 |
+ netdev_info(bond->dev, "link status definitely up for interface %s, %u Mbps %s duplex\n", |
569 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
570 |
+index db6f6a877f63..d22b138c2b09 100644 |
571 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
572 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
573 |
+@@ -1196,8 +1196,8 @@ static int ena_io_poll(struct napi_struct *napi, int budget) |
574 |
+ struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi); |
575 |
+ struct ena_ring *tx_ring, *rx_ring; |
576 |
+ |
577 |
+- u32 tx_work_done; |
578 |
+- u32 rx_work_done; |
579 |
++ int tx_work_done; |
580 |
++ int rx_work_done = 0; |
581 |
+ int tx_budget; |
582 |
+ int napi_comp_call = 0; |
583 |
+ int ret; |
584 |
+@@ -1214,7 +1214,11 @@ static int ena_io_poll(struct napi_struct *napi, int budget) |
585 |
+ } |
586 |
+ |
587 |
+ tx_work_done = ena_clean_tx_irq(tx_ring, tx_budget); |
588 |
+- rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); |
589 |
++ /* On netpoll the budget is zero and the handler should only clean the |
590 |
++ * tx completions. |
591 |
++ */ |
592 |
++ if (likely(budget)) |
593 |
++ rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); |
594 |
+ |
595 |
+ /* If the device is about to reset or down, avoid unmask |
596 |
+ * the interrupt and return 0 so NAPI won't reschedule |
597 |
+diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c |
598 |
+index 993cb5ba934e..b99169a386eb 100644 |
599 |
+--- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c |
600 |
++++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c |
601 |
+@@ -37,6 +37,7 @@ |
602 |
+ #include <linux/kernel.h> |
603 |
+ #include <linux/module.h> |
604 |
+ #include <linux/netlink.h> |
605 |
++#include <linux/vmalloc.h> |
606 |
+ #include <linux/xz.h> |
607 |
+ #include "mlxfw_mfa2.h" |
608 |
+ #include "mlxfw_mfa2_file.h" |
609 |
+@@ -579,7 +580,7 @@ mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, |
610 |
+ comp_size = be32_to_cpu(comp->size); |
611 |
+ comp_buf_size = comp_size + mlxfw_mfa2_comp_magic_len; |
612 |
+ |
613 |
+- comp_data = kmalloc(sizeof(*comp_data) + comp_buf_size, GFP_KERNEL); |
614 |
++ comp_data = vzalloc(sizeof(*comp_data) + comp_buf_size); |
615 |
+ if (!comp_data) |
616 |
+ return ERR_PTR(-ENOMEM); |
617 |
+ comp_data->comp.data_size = comp_size; |
618 |
+@@ -601,7 +602,7 @@ mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, |
619 |
+ comp_data->comp.data = comp_data->buff + mlxfw_mfa2_comp_magic_len; |
620 |
+ return &comp_data->comp; |
621 |
+ err_out: |
622 |
+- kfree(comp_data); |
623 |
++ vfree(comp_data); |
624 |
+ return ERR_PTR(err); |
625 |
+ } |
626 |
+ |
627 |
+@@ -610,7 +611,7 @@ void mlxfw_mfa2_file_component_put(struct mlxfw_mfa2_component *comp) |
628 |
+ const struct mlxfw_mfa2_comp_data *comp_data; |
629 |
+ |
630 |
+ comp_data = container_of(comp, struct mlxfw_mfa2_comp_data, comp); |
631 |
+- kfree(comp_data); |
632 |
++ vfree(comp_data); |
633 |
+ } |
634 |
+ |
635 |
+ void mlxfw_mfa2_file_fini(struct mlxfw_mfa2_file *mfa2_file) |
636 |
+diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c |
637 |
+index 5de4053774b8..35905e9ee9ec 100644 |
638 |
+--- a/drivers/net/gtp.c |
639 |
++++ b/drivers/net/gtp.c |
640 |
+@@ -42,7 +42,6 @@ struct pdp_ctx { |
641 |
+ struct hlist_node hlist_addr; |
642 |
+ |
643 |
+ union { |
644 |
+- u64 tid; |
645 |
+ struct { |
646 |
+ u64 tid; |
647 |
+ u16 flow; |
648 |
+@@ -545,7 +544,7 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, |
649 |
+ mtu = dst_mtu(&rt->dst); |
650 |
+ } |
651 |
+ |
652 |
+- rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu); |
653 |
++ rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false); |
654 |
+ |
655 |
+ if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && |
656 |
+ mtu < ntohs(iph->tot_len)) { |
657 |
+@@ -645,9 +644,16 @@ static void gtp_link_setup(struct net_device *dev) |
658 |
+ } |
659 |
+ |
660 |
+ static int gtp_hashtable_new(struct gtp_dev *gtp, int hsize); |
661 |
+-static void gtp_hashtable_free(struct gtp_dev *gtp); |
662 |
+ static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[]); |
663 |
+ |
664 |
++static void gtp_destructor(struct net_device *dev) |
665 |
++{ |
666 |
++ struct gtp_dev *gtp = netdev_priv(dev); |
667 |
++ |
668 |
++ kfree(gtp->addr_hash); |
669 |
++ kfree(gtp->tid_hash); |
670 |
++} |
671 |
++ |
672 |
+ static int gtp_newlink(struct net *src_net, struct net_device *dev, |
673 |
+ struct nlattr *tb[], struct nlattr *data[], |
674 |
+ struct netlink_ext_ack *extack) |
675 |
+@@ -665,10 +671,13 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev, |
676 |
+ if (err < 0) |
677 |
+ return err; |
678 |
+ |
679 |
+- if (!data[IFLA_GTP_PDP_HASHSIZE]) |
680 |
++ if (!data[IFLA_GTP_PDP_HASHSIZE]) { |
681 |
+ hashsize = 1024; |
682 |
+- else |
683 |
++ } else { |
684 |
+ hashsize = nla_get_u32(data[IFLA_GTP_PDP_HASHSIZE]); |
685 |
++ if (!hashsize) |
686 |
++ hashsize = 1024; |
687 |
++ } |
688 |
+ |
689 |
+ err = gtp_hashtable_new(gtp, hashsize); |
690 |
+ if (err < 0) |
691 |
+@@ -682,13 +691,15 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev, |
692 |
+ |
693 |
+ gn = net_generic(dev_net(dev), gtp_net_id); |
694 |
+ list_add_rcu(>p->list, &gn->gtp_dev_list); |
695 |
++ dev->priv_destructor = gtp_destructor; |
696 |
+ |
697 |
+ netdev_dbg(dev, "registered new GTP interface\n"); |
698 |
+ |
699 |
+ return 0; |
700 |
+ |
701 |
+ out_hashtable: |
702 |
+- gtp_hashtable_free(gtp); |
703 |
++ kfree(gtp->addr_hash); |
704 |
++ kfree(gtp->tid_hash); |
705 |
+ out_encap: |
706 |
+ gtp_encap_disable(gtp); |
707 |
+ return err; |
708 |
+@@ -697,9 +708,14 @@ out_encap: |
709 |
+ static void gtp_dellink(struct net_device *dev, struct list_head *head) |
710 |
+ { |
711 |
+ struct gtp_dev *gtp = netdev_priv(dev); |
712 |
++ struct pdp_ctx *pctx; |
713 |
++ int i; |
714 |
++ |
715 |
++ for (i = 0; i < gtp->hash_size; i++) |
716 |
++ hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], hlist_tid) |
717 |
++ pdp_context_delete(pctx); |
718 |
+ |
719 |
+ gtp_encap_disable(gtp); |
720 |
+- gtp_hashtable_free(gtp); |
721 |
+ list_del_rcu(>p->list); |
722 |
+ unregister_netdevice_queue(dev, head); |
723 |
+ } |
724 |
+@@ -775,20 +791,6 @@ err1: |
725 |
+ return -ENOMEM; |
726 |
+ } |
727 |
+ |
728 |
+-static void gtp_hashtable_free(struct gtp_dev *gtp) |
729 |
+-{ |
730 |
+- struct pdp_ctx *pctx; |
731 |
+- int i; |
732 |
+- |
733 |
+- for (i = 0; i < gtp->hash_size; i++) |
734 |
+- hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], hlist_tid) |
735 |
+- pdp_context_delete(pctx); |
736 |
+- |
737 |
+- synchronize_rcu(); |
738 |
+- kfree(gtp->addr_hash); |
739 |
+- kfree(gtp->tid_hash); |
740 |
+-} |
741 |
+- |
742 |
+ static struct sock *gtp_encap_enable_socket(int fd, int type, |
743 |
+ struct gtp_dev *gtp) |
744 |
+ { |
745 |
+@@ -929,24 +931,31 @@ static void ipv4_pdp_fill(struct pdp_ctx *pctx, struct genl_info *info) |
746 |
+ } |
747 |
+ } |
748 |
+ |
749 |
+-static int ipv4_pdp_add(struct gtp_dev *gtp, struct sock *sk, |
750 |
+- struct genl_info *info) |
751 |
++static int gtp_pdp_add(struct gtp_dev *gtp, struct sock *sk, |
752 |
++ struct genl_info *info) |
753 |
+ { |
754 |
++ struct pdp_ctx *pctx, *pctx_tid = NULL; |
755 |
+ struct net_device *dev = gtp->dev; |
756 |
+ u32 hash_ms, hash_tid = 0; |
757 |
+- struct pdp_ctx *pctx; |
758 |
++ unsigned int version; |
759 |
+ bool found = false; |
760 |
+ __be32 ms_addr; |
761 |
+ |
762 |
+ ms_addr = nla_get_be32(info->attrs[GTPA_MS_ADDRESS]); |
763 |
+ hash_ms = ipv4_hashfn(ms_addr) % gtp->hash_size; |
764 |
++ version = nla_get_u32(info->attrs[GTPA_VERSION]); |
765 |
+ |
766 |
+- hlist_for_each_entry_rcu(pctx, >p->addr_hash[hash_ms], hlist_addr) { |
767 |
+- if (pctx->ms_addr_ip4.s_addr == ms_addr) { |
768 |
+- found = true; |
769 |
+- break; |
770 |
+- } |
771 |
+- } |
772 |
++ pctx = ipv4_pdp_find(gtp, ms_addr); |
773 |
++ if (pctx) |
774 |
++ found = true; |
775 |
++ if (version == GTP_V0) |
776 |
++ pctx_tid = gtp0_pdp_find(gtp, |
777 |
++ nla_get_u64(info->attrs[GTPA_TID])); |
778 |
++ else if (version == GTP_V1) |
779 |
++ pctx_tid = gtp1_pdp_find(gtp, |
780 |
++ nla_get_u32(info->attrs[GTPA_I_TEI])); |
781 |
++ if (pctx_tid) |
782 |
++ found = true; |
783 |
+ |
784 |
+ if (found) { |
785 |
+ if (info->nlhdr->nlmsg_flags & NLM_F_EXCL) |
786 |
+@@ -954,6 +963,11 @@ static int ipv4_pdp_add(struct gtp_dev *gtp, struct sock *sk, |
787 |
+ if (info->nlhdr->nlmsg_flags & NLM_F_REPLACE) |
788 |
+ return -EOPNOTSUPP; |
789 |
+ |
790 |
++ if (pctx && pctx_tid) |
791 |
++ return -EEXIST; |
792 |
++ if (!pctx) |
793 |
++ pctx = pctx_tid; |
794 |
++ |
795 |
+ ipv4_pdp_fill(pctx, info); |
796 |
+ |
797 |
+ if (pctx->gtp_version == GTP_V0) |
798 |
+@@ -1077,7 +1091,7 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info) |
799 |
+ goto out_unlock; |
800 |
+ } |
801 |
+ |
802 |
+- err = ipv4_pdp_add(gtp, sk, info); |
803 |
++ err = gtp_pdp_add(gtp, sk, info); |
804 |
+ |
805 |
+ out_unlock: |
806 |
+ rcu_read_unlock(); |
807 |
+@@ -1235,43 +1249,46 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb, |
808 |
+ struct netlink_callback *cb) |
809 |
+ { |
810 |
+ struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2], *gtp; |
811 |
++ int i, j, bucket = cb->args[0], skip = cb->args[1]; |
812 |
+ struct net *net = sock_net(skb->sk); |
813 |
+- struct gtp_net *gn = net_generic(net, gtp_net_id); |
814 |
+- unsigned long tid = cb->args[1]; |
815 |
+- int i, k = cb->args[0], ret; |
816 |
+ struct pdp_ctx *pctx; |
817 |
++ struct gtp_net *gn; |
818 |
++ |
819 |
++ gn = net_generic(net, gtp_net_id); |
820 |
+ |
821 |
+ if (cb->args[4]) |
822 |
+ return 0; |
823 |
+ |
824 |
++ rcu_read_lock(); |
825 |
+ list_for_each_entry_rcu(gtp, &gn->gtp_dev_list, list) { |
826 |
+ if (last_gtp && last_gtp != gtp) |
827 |
+ continue; |
828 |
+ else |
829 |
+ last_gtp = NULL; |
830 |
+ |
831 |
+- for (i = k; i < gtp->hash_size; i++) { |
832 |
+- hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], hlist_tid) { |
833 |
+- if (tid && tid != pctx->u.tid) |
834 |
+- continue; |
835 |
+- else |
836 |
+- tid = 0; |
837 |
+- |
838 |
+- ret = gtp_genl_fill_info(skb, |
839 |
+- NETLINK_CB(cb->skb).portid, |
840 |
+- cb->nlh->nlmsg_seq, |
841 |
+- cb->nlh->nlmsg_type, pctx); |
842 |
+- if (ret < 0) { |
843 |
++ for (i = bucket; i < gtp->hash_size; i++) { |
844 |
++ j = 0; |
845 |
++ hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], |
846 |
++ hlist_tid) { |
847 |
++ if (j >= skip && |
848 |
++ gtp_genl_fill_info(skb, |
849 |
++ NETLINK_CB(cb->skb).portid, |
850 |
++ cb->nlh->nlmsg_seq, |
851 |
++ cb->nlh->nlmsg_type, pctx)) { |
852 |
+ cb->args[0] = i; |
853 |
+- cb->args[1] = pctx->u.tid; |
854 |
++ cb->args[1] = j; |
855 |
+ cb->args[2] = (unsigned long)gtp; |
856 |
+ goto out; |
857 |
+ } |
858 |
++ j++; |
859 |
+ } |
860 |
++ skip = 0; |
861 |
+ } |
862 |
++ bucket = 0; |
863 |
+ } |
864 |
+ cb->args[4] = 1; |
865 |
+ out: |
866 |
++ rcu_read_unlock(); |
867 |
+ return skb->len; |
868 |
+ } |
869 |
+ |
870 |
+diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
871 |
+index 021a8ec411ab..6d4742d10a78 100644 |
872 |
+--- a/drivers/net/hamradio/6pack.c |
873 |
++++ b/drivers/net/hamradio/6pack.c |
874 |
+@@ -665,10 +665,10 @@ static void sixpack_close(struct tty_struct *tty) |
875 |
+ { |
876 |
+ struct sixpack *sp; |
877 |
+ |
878 |
+- write_lock_bh(&disc_data_lock); |
879 |
++ write_lock_irq(&disc_data_lock); |
880 |
+ sp = tty->disc_data; |
881 |
+ tty->disc_data = NULL; |
882 |
+- write_unlock_bh(&disc_data_lock); |
883 |
++ write_unlock_irq(&disc_data_lock); |
884 |
+ if (!sp) |
885 |
+ return; |
886 |
+ |
887 |
+diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c |
888 |
+index aec6c26563cf..9fd7dab42a53 100644 |
889 |
+--- a/drivers/net/hamradio/mkiss.c |
890 |
++++ b/drivers/net/hamradio/mkiss.c |
891 |
+@@ -783,10 +783,10 @@ static void mkiss_close(struct tty_struct *tty) |
892 |
+ { |
893 |
+ struct mkiss *ax; |
894 |
+ |
895 |
+- write_lock_bh(&disc_data_lock); |
896 |
++ write_lock_irq(&disc_data_lock); |
897 |
+ ax = tty->disc_data; |
898 |
+ tty->disc_data = NULL; |
899 |
+- write_unlock_bh(&disc_data_lock); |
900 |
++ write_unlock_irq(&disc_data_lock); |
901 |
+ |
902 |
+ if (!ax) |
903 |
+ return; |
904 |
+diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c |
905 |
+index b2feda35966b..471498469d0a 100644 |
906 |
+--- a/drivers/nvdimm/btt.c |
907 |
++++ b/drivers/nvdimm/btt.c |
908 |
+@@ -1259,11 +1259,11 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip, |
909 |
+ |
910 |
+ ret = btt_data_read(arena, page, off, postmap, cur_len); |
911 |
+ if (ret) { |
912 |
+- int rc; |
913 |
+- |
914 |
+ /* Media error - set the e_flag */ |
915 |
+- rc = btt_map_write(arena, premap, postmap, 0, 1, |
916 |
+- NVDIMM_IO_ATOMIC); |
917 |
++ if (btt_map_write(arena, premap, postmap, 0, 1, NVDIMM_IO_ATOMIC)) |
918 |
++ dev_warn_ratelimited(to_dev(arena), |
919 |
++ "Error persistently tracking bad blocks at %#x\n", |
920 |
++ premap); |
921 |
+ goto out_rtt; |
922 |
+ } |
923 |
+ |
924 |
+diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c |
925 |
+index beeb7cbb5015..9df5d29d708d 100644 |
926 |
+--- a/drivers/pinctrl/intel/pinctrl-baytrail.c |
927 |
++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c |
928 |
+@@ -204,7 +204,6 @@ struct byt_gpio { |
929 |
+ struct platform_device *pdev; |
930 |
+ struct pinctrl_dev *pctl_dev; |
931 |
+ struct pinctrl_desc pctl_desc; |
932 |
+- raw_spinlock_t lock; |
933 |
+ const struct byt_pinctrl_soc_data *soc_data; |
934 |
+ struct byt_community *communities_copy; |
935 |
+ struct byt_gpio_pin_context *saved_context; |
936 |
+@@ -715,6 +714,8 @@ static const struct byt_pinctrl_soc_data *byt_soc_data[] = { |
937 |
+ NULL, |
938 |
+ }; |
939 |
+ |
940 |
++static DEFINE_RAW_SPINLOCK(byt_lock); |
941 |
++ |
942 |
+ static struct byt_community *byt_get_community(struct byt_gpio *vg, |
943 |
+ unsigned int pin) |
944 |
+ { |
945 |
+@@ -856,7 +857,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
946 |
+ unsigned long flags; |
947 |
+ int i; |
948 |
+ |
949 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
950 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
951 |
+ |
952 |
+ for (i = 0; i < group.npins; i++) { |
953 |
+ void __iomem *padcfg0; |
954 |
+@@ -876,7 +877,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
955 |
+ writel(value, padcfg0); |
956 |
+ } |
957 |
+ |
958 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
959 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
960 |
+ } |
961 |
+ |
962 |
+ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
963 |
+@@ -886,7 +887,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
964 |
+ unsigned long flags; |
965 |
+ int i; |
966 |
+ |
967 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
968 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
969 |
+ |
970 |
+ for (i = 0; i < group.npins; i++) { |
971 |
+ void __iomem *padcfg0; |
972 |
+@@ -906,7 +907,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
973 |
+ writel(value, padcfg0); |
974 |
+ } |
975 |
+ |
976 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
977 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
978 |
+ } |
979 |
+ |
980 |
+ static int byt_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, |
981 |
+@@ -955,11 +956,11 @@ static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned int offset) |
982 |
+ unsigned long flags; |
983 |
+ u32 value; |
984 |
+ |
985 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
986 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
987 |
+ value = readl(reg); |
988 |
+ value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); |
989 |
+ writel(value, reg); |
990 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
991 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
992 |
+ } |
993 |
+ |
994 |
+ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
995 |
+@@ -971,7 +972,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
996 |
+ u32 value, gpio_mux; |
997 |
+ unsigned long flags; |
998 |
+ |
999 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1000 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1001 |
+ |
1002 |
+ /* |
1003 |
+ * In most cases, func pin mux 000 means GPIO function. |
1004 |
+@@ -993,7 +994,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
1005 |
+ "pin %u forcibly re-configured as GPIO\n", offset); |
1006 |
+ } |
1007 |
+ |
1008 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1009 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1010 |
+ |
1011 |
+ pm_runtime_get(&vg->pdev->dev); |
1012 |
+ |
1013 |
+@@ -1021,7 +1022,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
1014 |
+ unsigned long flags; |
1015 |
+ u32 value; |
1016 |
+ |
1017 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1018 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1019 |
+ |
1020 |
+ value = readl(val_reg); |
1021 |
+ value &= ~BYT_DIR_MASK; |
1022 |
+@@ -1038,7 +1039,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
1023 |
+ "Potential Error: Setting GPIO with direct_irq_en to output"); |
1024 |
+ writel(value, val_reg); |
1025 |
+ |
1026 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1027 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1028 |
+ |
1029 |
+ return 0; |
1030 |
+ } |
1031 |
+@@ -1107,11 +1108,11 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
1032 |
+ u32 conf, pull, val, debounce; |
1033 |
+ u16 arg = 0; |
1034 |
+ |
1035 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1036 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1037 |
+ conf = readl(conf_reg); |
1038 |
+ pull = conf & BYT_PULL_ASSIGN_MASK; |
1039 |
+ val = readl(val_reg); |
1040 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1041 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1042 |
+ |
1043 |
+ switch (param) { |
1044 |
+ case PIN_CONFIG_BIAS_DISABLE: |
1045 |
+@@ -1138,9 +1139,9 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
1046 |
+ if (!(conf & BYT_DEBOUNCE_EN)) |
1047 |
+ return -EINVAL; |
1048 |
+ |
1049 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1050 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1051 |
+ debounce = readl(db_reg); |
1052 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1053 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1054 |
+ |
1055 |
+ switch (debounce & BYT_DEBOUNCE_PULSE_MASK) { |
1056 |
+ case BYT_DEBOUNCE_PULSE_375US: |
1057 |
+@@ -1192,7 +1193,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
1058 |
+ u32 conf, val, debounce; |
1059 |
+ int i, ret = 0; |
1060 |
+ |
1061 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1062 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1063 |
+ |
1064 |
+ conf = readl(conf_reg); |
1065 |
+ val = readl(val_reg); |
1066 |
+@@ -1300,7 +1301,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
1067 |
+ if (!ret) |
1068 |
+ writel(conf, conf_reg); |
1069 |
+ |
1070 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1071 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1072 |
+ |
1073 |
+ return ret; |
1074 |
+ } |
1075 |
+@@ -1325,9 +1326,9 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) |
1076 |
+ unsigned long flags; |
1077 |
+ u32 val; |
1078 |
+ |
1079 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1080 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1081 |
+ val = readl(reg); |
1082 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1083 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1084 |
+ |
1085 |
+ return !!(val & BYT_LEVEL); |
1086 |
+ } |
1087 |
+@@ -1342,13 +1343,13 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
1088 |
+ if (!reg) |
1089 |
+ return; |
1090 |
+ |
1091 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1092 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1093 |
+ old_val = readl(reg); |
1094 |
+ if (value) |
1095 |
+ writel(old_val | BYT_LEVEL, reg); |
1096 |
+ else |
1097 |
+ writel(old_val & ~BYT_LEVEL, reg); |
1098 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1099 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1100 |
+ } |
1101 |
+ |
1102 |
+ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
1103 |
+@@ -1361,9 +1362,9 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
1104 |
+ if (!reg) |
1105 |
+ return -EINVAL; |
1106 |
+ |
1107 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1108 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1109 |
+ value = readl(reg); |
1110 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1111 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1112 |
+ |
1113 |
+ if (!(value & BYT_OUTPUT_EN)) |
1114 |
+ return GPIOF_DIR_OUT; |
1115 |
+@@ -1406,14 +1407,14 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
1116 |
+ const char *label; |
1117 |
+ unsigned int pin; |
1118 |
+ |
1119 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1120 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1121 |
+ pin = vg->soc_data->pins[i].number; |
1122 |
+ reg = byt_gpio_reg(vg, pin, BYT_CONF0_REG); |
1123 |
+ if (!reg) { |
1124 |
+ seq_printf(s, |
1125 |
+ "Could not retrieve pin %i conf0 reg\n", |
1126 |
+ pin); |
1127 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1128 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1129 |
+ continue; |
1130 |
+ } |
1131 |
+ conf0 = readl(reg); |
1132 |
+@@ -1422,11 +1423,11 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
1133 |
+ if (!reg) { |
1134 |
+ seq_printf(s, |
1135 |
+ "Could not retrieve pin %i val reg\n", pin); |
1136 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1137 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1138 |
+ continue; |
1139 |
+ } |
1140 |
+ val = readl(reg); |
1141 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1142 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1143 |
+ |
1144 |
+ comm = byt_get_community(vg, pin); |
1145 |
+ if (!comm) { |
1146 |
+@@ -1510,9 +1511,9 @@ static void byt_irq_ack(struct irq_data *d) |
1147 |
+ if (!reg) |
1148 |
+ return; |
1149 |
+ |
1150 |
+- raw_spin_lock(&vg->lock); |
1151 |
++ raw_spin_lock(&byt_lock); |
1152 |
+ writel(BIT(offset % 32), reg); |
1153 |
+- raw_spin_unlock(&vg->lock); |
1154 |
++ raw_spin_unlock(&byt_lock); |
1155 |
+ } |
1156 |
+ |
1157 |
+ static void byt_irq_mask(struct irq_data *d) |
1158 |
+@@ -1536,7 +1537,7 @@ static void byt_irq_unmask(struct irq_data *d) |
1159 |
+ if (!reg) |
1160 |
+ return; |
1161 |
+ |
1162 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1163 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1164 |
+ value = readl(reg); |
1165 |
+ |
1166 |
+ switch (irqd_get_trigger_type(d)) { |
1167 |
+@@ -1557,7 +1558,7 @@ static void byt_irq_unmask(struct irq_data *d) |
1168 |
+ |
1169 |
+ writel(value, reg); |
1170 |
+ |
1171 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1172 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1173 |
+ } |
1174 |
+ |
1175 |
+ static int byt_irq_type(struct irq_data *d, unsigned int type) |
1176 |
+@@ -1571,7 +1572,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
1177 |
+ if (!reg || offset >= vg->chip.ngpio) |
1178 |
+ return -EINVAL; |
1179 |
+ |
1180 |
+- raw_spin_lock_irqsave(&vg->lock, flags); |
1181 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1182 |
+ value = readl(reg); |
1183 |
+ |
1184 |
+ WARN(value & BYT_DIRECT_IRQ_EN, |
1185 |
+@@ -1593,7 +1594,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
1186 |
+ else if (type & IRQ_TYPE_LEVEL_MASK) |
1187 |
+ irq_set_handler_locked(d, handle_level_irq); |
1188 |
+ |
1189 |
+- raw_spin_unlock_irqrestore(&vg->lock, flags); |
1190 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1191 |
+ |
1192 |
+ return 0; |
1193 |
+ } |
1194 |
+@@ -1629,9 +1630,9 @@ static void byt_gpio_irq_handler(struct irq_desc *desc) |
1195 |
+ continue; |
1196 |
+ } |
1197 |
+ |
1198 |
+- raw_spin_lock(&vg->lock); |
1199 |
++ raw_spin_lock(&byt_lock); |
1200 |
+ pending = readl(reg); |
1201 |
+- raw_spin_unlock(&vg->lock); |
1202 |
++ raw_spin_unlock(&byt_lock); |
1203 |
+ for_each_set_bit(pin, &pending, 32) { |
1204 |
+ virq = irq_find_mapping(vg->chip.irqdomain, base + pin); |
1205 |
+ generic_handle_irq(virq); |
1206 |
+@@ -1833,8 +1834,6 @@ static int byt_pinctrl_probe(struct platform_device *pdev) |
1207 |
+ return PTR_ERR(vg->pctl_dev); |
1208 |
+ } |
1209 |
+ |
1210 |
+- raw_spin_lock_init(&vg->lock); |
1211 |
+- |
1212 |
+ ret = byt_gpio_probe(vg); |
1213 |
+ if (ret) |
1214 |
+ return ret; |
1215 |
+@@ -1850,8 +1849,11 @@ static int byt_gpio_suspend(struct device *dev) |
1216 |
+ { |
1217 |
+ struct platform_device *pdev = to_platform_device(dev); |
1218 |
+ struct byt_gpio *vg = platform_get_drvdata(pdev); |
1219 |
++ unsigned long flags; |
1220 |
+ int i; |
1221 |
+ |
1222 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1223 |
++ |
1224 |
+ for (i = 0; i < vg->soc_data->npins; i++) { |
1225 |
+ void __iomem *reg; |
1226 |
+ u32 value; |
1227 |
+@@ -1872,6 +1874,7 @@ static int byt_gpio_suspend(struct device *dev) |
1228 |
+ vg->saved_context[i].val = value; |
1229 |
+ } |
1230 |
+ |
1231 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1232 |
+ return 0; |
1233 |
+ } |
1234 |
+ |
1235 |
+@@ -1879,8 +1882,11 @@ static int byt_gpio_resume(struct device *dev) |
1236 |
+ { |
1237 |
+ struct platform_device *pdev = to_platform_device(dev); |
1238 |
+ struct byt_gpio *vg = platform_get_drvdata(pdev); |
1239 |
++ unsigned long flags; |
1240 |
+ int i; |
1241 |
+ |
1242 |
++ raw_spin_lock_irqsave(&byt_lock, flags); |
1243 |
++ |
1244 |
+ for (i = 0; i < vg->soc_data->npins; i++) { |
1245 |
+ void __iomem *reg; |
1246 |
+ u32 value; |
1247 |
+@@ -1918,6 +1924,7 @@ static int byt_gpio_resume(struct device *dev) |
1248 |
+ } |
1249 |
+ } |
1250 |
+ |
1251 |
++ raw_spin_unlock_irqrestore(&byt_lock, flags); |
1252 |
+ return 0; |
1253 |
+ } |
1254 |
+ #endif |
1255 |
+diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c |
1256 |
+index c64903a5978f..b818f65480c1 100644 |
1257 |
+--- a/drivers/ptp/ptp_clock.c |
1258 |
++++ b/drivers/ptp/ptp_clock.c |
1259 |
+@@ -175,9 +175,9 @@ static struct posix_clock_operations ptp_clock_ops = { |
1260 |
+ .read = ptp_read, |
1261 |
+ }; |
1262 |
+ |
1263 |
+-static void delete_ptp_clock(struct posix_clock *pc) |
1264 |
++static void ptp_clock_release(struct device *dev) |
1265 |
+ { |
1266 |
+- struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
1267 |
++ struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); |
1268 |
+ |
1269 |
+ mutex_destroy(&ptp->tsevq_mux); |
1270 |
+ mutex_destroy(&ptp->pincfg_mux); |
1271 |
+@@ -222,7 +222,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
1272 |
+ } |
1273 |
+ |
1274 |
+ ptp->clock.ops = ptp_clock_ops; |
1275 |
+- ptp->clock.release = delete_ptp_clock; |
1276 |
+ ptp->info = info; |
1277 |
+ ptp->devid = MKDEV(major, index); |
1278 |
+ ptp->index = index; |
1279 |
+@@ -249,15 +248,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
1280 |
+ if (err) |
1281 |
+ goto no_pin_groups; |
1282 |
+ |
1283 |
+- /* Create a new device in our class. */ |
1284 |
+- ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid, |
1285 |
+- ptp, ptp->pin_attr_groups, |
1286 |
+- "ptp%d", ptp->index); |
1287 |
+- if (IS_ERR(ptp->dev)) { |
1288 |
+- err = PTR_ERR(ptp->dev); |
1289 |
+- goto no_device; |
1290 |
+- } |
1291 |
+- |
1292 |
+ /* Register a new PPS source. */ |
1293 |
+ if (info->pps) { |
1294 |
+ struct pps_source_info pps; |
1295 |
+@@ -273,8 +263,18 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, |
1296 |
+ } |
1297 |
+ } |
1298 |
+ |
1299 |
+- /* Create a posix clock. */ |
1300 |
+- err = posix_clock_register(&ptp->clock, ptp->devid); |
1301 |
++ /* Initialize a new device of our class in our clock structure. */ |
1302 |
++ device_initialize(&ptp->dev); |
1303 |
++ ptp->dev.devt = ptp->devid; |
1304 |
++ ptp->dev.class = ptp_class; |
1305 |
++ ptp->dev.parent = parent; |
1306 |
++ ptp->dev.groups = ptp->pin_attr_groups; |
1307 |
++ ptp->dev.release = ptp_clock_release; |
1308 |
++ dev_set_drvdata(&ptp->dev, ptp); |
1309 |
++ dev_set_name(&ptp->dev, "ptp%d", ptp->index); |
1310 |
++ |
1311 |
++ /* Create a posix clock and link it to the device. */ |
1312 |
++ err = posix_clock_register(&ptp->clock, &ptp->dev); |
1313 |
+ if (err) { |
1314 |
+ pr_err("failed to create posix clock\n"); |
1315 |
+ goto no_clock; |
1316 |
+@@ -286,8 +286,6 @@ no_clock: |
1317 |
+ if (ptp->pps_source) |
1318 |
+ pps_unregister_source(ptp->pps_source); |
1319 |
+ no_pps: |
1320 |
+- device_destroy(ptp_class, ptp->devid); |
1321 |
+-no_device: |
1322 |
+ ptp_cleanup_pin_groups(ptp); |
1323 |
+ no_pin_groups: |
1324 |
+ if (ptp->kworker) |
1325 |
+@@ -317,7 +315,6 @@ int ptp_clock_unregister(struct ptp_clock *ptp) |
1326 |
+ if (ptp->pps_source) |
1327 |
+ pps_unregister_source(ptp->pps_source); |
1328 |
+ |
1329 |
+- device_destroy(ptp_class, ptp->devid); |
1330 |
+ ptp_cleanup_pin_groups(ptp); |
1331 |
+ |
1332 |
+ posix_clock_unregister(&ptp->clock); |
1333 |
+diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h |
1334 |
+index b86f1bfecd6f..45ed9e172bb4 100644 |
1335 |
+--- a/drivers/ptp/ptp_private.h |
1336 |
++++ b/drivers/ptp/ptp_private.h |
1337 |
+@@ -41,7 +41,7 @@ struct timestamp_event_queue { |
1338 |
+ |
1339 |
+ struct ptp_clock { |
1340 |
+ struct posix_clock clock; |
1341 |
+- struct device *dev; |
1342 |
++ struct device dev; |
1343 |
+ struct ptp_clock_info *info; |
1344 |
+ dev_t devid; |
1345 |
+ int index; /* index into clocks.map */ |
1346 |
+diff --git a/drivers/s390/crypto/zcrypt_error.h b/drivers/s390/crypto/zcrypt_error.h |
1347 |
+index 9499cd3a05f8..02a936db0092 100644 |
1348 |
+--- a/drivers/s390/crypto/zcrypt_error.h |
1349 |
++++ b/drivers/s390/crypto/zcrypt_error.h |
1350 |
+@@ -75,6 +75,7 @@ struct error_hdr { |
1351 |
+ #define REP82_ERROR_EVEN_MOD_IN_OPND 0x85 |
1352 |
+ #define REP82_ERROR_RESERVED_FIELD 0x88 |
1353 |
+ #define REP82_ERROR_INVALID_DOMAIN_PENDING 0x8A |
1354 |
++#define REP82_ERROR_FILTERED_BY_HYPERVISOR 0x8B |
1355 |
+ #define REP82_ERROR_TRANSPORT_FAIL 0x90 |
1356 |
+ #define REP82_ERROR_PACKET_TRUNCATED 0xA0 |
1357 |
+ #define REP82_ERROR_ZERO_BUFFER_LEN 0xB0 |
1358 |
+@@ -105,6 +106,7 @@ static inline int convert_error(struct zcrypt_queue *zq, |
1359 |
+ case REP82_ERROR_INVALID_DOMAIN_PRECHECK: |
1360 |
+ case REP82_ERROR_INVALID_DOMAIN_PENDING: |
1361 |
+ case REP82_ERROR_INVALID_SPECIAL_CMD: |
1362 |
++ case REP82_ERROR_FILTERED_BY_HYPERVISOR: |
1363 |
+ // REP88_ERROR_INVALID_KEY // '82' CEX2A |
1364 |
+ // REP88_ERROR_OPERAND // '84' CEX2A |
1365 |
+ // REP88_ERROR_OPERAND_EVEN_MOD // '85' CEX2A |
1366 |
+diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c |
1367 |
+index 21377ac71168..79b0b4eece19 100644 |
1368 |
+--- a/drivers/scsi/NCR5380.c |
1369 |
++++ b/drivers/scsi/NCR5380.c |
1370 |
+@@ -129,6 +129,9 @@ |
1371 |
+ #define NCR5380_release_dma_irq(x) |
1372 |
+ #endif |
1373 |
+ |
1374 |
++static unsigned int disconnect_mask = ~0; |
1375 |
++module_param(disconnect_mask, int, 0444); |
1376 |
++ |
1377 |
+ static int do_abort(struct Scsi_Host *); |
1378 |
+ static void do_reset(struct Scsi_Host *); |
1379 |
+ static void bus_reset_cleanup(struct Scsi_Host *); |
1380 |
+@@ -946,7 +949,8 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) |
1381 |
+ int err; |
1382 |
+ bool ret = true; |
1383 |
+ bool can_disconnect = instance->irq != NO_IRQ && |
1384 |
+- cmd->cmnd[0] != REQUEST_SENSE; |
1385 |
++ cmd->cmnd[0] != REQUEST_SENSE && |
1386 |
++ (disconnect_mask & BIT(scmd_id(cmd))); |
1387 |
+ |
1388 |
+ NCR5380_dprint(NDEBUG_ARBITRATION, instance); |
1389 |
+ dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n", |
1390 |
+diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c |
1391 |
+index 89f5154c40b6..764c46d7333e 100644 |
1392 |
+--- a/drivers/scsi/atari_scsi.c |
1393 |
++++ b/drivers/scsi/atari_scsi.c |
1394 |
+@@ -742,7 +742,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev) |
1395 |
+ atari_scsi_template.sg_tablesize = SG_ALL; |
1396 |
+ } else { |
1397 |
+ atari_scsi_template.can_queue = 1; |
1398 |
+- atari_scsi_template.sg_tablesize = SG_NONE; |
1399 |
++ atari_scsi_template.sg_tablesize = 1; |
1400 |
+ } |
1401 |
+ |
1402 |
+ if (setup_can_queue > 0) |
1403 |
+@@ -751,8 +751,8 @@ static int __init atari_scsi_probe(struct platform_device *pdev) |
1404 |
+ if (setup_cmd_per_lun > 0) |
1405 |
+ atari_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
1406 |
+ |
1407 |
+- /* Leave sg_tablesize at 0 on a Falcon! */ |
1408 |
+- if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize >= 0) |
1409 |
++ /* Don't increase sg_tablesize on Falcon! */ |
1410 |
++ if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize > 0) |
1411 |
+ atari_scsi_template.sg_tablesize = setup_sg_tablesize; |
1412 |
+ |
1413 |
+ if (setup_hostid >= 0) { |
1414 |
+diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c |
1415 |
+index be5ee2d37815..957767d38361 100644 |
1416 |
+--- a/drivers/scsi/csiostor/csio_lnode.c |
1417 |
++++ b/drivers/scsi/csiostor/csio_lnode.c |
1418 |
+@@ -301,6 +301,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1419 |
+ struct fc_fdmi_port_name *port_name; |
1420 |
+ uint8_t buf[64]; |
1421 |
+ uint8_t *fc4_type; |
1422 |
++ unsigned long flags; |
1423 |
+ |
1424 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1425 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi rhba cmd\n", |
1426 |
+@@ -377,13 +378,13 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1427 |
+ len = (uint32_t)(pld - (uint8_t *)cmd); |
1428 |
+ |
1429 |
+ /* Submit FDMI RPA request */ |
1430 |
+- spin_lock_irq(&hw->lock); |
1431 |
++ spin_lock_irqsave(&hw->lock, flags); |
1432 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_done, |
1433 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1434 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1435 |
+ csio_ln_dbg(ln, "Failed to issue fdmi rpa req\n"); |
1436 |
+ } |
1437 |
+- spin_unlock_irq(&hw->lock); |
1438 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1439 |
+ } |
1440 |
+ |
1441 |
+ /* |
1442 |
+@@ -404,6 +405,7 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1443 |
+ struct fc_fdmi_rpl *reg_pl; |
1444 |
+ struct fs_fdmi_attrs *attrib_blk; |
1445 |
+ uint8_t buf[64]; |
1446 |
++ unsigned long flags; |
1447 |
+ |
1448 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1449 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi dprt cmd\n", |
1450 |
+@@ -483,13 +485,13 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1451 |
+ attrib_blk->numattrs = htonl(numattrs); |
1452 |
+ |
1453 |
+ /* Submit FDMI RHBA request */ |
1454 |
+- spin_lock_irq(&hw->lock); |
1455 |
++ spin_lock_irqsave(&hw->lock, flags); |
1456 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_rhba_cbfn, |
1457 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1458 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1459 |
+ csio_ln_dbg(ln, "Failed to issue fdmi rhba req\n"); |
1460 |
+ } |
1461 |
+- spin_unlock_irq(&hw->lock); |
1462 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1463 |
+ } |
1464 |
+ |
1465 |
+ /* |
1466 |
+@@ -504,6 +506,7 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1467 |
+ void *cmd; |
1468 |
+ struct fc_fdmi_port_name *port_name; |
1469 |
+ uint32_t len; |
1470 |
++ unsigned long flags; |
1471 |
+ |
1472 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1473 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi dhba cmd\n", |
1474 |
+@@ -534,13 +537,13 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1475 |
+ len += sizeof(*port_name); |
1476 |
+ |
1477 |
+ /* Submit FDMI request */ |
1478 |
+- spin_lock_irq(&hw->lock); |
1479 |
++ spin_lock_irqsave(&hw->lock, flags); |
1480 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_dprt_cbfn, |
1481 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1482 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1483 |
+ csio_ln_dbg(ln, "Failed to issue fdmi dprt req\n"); |
1484 |
+ } |
1485 |
+- spin_unlock_irq(&hw->lock); |
1486 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1487 |
+ } |
1488 |
+ |
1489 |
+ /** |
1490 |
+diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c |
1491 |
+index 045207b5560e..7e3a77d3c6f0 100644 |
1492 |
+--- a/drivers/scsi/iscsi_tcp.c |
1493 |
++++ b/drivers/scsi/iscsi_tcp.c |
1494 |
+@@ -372,8 +372,16 @@ static int iscsi_sw_tcp_pdu_xmit(struct iscsi_task *task) |
1495 |
+ { |
1496 |
+ struct iscsi_conn *conn = task->conn; |
1497 |
+ unsigned int noreclaim_flag; |
1498 |
++ struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
1499 |
++ struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; |
1500 |
+ int rc = 0; |
1501 |
+ |
1502 |
++ if (!tcp_sw_conn->sock) { |
1503 |
++ iscsi_conn_printk(KERN_ERR, conn, |
1504 |
++ "Transport not bound to socket!\n"); |
1505 |
++ return -EINVAL; |
1506 |
++ } |
1507 |
++ |
1508 |
+ noreclaim_flag = memalloc_noreclaim_save(); |
1509 |
+ |
1510 |
+ while (iscsi_sw_tcp_xmit_qlen(conn)) { |
1511 |
+diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
1512 |
+index c851fd14ff3e..4c84c2ae1112 100644 |
1513 |
+--- a/drivers/scsi/lpfc/lpfc_els.c |
1514 |
++++ b/drivers/scsi/lpfc/lpfc_els.c |
1515 |
+@@ -4102,7 +4102,7 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
1516 |
+ mempool_free(mbox, phba->mbox_mem_pool); |
1517 |
+ } |
1518 |
+ out: |
1519 |
+- if (ndlp && NLP_CHK_NODE_ACT(ndlp)) { |
1520 |
++ if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { |
1521 |
+ spin_lock_irq(shost->host_lock); |
1522 |
+ ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI); |
1523 |
+ spin_unlock_irq(shost->host_lock); |
1524 |
+diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
1525 |
+index 3f88f3d79622..4a0889dd4c1d 100644 |
1526 |
+--- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
1527 |
++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
1528 |
+@@ -5220,9 +5220,14 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did) |
1529 |
+ /* If we've already received a PLOGI from this NPort |
1530 |
+ * we don't need to try to discover it again. |
1531 |
+ */ |
1532 |
+- if (ndlp->nlp_flag & NLP_RCV_PLOGI) |
1533 |
++ if (ndlp->nlp_flag & NLP_RCV_PLOGI && |
1534 |
++ !(ndlp->nlp_type & |
1535 |
++ (NLP_FCP_TARGET | NLP_NVME_TARGET))) |
1536 |
+ return NULL; |
1537 |
+ |
1538 |
++ ndlp->nlp_prev_state = ndlp->nlp_state; |
1539 |
++ lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); |
1540 |
++ |
1541 |
+ spin_lock_irq(shost->host_lock); |
1542 |
+ ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
1543 |
+ spin_unlock_irq(shost->host_lock); |
1544 |
+diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1545 |
+index 043bca6449cd..96411754aa43 100644 |
1546 |
+--- a/drivers/scsi/lpfc/lpfc_nportdisc.c |
1547 |
++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1548 |
+@@ -483,8 +483,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
1549 |
+ * single discovery thread, this will cause a huge delay in |
1550 |
+ * discovery. Also this will cause multiple state machines |
1551 |
+ * running in parallel for this node. |
1552 |
++ * This only applies to a fabric environment. |
1553 |
+ */ |
1554 |
+- if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) { |
1555 |
++ if ((ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) && |
1556 |
++ (vport->fc_flag & FC_FABRIC)) { |
1557 |
+ /* software abort outstanding PLOGI */ |
1558 |
+ lpfc_els_abort(phba, ndlp); |
1559 |
+ } |
1560 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
1561 |
+index d3bad0dbfaf7..d8e0ba68879c 100644 |
1562 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
1563 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
1564 |
+@@ -12689,13 +12689,19 @@ send_current_mbox: |
1565 |
+ phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
1566 |
+ /* Setting active mailbox pointer need to be in sync to flag clear */ |
1567 |
+ phba->sli.mbox_active = NULL; |
1568 |
++ if (bf_get(lpfc_trailer_consumed, mcqe)) |
1569 |
++ lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
1570 |
+ spin_unlock_irqrestore(&phba->hbalock, iflags); |
1571 |
+ /* Wake up worker thread to post the next pending mailbox command */ |
1572 |
+ lpfc_worker_wake_up(phba); |
1573 |
++ return workposted; |
1574 |
++ |
1575 |
+ out_no_mqe_complete: |
1576 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
1577 |
+ if (bf_get(lpfc_trailer_consumed, mcqe)) |
1578 |
+ lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
1579 |
+- return workposted; |
1580 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
1581 |
++ return false; |
1582 |
+ } |
1583 |
+ |
1584 |
+ /** |
1585 |
+@@ -17486,6 +17492,13 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) |
1586 |
+ static void |
1587 |
+ __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) |
1588 |
+ { |
1589 |
++ /* |
1590 |
++ * if the rpi value indicates a prior unreg has already |
1591 |
++ * been done, skip the unreg. |
1592 |
++ */ |
1593 |
++ if (rpi == LPFC_RPI_ALLOC_ERROR) |
1594 |
++ return; |
1595 |
++ |
1596 |
+ if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { |
1597 |
+ phba->sli4_hba.rpi_count--; |
1598 |
+ phba->sli4_hba.max_cfg_param.rpi_used--; |
1599 |
+diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c |
1600 |
+index 643321fc152d..b5050c2ede00 100644 |
1601 |
+--- a/drivers/scsi/mac_scsi.c |
1602 |
++++ b/drivers/scsi/mac_scsi.c |
1603 |
+@@ -429,7 +429,7 @@ static int __init mac_scsi_probe(struct platform_device *pdev) |
1604 |
+ mac_scsi_template.can_queue = setup_can_queue; |
1605 |
+ if (setup_cmd_per_lun > 0) |
1606 |
+ mac_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
1607 |
+- if (setup_sg_tablesize >= 0) |
1608 |
++ if (setup_sg_tablesize > 0) |
1609 |
+ mac_scsi_template.sg_tablesize = setup_sg_tablesize; |
1610 |
+ if (setup_hostid >= 0) |
1611 |
+ mac_scsi_template.this_id = setup_hostid & 7; |
1612 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1613 |
+index bdffb692bded..622dcf2984a9 100644 |
1614 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1615 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1616 |
+@@ -1502,7 +1502,8 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, |
1617 |
+ " for diag buffers, requested size(%d)\n", |
1618 |
+ ioc->name, __func__, request_data_sz); |
1619 |
+ mpt3sas_base_free_smid(ioc, smid); |
1620 |
+- return -ENOMEM; |
1621 |
++ rc = -ENOMEM; |
1622 |
++ goto out; |
1623 |
+ } |
1624 |
+ ioc->diag_buffer[buffer_type] = request_data; |
1625 |
+ ioc->diag_buffer_sz[buffer_type] = request_data_sz; |
1626 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
1627 |
+index 9edd61c063a1..df5f0bc29587 100644 |
1628 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
1629 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
1630 |
+@@ -2368,6 +2368,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
1631 |
+ pm8001_printk("task 0x%p done with io_status 0x%x" |
1632 |
+ " resp 0x%x stat 0x%x but aborted by upper layer!\n", |
1633 |
+ t, status, ts->resp, ts->stat)); |
1634 |
++ if (t->slow_task) |
1635 |
++ complete(&t->slow_task->completion); |
1636 |
+ pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1637 |
+ } else { |
1638 |
+ spin_unlock_irqrestore(&t->task_state_lock, flags); |
1639 |
+diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
1640 |
+index 92bc5b2d24ae..ac936b5ca74e 100644 |
1641 |
+--- a/drivers/scsi/scsi_debug.c |
1642 |
++++ b/drivers/scsi/scsi_debug.c |
1643 |
+@@ -4960,6 +4960,11 @@ static int __init scsi_debug_init(void) |
1644 |
+ return -EINVAL; |
1645 |
+ } |
1646 |
+ |
1647 |
++ if (sdebug_num_tgts < 0) { |
1648 |
++ pr_err("num_tgts must be >= 0\n"); |
1649 |
++ return -EINVAL; |
1650 |
++ } |
1651 |
++ |
1652 |
+ if (sdebug_guard > 1) { |
1653 |
+ pr_err("guard must be 0 or 1\n"); |
1654 |
+ return -EINVAL; |
1655 |
+diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c |
1656 |
+index 0ff083bbf5b1..617a60737590 100644 |
1657 |
+--- a/drivers/scsi/scsi_trace.c |
1658 |
++++ b/drivers/scsi/scsi_trace.c |
1659 |
+@@ -30,15 +30,18 @@ static const char * |
1660 |
+ scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) |
1661 |
+ { |
1662 |
+ const char *ret = trace_seq_buffer_ptr(p); |
1663 |
+- sector_t lba = 0, txlen = 0; |
1664 |
++ u32 lba = 0, txlen; |
1665 |
+ |
1666 |
+ lba |= ((cdb[1] & 0x1F) << 16); |
1667 |
+ lba |= (cdb[2] << 8); |
1668 |
+ lba |= cdb[3]; |
1669 |
+- txlen = cdb[4]; |
1670 |
++ /* |
1671 |
++ * From SBC-2: a TRANSFER LENGTH field set to zero specifies that 256 |
1672 |
++ * logical blocks shall be read (READ(6)) or written (WRITE(6)). |
1673 |
++ */ |
1674 |
++ txlen = cdb[4] ? cdb[4] : 256; |
1675 |
+ |
1676 |
+- trace_seq_printf(p, "lba=%llu txlen=%llu", |
1677 |
+- (unsigned long long)lba, (unsigned long long)txlen); |
1678 |
++ trace_seq_printf(p, "lba=%u txlen=%u", lba, txlen); |
1679 |
+ trace_seq_putc(p, 0); |
1680 |
+ |
1681 |
+ return ret; |
1682 |
+diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c |
1683 |
+index 9492638296c8..af8a7ef9c858 100644 |
1684 |
+--- a/drivers/scsi/sun3_scsi.c |
1685 |
++++ b/drivers/scsi/sun3_scsi.c |
1686 |
+@@ -498,7 +498,7 @@ static struct scsi_host_template sun3_scsi_template = { |
1687 |
+ .eh_host_reset_handler = sun3scsi_host_reset, |
1688 |
+ .can_queue = 16, |
1689 |
+ .this_id = 7, |
1690 |
+- .sg_tablesize = SG_NONE, |
1691 |
++ .sg_tablesize = 1, |
1692 |
+ .cmd_per_lun = 2, |
1693 |
+ .use_clustering = DISABLE_CLUSTERING, |
1694 |
+ .cmd_size = NCR5380_CMD_SIZE, |
1695 |
+@@ -520,7 +520,7 @@ static int __init sun3_scsi_probe(struct platform_device *pdev) |
1696 |
+ sun3_scsi_template.can_queue = setup_can_queue; |
1697 |
+ if (setup_cmd_per_lun > 0) |
1698 |
+ sun3_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
1699 |
+- if (setup_sg_tablesize >= 0) |
1700 |
++ if (setup_sg_tablesize > 0) |
1701 |
+ sun3_scsi_template.sg_tablesize = setup_sg_tablesize; |
1702 |
+ if (setup_hostid >= 0) |
1703 |
+ sun3_scsi_template.this_id = setup_hostid & 7; |
1704 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
1705 |
+index 07cae5ea608c..d25082e573e0 100644 |
1706 |
+--- a/drivers/scsi/ufs/ufshcd.c |
1707 |
++++ b/drivers/scsi/ufs/ufshcd.c |
1708 |
+@@ -2867,10 +2867,10 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba, |
1709 |
+ goto out_unlock; |
1710 |
+ } |
1711 |
+ |
1712 |
+- hba->dev_cmd.query.descriptor = NULL; |
1713 |
+ *buf_len = be16_to_cpu(response->upiu_res.length); |
1714 |
+ |
1715 |
+ out_unlock: |
1716 |
++ hba->dev_cmd.query.descriptor = NULL; |
1717 |
+ mutex_unlock(&hba->dev_cmd.lock); |
1718 |
+ out: |
1719 |
+ ufshcd_release(hba); |
1720 |
+@@ -3684,15 +3684,24 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba) |
1721 |
+ ktime_to_us(ktime_sub(ktime_get(), start)), ret); |
1722 |
+ |
1723 |
+ if (ret) { |
1724 |
++ int err; |
1725 |
++ |
1726 |
+ dev_err(hba->dev, "%s: hibern8 enter failed. ret = %d\n", |
1727 |
+ __func__, ret); |
1728 |
+ |
1729 |
+ /* |
1730 |
+- * If link recovery fails then return error so that caller |
1731 |
+- * don't retry the hibern8 enter again. |
1732 |
++ * If link recovery fails then return error code returned from |
1733 |
++ * ufshcd_link_recovery(). |
1734 |
++ * If link recovery succeeds then return -EAGAIN to attempt |
1735 |
++ * hibern8 enter retry again. |
1736 |
+ */ |
1737 |
+- if (ufshcd_link_recovery(hba)) |
1738 |
+- ret = -ENOLINK; |
1739 |
++ err = ufshcd_link_recovery(hba); |
1740 |
++ if (err) { |
1741 |
++ dev_err(hba->dev, "%s: link recovery failed", __func__); |
1742 |
++ ret = err; |
1743 |
++ } else { |
1744 |
++ ret = -EAGAIN; |
1745 |
++ } |
1746 |
+ } else |
1747 |
+ ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER, |
1748 |
+ POST_CHANGE); |
1749 |
+@@ -3706,7 +3715,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba) |
1750 |
+ |
1751 |
+ for (retries = UIC_HIBERN8_ENTER_RETRIES; retries > 0; retries--) { |
1752 |
+ ret = __ufshcd_uic_hibern8_enter(hba); |
1753 |
+- if (!ret || ret == -ENOLINK) |
1754 |
++ if (!ret) |
1755 |
+ goto out; |
1756 |
+ } |
1757 |
+ out: |
1758 |
+diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
1759 |
+index 8f2e97857e8b..8b79e36fab21 100644 |
1760 |
+--- a/drivers/spi/spi-fsl-spi.c |
1761 |
++++ b/drivers/spi/spi-fsl-spi.c |
1762 |
+@@ -832,9 +832,9 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
1763 |
+ if (ret) |
1764 |
+ goto err; |
1765 |
+ |
1766 |
+- irq = irq_of_parse_and_map(np, 0); |
1767 |
+- if (!irq) { |
1768 |
+- ret = -EINVAL; |
1769 |
++ irq = platform_get_irq(ofdev, 0); |
1770 |
++ if (irq < 0) { |
1771 |
++ ret = irq; |
1772 |
+ goto err; |
1773 |
+ } |
1774 |
+ |
1775 |
+@@ -847,7 +847,6 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
1776 |
+ return 0; |
1777 |
+ |
1778 |
+ err: |
1779 |
+- irq_dispose_mapping(irq); |
1780 |
+ if (type == TYPE_FSL) |
1781 |
+ of_fsl_spi_free_chipselects(dev); |
1782 |
+ return ret; |
1783 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
1784 |
+index fb7bd422e2e1..21ce92ee1652 100644 |
1785 |
+--- a/drivers/target/iscsi/iscsi_target.c |
1786 |
++++ b/drivers/target/iscsi/iscsi_target.c |
1787 |
+@@ -1158,7 +1158,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
1788 |
+ hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length, |
1789 |
+ conn->cid); |
1790 |
+ |
1791 |
+- target_get_sess_cmd(&cmd->se_cmd, true); |
1792 |
++ if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
1793 |
++ return iscsit_add_reject_cmd(cmd, |
1794 |
++ ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
1795 |
+ |
1796 |
+ cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, |
1797 |
+ scsilun_to_int(&hdr->lun)); |
1798 |
+@@ -2004,7 +2006,9 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
1799 |
+ conn->sess->se_sess, 0, DMA_NONE, |
1800 |
+ TCM_SIMPLE_TAG, cmd->sense_buffer + 2); |
1801 |
+ |
1802 |
+- target_get_sess_cmd(&cmd->se_cmd, true); |
1803 |
++ if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
1804 |
++ return iscsit_add_reject_cmd(cmd, |
1805 |
++ ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
1806 |
+ |
1807 |
+ /* |
1808 |
+ * TASK_REASSIGN for ERL=2 / connection stays inside of |
1809 |
+@@ -4236,6 +4240,8 @@ int iscsit_close_connection( |
1810 |
+ * must wait until they have completed. |
1811 |
+ */ |
1812 |
+ iscsit_check_conn_usage_count(conn); |
1813 |
++ target_sess_cmd_list_set_waiting(sess->se_sess); |
1814 |
++ target_wait_for_sess_cmds(sess->se_sess); |
1815 |
+ |
1816 |
+ ahash_request_free(conn->conn_tx_hash); |
1817 |
+ if (conn->conn_rx_hash) { |
1818 |
+diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c |
1819 |
+index e2fa3a3bc81d..b6bf605fa5c1 100644 |
1820 |
+--- a/drivers/target/iscsi/iscsi_target_auth.c |
1821 |
++++ b/drivers/target/iscsi/iscsi_target_auth.c |
1822 |
+@@ -78,7 +78,7 @@ static int chap_check_algorithm(const char *a_str) |
1823 |
+ if (!token) |
1824 |
+ goto out; |
1825 |
+ |
1826 |
+- if (!strncmp(token, "5", 1)) { |
1827 |
++ if (!strcmp(token, "5")) { |
1828 |
+ pr_debug("Selected MD5 Algorithm\n"); |
1829 |
+ kfree(orig); |
1830 |
+ return CHAP_DIGEST_MD5; |
1831 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
1832 |
+index 9ee41ba0e55b..367ce812743e 100644 |
1833 |
+--- a/drivers/tty/serial/atmel_serial.c |
1834 |
++++ b/drivers/tty/serial/atmel_serial.c |
1835 |
+@@ -2183,27 +2183,6 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
1836 |
+ mode |= ATMEL_US_USMODE_NORMAL; |
1837 |
+ } |
1838 |
+ |
1839 |
+- /* set the mode, clock divisor, parity, stop bits and data size */ |
1840 |
+- atmel_uart_writel(port, ATMEL_US_MR, mode); |
1841 |
+- |
1842 |
+- /* |
1843 |
+- * when switching the mode, set the RTS line state according to the |
1844 |
+- * new mode, otherwise keep the former state |
1845 |
+- */ |
1846 |
+- if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
1847 |
+- unsigned int rts_state; |
1848 |
+- |
1849 |
+- if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
1850 |
+- /* let the hardware control the RTS line */ |
1851 |
+- rts_state = ATMEL_US_RTSDIS; |
1852 |
+- } else { |
1853 |
+- /* force RTS line to low level */ |
1854 |
+- rts_state = ATMEL_US_RTSEN; |
1855 |
+- } |
1856 |
+- |
1857 |
+- atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
1858 |
+- } |
1859 |
+- |
1860 |
+ /* |
1861 |
+ * Set the baud rate: |
1862 |
+ * Fractional baudrate allows to setup output frequency more |
1863 |
+@@ -2229,6 +2208,28 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
1864 |
+ quot = cd | fp << ATMEL_US_FP_OFFSET; |
1865 |
+ |
1866 |
+ atmel_uart_writel(port, ATMEL_US_BRGR, quot); |
1867 |
++ |
1868 |
++ /* set the mode, clock divisor, parity, stop bits and data size */ |
1869 |
++ atmel_uart_writel(port, ATMEL_US_MR, mode); |
1870 |
++ |
1871 |
++ /* |
1872 |
++ * when switching the mode, set the RTS line state according to the |
1873 |
++ * new mode, otherwise keep the former state |
1874 |
++ */ |
1875 |
++ if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
1876 |
++ unsigned int rts_state; |
1877 |
++ |
1878 |
++ if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
1879 |
++ /* let the hardware control the RTS line */ |
1880 |
++ rts_state = ATMEL_US_RTSDIS; |
1881 |
++ } else { |
1882 |
++ /* force RTS line to low level */ |
1883 |
++ rts_state = ATMEL_US_RTSEN; |
1884 |
++ } |
1885 |
++ |
1886 |
++ atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
1887 |
++ } |
1888 |
++ |
1889 |
+ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
1890 |
+ atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
1891 |
+ |
1892 |
+diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c |
1893 |
+index 491de830b8d9..6391dc5b0ebe 100644 |
1894 |
+--- a/drivers/vhost/vsock.c |
1895 |
++++ b/drivers/vhost/vsock.c |
1896 |
+@@ -436,7 +436,9 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) |
1897 |
+ virtio_transport_deliver_tap_pkt(pkt); |
1898 |
+ |
1899 |
+ /* Only accept correctly addressed packets */ |
1900 |
+- if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid) |
1901 |
++ if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid && |
1902 |
++ le64_to_cpu(pkt->hdr.dst_cid) == |
1903 |
++ vhost_transport_get_local_cid()) |
1904 |
+ virtio_transport_recv_pkt(pkt); |
1905 |
+ else |
1906 |
+ virtio_transport_free_pkt(pkt); |
1907 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1908 |
+index c2920cbfa3bf..a91b8404d3dc 100644 |
1909 |
+--- a/fs/ext4/inode.c |
1910 |
++++ b/fs/ext4/inode.c |
1911 |
+@@ -3796,7 +3796,13 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) |
1912 |
+ * writes & truncates and since we take care of writing back page cache, |
1913 |
+ * we are protected against page writeback as well. |
1914 |
+ */ |
1915 |
+- inode_lock_shared(inode); |
1916 |
++ if (iocb->ki_flags & IOCB_NOWAIT) { |
1917 |
++ if (!inode_trylock_shared(inode)) |
1918 |
++ return -EAGAIN; |
1919 |
++ } else { |
1920 |
++ inode_lock_shared(inode); |
1921 |
++ } |
1922 |
++ |
1923 |
+ ret = filemap_write_and_wait_range(mapping, iocb->ki_pos, |
1924 |
+ iocb->ki_pos + count - 1); |
1925 |
+ if (ret) |
1926 |
+diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c |
1927 |
+index b80e7db3b55b..b13383948fca 100644 |
1928 |
+--- a/fs/f2fs/namei.c |
1929 |
++++ b/fs/f2fs/namei.c |
1930 |
+@@ -862,7 +862,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1931 |
+ if (!old_dir_entry || whiteout) |
1932 |
+ file_lost_pino(old_inode); |
1933 |
+ else |
1934 |
+- F2FS_I(old_inode)->i_pino = new_dir->i_ino; |
1935 |
++ /* adjust dir's i_pino to pass fsck check */ |
1936 |
++ f2fs_i_pino_write(old_inode, new_dir->i_ino); |
1937 |
+ up_write(&F2FS_I(old_inode)->i_sem); |
1938 |
+ |
1939 |
+ old_inode->i_ctime = current_time(old_inode); |
1940 |
+@@ -1027,7 +1028,11 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, |
1941 |
+ f2fs_set_link(old_dir, old_entry, old_page, new_inode); |
1942 |
+ |
1943 |
+ down_write(&F2FS_I(old_inode)->i_sem); |
1944 |
+- file_lost_pino(old_inode); |
1945 |
++ if (!old_dir_entry) |
1946 |
++ file_lost_pino(old_inode); |
1947 |
++ else |
1948 |
++ /* adjust dir's i_pino to pass fsck check */ |
1949 |
++ f2fs_i_pino_write(old_inode, new_dir->i_ino); |
1950 |
+ up_write(&F2FS_I(old_inode)->i_sem); |
1951 |
+ |
1952 |
+ old_dir->i_ctime = current_time(old_dir); |
1953 |
+@@ -1042,7 +1047,11 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, |
1954 |
+ f2fs_set_link(new_dir, new_entry, new_page, old_inode); |
1955 |
+ |
1956 |
+ down_write(&F2FS_I(new_inode)->i_sem); |
1957 |
+- file_lost_pino(new_inode); |
1958 |
++ if (!new_dir_entry) |
1959 |
++ file_lost_pino(new_inode); |
1960 |
++ else |
1961 |
++ /* adjust dir's i_pino to pass fsck check */ |
1962 |
++ f2fs_i_pino_write(new_inode, old_dir->i_ino); |
1963 |
+ up_write(&F2FS_I(new_inode)->i_sem); |
1964 |
+ |
1965 |
+ new_dir->i_ctime = current_time(new_dir); |
1966 |
+diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c |
1967 |
+index 0567b17a970c..7dd613392592 100644 |
1968 |
+--- a/fs/jbd2/commit.c |
1969 |
++++ b/fs/jbd2/commit.c |
1970 |
+@@ -726,7 +726,6 @@ start_journal_io: |
1971 |
+ submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); |
1972 |
+ } |
1973 |
+ cond_resched(); |
1974 |
+- stats.run.rs_blocks_logged += bufs; |
1975 |
+ |
1976 |
+ /* Force a new descriptor to be generated next |
1977 |
+ time round the loop. */ |
1978 |
+@@ -813,6 +812,7 @@ start_journal_io: |
1979 |
+ if (unlikely(!buffer_uptodate(bh))) |
1980 |
+ err = -EIO; |
1981 |
+ jbd2_unfile_log_bh(bh); |
1982 |
++ stats.run.rs_blocks_logged++; |
1983 |
+ |
1984 |
+ /* |
1985 |
+ * The list contains temporary buffer heads created by |
1986 |
+@@ -858,6 +858,7 @@ start_journal_io: |
1987 |
+ BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); |
1988 |
+ clear_buffer_jwrite(bh); |
1989 |
+ jbd2_unfile_log_bh(bh); |
1990 |
++ stats.run.rs_blocks_logged++; |
1991 |
+ __brelse(bh); /* One for getblk */ |
1992 |
+ /* AKPM: bforget here */ |
1993 |
+ } |
1994 |
+@@ -879,6 +880,7 @@ start_journal_io: |
1995 |
+ } |
1996 |
+ if (cbh) |
1997 |
+ err = journal_wait_on_commit_record(journal, cbh); |
1998 |
++ stats.run.rs_blocks_logged++; |
1999 |
+ if (jbd2_has_feature_async_commit(journal) && |
2000 |
+ journal->j_flags & JBD2_BARRIER) { |
2001 |
+ blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); |
2002 |
+diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c |
2003 |
+index 917fadca8a7b..b73b78771915 100644 |
2004 |
+--- a/fs/ocfs2/acl.c |
2005 |
++++ b/fs/ocfs2/acl.c |
2006 |
+@@ -335,8 +335,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh) |
2007 |
+ down_read(&OCFS2_I(inode)->ip_xattr_sem); |
2008 |
+ acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh); |
2009 |
+ up_read(&OCFS2_I(inode)->ip_xattr_sem); |
2010 |
+- if (IS_ERR(acl) || !acl) |
2011 |
+- return PTR_ERR(acl); |
2012 |
++ if (IS_ERR_OR_NULL(acl)) |
2013 |
++ return PTR_ERR_OR_ZERO(acl); |
2014 |
+ ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
2015 |
+ if (ret) |
2016 |
+ return ret; |
2017 |
+diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
2018 |
+index 3254c90fd899..3fdbdd29702b 100644 |
2019 |
+--- a/fs/quota/dquot.c |
2020 |
++++ b/fs/quota/dquot.c |
2021 |
+@@ -2849,68 +2849,73 @@ EXPORT_SYMBOL(dquot_quotactl_sysfile_ops); |
2022 |
+ static int do_proc_dqstats(struct ctl_table *table, int write, |
2023 |
+ void __user *buffer, size_t *lenp, loff_t *ppos) |
2024 |
+ { |
2025 |
+- unsigned int type = (int *)table->data - dqstats.stat; |
2026 |
++ unsigned int type = (unsigned long *)table->data - dqstats.stat; |
2027 |
++ s64 value = percpu_counter_sum(&dqstats.counter[type]); |
2028 |
++ |
2029 |
++ /* Filter negative values for non-monotonic counters */ |
2030 |
++ if (value < 0 && (type == DQST_ALLOC_DQUOTS || |
2031 |
++ type == DQST_FREE_DQUOTS)) |
2032 |
++ value = 0; |
2033 |
+ |
2034 |
+ /* Update global table */ |
2035 |
+- dqstats.stat[type] = |
2036 |
+- percpu_counter_sum_positive(&dqstats.counter[type]); |
2037 |
+- return proc_dointvec(table, write, buffer, lenp, ppos); |
2038 |
++ dqstats.stat[type] = value; |
2039 |
++ return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
2040 |
+ } |
2041 |
+ |
2042 |
+ static struct ctl_table fs_dqstats_table[] = { |
2043 |
+ { |
2044 |
+ .procname = "lookups", |
2045 |
+ .data = &dqstats.stat[DQST_LOOKUPS], |
2046 |
+- .maxlen = sizeof(int), |
2047 |
++ .maxlen = sizeof(unsigned long), |
2048 |
+ .mode = 0444, |
2049 |
+ .proc_handler = do_proc_dqstats, |
2050 |
+ }, |
2051 |
+ { |
2052 |
+ .procname = "drops", |
2053 |
+ .data = &dqstats.stat[DQST_DROPS], |
2054 |
+- .maxlen = sizeof(int), |
2055 |
++ .maxlen = sizeof(unsigned long), |
2056 |
+ .mode = 0444, |
2057 |
+ .proc_handler = do_proc_dqstats, |
2058 |
+ }, |
2059 |
+ { |
2060 |
+ .procname = "reads", |
2061 |
+ .data = &dqstats.stat[DQST_READS], |
2062 |
+- .maxlen = sizeof(int), |
2063 |
++ .maxlen = sizeof(unsigned long), |
2064 |
+ .mode = 0444, |
2065 |
+ .proc_handler = do_proc_dqstats, |
2066 |
+ }, |
2067 |
+ { |
2068 |
+ .procname = "writes", |
2069 |
+ .data = &dqstats.stat[DQST_WRITES], |
2070 |
+- .maxlen = sizeof(int), |
2071 |
++ .maxlen = sizeof(unsigned long), |
2072 |
+ .mode = 0444, |
2073 |
+ .proc_handler = do_proc_dqstats, |
2074 |
+ }, |
2075 |
+ { |
2076 |
+ .procname = "cache_hits", |
2077 |
+ .data = &dqstats.stat[DQST_CACHE_HITS], |
2078 |
+- .maxlen = sizeof(int), |
2079 |
++ .maxlen = sizeof(unsigned long), |
2080 |
+ .mode = 0444, |
2081 |
+ .proc_handler = do_proc_dqstats, |
2082 |
+ }, |
2083 |
+ { |
2084 |
+ .procname = "allocated_dquots", |
2085 |
+ .data = &dqstats.stat[DQST_ALLOC_DQUOTS], |
2086 |
+- .maxlen = sizeof(int), |
2087 |
++ .maxlen = sizeof(unsigned long), |
2088 |
+ .mode = 0444, |
2089 |
+ .proc_handler = do_proc_dqstats, |
2090 |
+ }, |
2091 |
+ { |
2092 |
+ .procname = "free_dquots", |
2093 |
+ .data = &dqstats.stat[DQST_FREE_DQUOTS], |
2094 |
+- .maxlen = sizeof(int), |
2095 |
++ .maxlen = sizeof(unsigned long), |
2096 |
+ .mode = 0444, |
2097 |
+ .proc_handler = do_proc_dqstats, |
2098 |
+ }, |
2099 |
+ { |
2100 |
+ .procname = "syncs", |
2101 |
+ .data = &dqstats.stat[DQST_SYNCS], |
2102 |
+- .maxlen = sizeof(int), |
2103 |
++ .maxlen = sizeof(unsigned long), |
2104 |
+ .mode = 0444, |
2105 |
+ .proc_handler = do_proc_dqstats, |
2106 |
+ }, |
2107 |
+diff --git a/fs/readdir.c b/fs/readdir.c |
2108 |
+index d336db65a33e..0c357663e33a 100644 |
2109 |
+--- a/fs/readdir.c |
2110 |
++++ b/fs/readdir.c |
2111 |
+@@ -65,6 +65,40 @@ out: |
2112 |
+ } |
2113 |
+ EXPORT_SYMBOL(iterate_dir); |
2114 |
+ |
2115 |
++/* |
2116 |
++ * POSIX says that a dirent name cannot contain NULL or a '/'. |
2117 |
++ * |
2118 |
++ * It's not 100% clear what we should really do in this case. |
2119 |
++ * The filesystem is clearly corrupted, but returning a hard |
2120 |
++ * error means that you now don't see any of the other names |
2121 |
++ * either, so that isn't a perfect alternative. |
2122 |
++ * |
2123 |
++ * And if you return an error, what error do you use? Several |
2124 |
++ * filesystems seem to have decided on EUCLEAN being the error |
2125 |
++ * code for EFSCORRUPTED, and that may be the error to use. Or |
2126 |
++ * just EIO, which is perhaps more obvious to users. |
2127 |
++ * |
2128 |
++ * In order to see the other file names in the directory, the |
2129 |
++ * caller might want to make this a "soft" error: skip the |
2130 |
++ * entry, and return the error at the end instead. |
2131 |
++ * |
2132 |
++ * Note that this should likely do a "memchr(name, 0, len)" |
2133 |
++ * check too, since that would be filesystem corruption as |
2134 |
++ * well. However, that case can't actually confuse user space, |
2135 |
++ * which has to do a strlen() on the name anyway to find the |
2136 |
++ * filename length, and the above "soft error" worry means |
2137 |
++ * that it's probably better left alone until we have that |
2138 |
++ * issue clarified. |
2139 |
++ */ |
2140 |
++static int verify_dirent_name(const char *name, int len) |
2141 |
++{ |
2142 |
++ if (!len) |
2143 |
++ return -EIO; |
2144 |
++ if (memchr(name, '/', len)) |
2145 |
++ return -EIO; |
2146 |
++ return 0; |
2147 |
++} |
2148 |
++ |
2149 |
+ /* |
2150 |
+ * Traditional linux readdir() handling.. |
2151 |
+ * |
2152 |
+@@ -174,6 +208,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, |
2153 |
+ int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, |
2154 |
+ sizeof(long)); |
2155 |
+ |
2156 |
++ buf->error = verify_dirent_name(name, namlen); |
2157 |
++ if (unlikely(buf->error)) |
2158 |
++ return buf->error; |
2159 |
+ buf->error = -EINVAL; /* only used if we fail.. */ |
2160 |
+ if (reclen > buf->count) |
2161 |
+ return -EINVAL; |
2162 |
+@@ -260,6 +297,9 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, |
2163 |
+ int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
2164 |
+ sizeof(u64)); |
2165 |
+ |
2166 |
++ buf->error = verify_dirent_name(name, namlen); |
2167 |
++ if (unlikely(buf->error)) |
2168 |
++ return buf->error; |
2169 |
+ buf->error = -EINVAL; /* only used if we fail.. */ |
2170 |
+ if (reclen > buf->count) |
2171 |
+ return -EINVAL; |
2172 |
+diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c |
2173 |
+index a609d480606d..e2b2196fd942 100644 |
2174 |
+--- a/fs/userfaultfd.c |
2175 |
++++ b/fs/userfaultfd.c |
2176 |
+@@ -1807,13 +1807,12 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, |
2177 |
+ if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) |
2178 |
+ goto out; |
2179 |
+ features = uffdio_api.features; |
2180 |
+- if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES)) { |
2181 |
+- memset(&uffdio_api, 0, sizeof(uffdio_api)); |
2182 |
+- if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) |
2183 |
+- goto out; |
2184 |
+- ret = -EINVAL; |
2185 |
+- goto out; |
2186 |
+- } |
2187 |
++ ret = -EINVAL; |
2188 |
++ if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES)) |
2189 |
++ goto err_out; |
2190 |
++ ret = -EPERM; |
2191 |
++ if ((features & UFFD_FEATURE_EVENT_FORK) && !capable(CAP_SYS_PTRACE)) |
2192 |
++ goto err_out; |
2193 |
+ /* report all available features and ioctls to userland */ |
2194 |
+ uffdio_api.features = UFFD_API_FEATURES; |
2195 |
+ uffdio_api.ioctls = UFFD_API_IOCTLS; |
2196 |
+@@ -1826,6 +1825,11 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, |
2197 |
+ ret = 0; |
2198 |
+ out: |
2199 |
+ return ret; |
2200 |
++err_out: |
2201 |
++ memset(&uffdio_api, 0, sizeof(uffdio_api)); |
2202 |
++ if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) |
2203 |
++ ret = -EFAULT; |
2204 |
++ goto out; |
2205 |
+ } |
2206 |
+ |
2207 |
+ static long userfaultfd_ioctl(struct file *file, unsigned cmd, |
2208 |
+diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h |
2209 |
+index 012c37fdb688..5511dc963dd5 100644 |
2210 |
+--- a/include/linux/hrtimer.h |
2211 |
++++ b/include/linux/hrtimer.h |
2212 |
+@@ -408,12 +408,18 @@ extern u64 hrtimer_get_next_event(void); |
2213 |
+ |
2214 |
+ extern bool hrtimer_active(const struct hrtimer *timer); |
2215 |
+ |
2216 |
+-/* |
2217 |
+- * Helper function to check, whether the timer is on one of the queues |
2218 |
++/** |
2219 |
++ * hrtimer_is_queued = check, whether the timer is on one of the queues |
2220 |
++ * @timer: Timer to check |
2221 |
++ * |
2222 |
++ * Returns: True if the timer is queued, false otherwise |
2223 |
++ * |
2224 |
++ * The function can be used lockless, but it gives only a current snapshot. |
2225 |
+ */ |
2226 |
+-static inline int hrtimer_is_queued(struct hrtimer *timer) |
2227 |
++static inline bool hrtimer_is_queued(struct hrtimer *timer) |
2228 |
+ { |
2229 |
+- return timer->state & HRTIMER_STATE_ENQUEUED; |
2230 |
++ /* The READ_ONCE pairs with the update functions of timer->state */ |
2231 |
++ return !!(READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED); |
2232 |
+ } |
2233 |
+ |
2234 |
+ /* |
2235 |
+diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h |
2236 |
+index 1aa707ab19bb..8b54c591678e 100644 |
2237 |
+--- a/include/linux/libfdt_env.h |
2238 |
++++ b/include/linux/libfdt_env.h |
2239 |
+@@ -7,6 +7,9 @@ |
2240 |
+ |
2241 |
+ #include <asm/byteorder.h> |
2242 |
+ |
2243 |
++#define INT32_MAX S32_MAX |
2244 |
++#define UINT32_MAX U32_MAX |
2245 |
++ |
2246 |
+ typedef __be16 fdt16_t; |
2247 |
+ typedef __be32 fdt32_t; |
2248 |
+ typedef __be64 fdt64_t; |
2249 |
+diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h |
2250 |
+index 38d8225510f1..3097b08c55cb 100644 |
2251 |
+--- a/include/linux/posix-clock.h |
2252 |
++++ b/include/linux/posix-clock.h |
2253 |
+@@ -82,29 +82,32 @@ struct posix_clock_operations { |
2254 |
+ * |
2255 |
+ * @ops: Functional interface to the clock |
2256 |
+ * @cdev: Character device instance for this clock |
2257 |
+- * @kref: Reference count. |
2258 |
++ * @dev: Pointer to the clock's device. |
2259 |
+ * @rwsem: Protects the 'zombie' field from concurrent access. |
2260 |
+ * @zombie: If 'zombie' is true, then the hardware has disappeared. |
2261 |
+- * @release: A function to free the structure when the reference count reaches |
2262 |
+- * zero. May be NULL if structure is statically allocated. |
2263 |
+ * |
2264 |
+ * Drivers should embed their struct posix_clock within a private |
2265 |
+ * structure, obtaining a reference to it during callbacks using |
2266 |
+ * container_of(). |
2267 |
++ * |
2268 |
++ * Drivers should supply an initialized but not exposed struct device |
2269 |
++ * to posix_clock_register(). It is used to manage lifetime of the |
2270 |
++ * driver's private structure. It's 'release' field should be set to |
2271 |
++ * a release function for this private structure. |
2272 |
+ */ |
2273 |
+ struct posix_clock { |
2274 |
+ struct posix_clock_operations ops; |
2275 |
+ struct cdev cdev; |
2276 |
+- struct kref kref; |
2277 |
++ struct device *dev; |
2278 |
+ struct rw_semaphore rwsem; |
2279 |
+ bool zombie; |
2280 |
+- void (*release)(struct posix_clock *clk); |
2281 |
+ }; |
2282 |
+ |
2283 |
+ /** |
2284 |
+ * posix_clock_register() - register a new clock |
2285 |
+- * @clk: Pointer to the clock. Caller must provide 'ops' and 'release' |
2286 |
+- * @devid: Allocated device id |
2287 |
++ * @clk: Pointer to the clock. Caller must provide 'ops' field |
2288 |
++ * @dev: Pointer to the initialized device. Caller must provide |
2289 |
++ * 'release' field |
2290 |
+ * |
2291 |
+ * A clock driver calls this function to register itself with the |
2292 |
+ * clock device subsystem. If 'clk' points to dynamically allocated |
2293 |
+@@ -113,7 +116,7 @@ struct posix_clock { |
2294 |
+ * |
2295 |
+ * Returns zero on success, non-zero otherwise. |
2296 |
+ */ |
2297 |
+-int posix_clock_register(struct posix_clock *clk, dev_t devid); |
2298 |
++int posix_clock_register(struct posix_clock *clk, struct device *dev); |
2299 |
+ |
2300 |
+ /** |
2301 |
+ * posix_clock_unregister() - unregister a clock |
2302 |
+diff --git a/include/linux/quota.h b/include/linux/quota.h |
2303 |
+index 5ac9de4fcd6f..aa9a42eceab0 100644 |
2304 |
+--- a/include/linux/quota.h |
2305 |
++++ b/include/linux/quota.h |
2306 |
+@@ -263,7 +263,7 @@ enum { |
2307 |
+ }; |
2308 |
+ |
2309 |
+ struct dqstats { |
2310 |
+- int stat[_DQST_DQSTAT_LAST]; |
2311 |
++ unsigned long stat[_DQST_DQSTAT_LAST]; |
2312 |
+ struct percpu_counter counter[_DQST_DQSTAT_LAST]; |
2313 |
+ }; |
2314 |
+ |
2315 |
+diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h |
2316 |
+index e4b257ff881b..a10da545b3f6 100644 |
2317 |
+--- a/include/linux/rculist_nulls.h |
2318 |
++++ b/include/linux/rculist_nulls.h |
2319 |
+@@ -100,6 +100,43 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, |
2320 |
+ first->pprev = &n->next; |
2321 |
+ } |
2322 |
+ |
2323 |
++/** |
2324 |
++ * hlist_nulls_add_tail_rcu |
2325 |
++ * @n: the element to add to the hash list. |
2326 |
++ * @h: the list to add to. |
2327 |
++ * |
2328 |
++ * Description: |
2329 |
++ * Adds the specified element to the specified hlist_nulls, |
2330 |
++ * while permitting racing traversals. |
2331 |
++ * |
2332 |
++ * The caller must take whatever precautions are necessary |
2333 |
++ * (such as holding appropriate locks) to avoid racing |
2334 |
++ * with another list-mutation primitive, such as hlist_nulls_add_head_rcu() |
2335 |
++ * or hlist_nulls_del_rcu(), running on this same list. |
2336 |
++ * However, it is perfectly legal to run concurrently with |
2337 |
++ * the _rcu list-traversal primitives, such as |
2338 |
++ * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency |
2339 |
++ * problems on Alpha CPUs. Regardless of the type of CPU, the |
2340 |
++ * list-traversal primitive must be guarded by rcu_read_lock(). |
2341 |
++ */ |
2342 |
++static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, |
2343 |
++ struct hlist_nulls_head *h) |
2344 |
++{ |
2345 |
++ struct hlist_nulls_node *i, *last = NULL; |
2346 |
++ |
2347 |
++ /* Note: write side code, so rcu accessors are not needed. */ |
2348 |
++ for (i = h->first; !is_a_nulls(i); i = i->next) |
2349 |
++ last = i; |
2350 |
++ |
2351 |
++ if (last) { |
2352 |
++ n->next = last->next; |
2353 |
++ n->pprev = &last->next; |
2354 |
++ rcu_assign_pointer(hlist_next_rcu(last), n); |
2355 |
++ } else { |
2356 |
++ hlist_nulls_add_head_rcu(n, h); |
2357 |
++ } |
2358 |
++} |
2359 |
++ |
2360 |
+ /** |
2361 |
+ * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type |
2362 |
+ * @tpos: the type * to use as a loop cursor. |
2363 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
2364 |
+index ec00d9264e5c..a9a764a17c28 100644 |
2365 |
+--- a/include/linux/skbuff.h |
2366 |
++++ b/include/linux/skbuff.h |
2367 |
+@@ -1655,7 +1655,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, |
2368 |
+ */ |
2369 |
+ static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) |
2370 |
+ { |
2371 |
+- struct sk_buff *skb = list_->prev; |
2372 |
++ struct sk_buff *skb = READ_ONCE(list_->prev); |
2373 |
+ |
2374 |
+ if (skb == (struct sk_buff *)list_) |
2375 |
+ skb = NULL; |
2376 |
+@@ -1723,7 +1723,9 @@ static inline void __skb_insert(struct sk_buff *newsk, |
2377 |
+ struct sk_buff *prev, struct sk_buff *next, |
2378 |
+ struct sk_buff_head *list) |
2379 |
+ { |
2380 |
+- /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */ |
2381 |
++ /* See skb_queue_empty_lockless() and skb_peek_tail() |
2382 |
++ * for the opposite READ_ONCE() |
2383 |
++ */ |
2384 |
+ WRITE_ONCE(newsk->next, next); |
2385 |
+ WRITE_ONCE(newsk->prev, prev); |
2386 |
+ WRITE_ONCE(next->prev, newsk); |
2387 |
+diff --git a/include/net/dst.h b/include/net/dst.h |
2388 |
+index fe230dd62c28..5ebc7356a381 100644 |
2389 |
+--- a/include/net/dst.h |
2390 |
++++ b/include/net/dst.h |
2391 |
+@@ -528,7 +528,16 @@ static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu) |
2392 |
+ struct dst_entry *dst = skb_dst(skb); |
2393 |
+ |
2394 |
+ if (dst && dst->ops->update_pmtu) |
2395 |
+- dst->ops->update_pmtu(dst, NULL, skb, mtu); |
2396 |
++ dst->ops->update_pmtu(dst, NULL, skb, mtu, true); |
2397 |
++} |
2398 |
++ |
2399 |
++/* update dst pmtu but not do neighbor confirm */ |
2400 |
++static inline void skb_dst_update_pmtu_no_confirm(struct sk_buff *skb, u32 mtu) |
2401 |
++{ |
2402 |
++ struct dst_entry *dst = skb_dst(skb); |
2403 |
++ |
2404 |
++ if (dst && dst->ops->update_pmtu) |
2405 |
++ dst->ops->update_pmtu(dst, NULL, skb, mtu, false); |
2406 |
+ } |
2407 |
+ |
2408 |
+ #endif /* _NET_DST_H */ |
2409 |
+diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h |
2410 |
+index 5ec645f27ee3..443863c7b8da 100644 |
2411 |
+--- a/include/net/dst_ops.h |
2412 |
++++ b/include/net/dst_ops.h |
2413 |
+@@ -27,7 +27,8 @@ struct dst_ops { |
2414 |
+ struct dst_entry * (*negative_advice)(struct dst_entry *); |
2415 |
+ void (*link_failure)(struct sk_buff *); |
2416 |
+ void (*update_pmtu)(struct dst_entry *dst, struct sock *sk, |
2417 |
+- struct sk_buff *skb, u32 mtu); |
2418 |
++ struct sk_buff *skb, u32 mtu, |
2419 |
++ bool confirm_neigh); |
2420 |
+ void (*redirect)(struct dst_entry *dst, struct sock *sk, |
2421 |
+ struct sk_buff *skb); |
2422 |
+ int (*local_out)(struct net *net, struct sock *sk, struct sk_buff *skb); |
2423 |
+diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h |
2424 |
+index 2dbbbff5e1e3..573ab110c9ec 100644 |
2425 |
+--- a/include/net/inet_hashtables.h |
2426 |
++++ b/include/net/inet_hashtables.h |
2427 |
+@@ -106,12 +106,18 @@ struct inet_bind_hashbucket { |
2428 |
+ struct hlist_head chain; |
2429 |
+ }; |
2430 |
+ |
2431 |
+-/* |
2432 |
+- * Sockets can be hashed in established or listening table |
2433 |
++/* Sockets can be hashed in established or listening table. |
2434 |
++ * We must use different 'nulls' end-of-chain value for all hash buckets : |
2435 |
++ * A socket might transition from ESTABLISH to LISTEN state without |
2436 |
++ * RCU grace period. A lookup in ehash table needs to handle this case. |
2437 |
+ */ |
2438 |
++#define LISTENING_NULLS_BASE (1U << 29) |
2439 |
+ struct inet_listen_hashbucket { |
2440 |
+ spinlock_t lock; |
2441 |
+- struct hlist_head head; |
2442 |
++ union { |
2443 |
++ struct hlist_head head; |
2444 |
++ struct hlist_nulls_head nulls_head; |
2445 |
++ }; |
2446 |
+ }; |
2447 |
+ |
2448 |
+ /* This is for listening sockets, thus all sockets which possess wildcards. */ |
2449 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
2450 |
+index 0af46cbd3649..c6a003bc4737 100644 |
2451 |
+--- a/include/net/sock.h |
2452 |
++++ b/include/net/sock.h |
2453 |
+@@ -693,6 +693,11 @@ static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_h |
2454 |
+ hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); |
2455 |
+ } |
2456 |
+ |
2457 |
++static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list) |
2458 |
++{ |
2459 |
++ hlist_nulls_add_tail_rcu(&sk->sk_nulls_node, list); |
2460 |
++} |
2461 |
++ |
2462 |
+ static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) |
2463 |
+ { |
2464 |
+ sock_hold(sk); |
2465 |
+diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h |
2466 |
+index df156f1d50b2..f0a01a54bd15 100644 |
2467 |
+--- a/include/scsi/iscsi_proto.h |
2468 |
++++ b/include/scsi/iscsi_proto.h |
2469 |
+@@ -638,6 +638,7 @@ struct iscsi_reject { |
2470 |
+ #define ISCSI_REASON_BOOKMARK_INVALID 9 |
2471 |
+ #define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10 |
2472 |
+ #define ISCSI_REASON_NEGOTIATION_RESET 11 |
2473 |
++#define ISCSI_REASON_WAITING_FOR_LOGOUT 12 |
2474 |
+ |
2475 |
+ /* Max. number of Key=Value pairs in a text message */ |
2476 |
+ #define MAX_KEY_VALUE_PAIRS 8192 |
2477 |
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2478 |
+index cfc2c0d1369a..74fc3a9d1923 100644 |
2479 |
+--- a/kernel/sysctl.c |
2480 |
++++ b/kernel/sysctl.c |
2481 |
+@@ -1397,7 +1397,7 @@ static struct ctl_table vm_table[] = { |
2482 |
+ .procname = "drop_caches", |
2483 |
+ .data = &sysctl_drop_caches, |
2484 |
+ .maxlen = sizeof(int), |
2485 |
+- .mode = 0644, |
2486 |
++ .mode = 0200, |
2487 |
+ .proc_handler = drop_caches_sysctl_handler, |
2488 |
+ .extra1 = &one, |
2489 |
+ .extra2 = &four, |
2490 |
+diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
2491 |
+index d00e85ac10d6..ecce9122343b 100644 |
2492 |
+--- a/kernel/time/hrtimer.c |
2493 |
++++ b/kernel/time/hrtimer.c |
2494 |
+@@ -845,7 +845,8 @@ static int enqueue_hrtimer(struct hrtimer *timer, |
2495 |
+ |
2496 |
+ base->cpu_base->active_bases |= 1 << base->index; |
2497 |
+ |
2498 |
+- timer->state = HRTIMER_STATE_ENQUEUED; |
2499 |
++ /* Pairs with the lockless read in hrtimer_is_queued() */ |
2500 |
++ WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); |
2501 |
+ |
2502 |
+ return timerqueue_add(&base->active, &timer->node); |
2503 |
+ } |
2504 |
+@@ -867,7 +868,8 @@ static void __remove_hrtimer(struct hrtimer *timer, |
2505 |
+ struct hrtimer_cpu_base *cpu_base = base->cpu_base; |
2506 |
+ u8 state = timer->state; |
2507 |
+ |
2508 |
+- timer->state = newstate; |
2509 |
++ /* Pairs with the lockless read in hrtimer_is_queued() */ |
2510 |
++ WRITE_ONCE(timer->state, newstate); |
2511 |
+ if (!(state & HRTIMER_STATE_ENQUEUED)) |
2512 |
+ return; |
2513 |
+ |
2514 |
+@@ -894,8 +896,9 @@ static void __remove_hrtimer(struct hrtimer *timer, |
2515 |
+ static inline int |
2516 |
+ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) |
2517 |
+ { |
2518 |
+- if (hrtimer_is_queued(timer)) { |
2519 |
+- u8 state = timer->state; |
2520 |
++ u8 state = timer->state; |
2521 |
++ |
2522 |
++ if (state & HRTIMER_STATE_ENQUEUED) { |
2523 |
+ int reprogram; |
2524 |
+ |
2525 |
+ /* |
2526 |
+diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c |
2527 |
+index 17cdc554c9fe..e5706a826c1f 100644 |
2528 |
+--- a/kernel/time/posix-clock.c |
2529 |
++++ b/kernel/time/posix-clock.c |
2530 |
+@@ -27,8 +27,6 @@ |
2531 |
+ |
2532 |
+ #include "posix-timers.h" |
2533 |
+ |
2534 |
+-static void delete_clock(struct kref *kref); |
2535 |
+- |
2536 |
+ /* |
2537 |
+ * Returns NULL if the posix_clock instance attached to 'fp' is old and stale. |
2538 |
+ */ |
2539 |
+@@ -138,7 +136,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp) |
2540 |
+ err = 0; |
2541 |
+ |
2542 |
+ if (!err) { |
2543 |
+- kref_get(&clk->kref); |
2544 |
++ get_device(clk->dev); |
2545 |
+ fp->private_data = clk; |
2546 |
+ } |
2547 |
+ out: |
2548 |
+@@ -154,7 +152,7 @@ static int posix_clock_release(struct inode *inode, struct file *fp) |
2549 |
+ if (clk->ops.release) |
2550 |
+ err = clk->ops.release(clk); |
2551 |
+ |
2552 |
+- kref_put(&clk->kref, delete_clock); |
2553 |
++ put_device(clk->dev); |
2554 |
+ |
2555 |
+ fp->private_data = NULL; |
2556 |
+ |
2557 |
+@@ -174,38 +172,35 @@ static const struct file_operations posix_clock_file_operations = { |
2558 |
+ #endif |
2559 |
+ }; |
2560 |
+ |
2561 |
+-int posix_clock_register(struct posix_clock *clk, dev_t devid) |
2562 |
++int posix_clock_register(struct posix_clock *clk, struct device *dev) |
2563 |
+ { |
2564 |
+ int err; |
2565 |
+ |
2566 |
+- kref_init(&clk->kref); |
2567 |
+ init_rwsem(&clk->rwsem); |
2568 |
+ |
2569 |
+ cdev_init(&clk->cdev, &posix_clock_file_operations); |
2570 |
++ err = cdev_device_add(&clk->cdev, dev); |
2571 |
++ if (err) { |
2572 |
++ pr_err("%s unable to add device %d:%d\n", |
2573 |
++ dev_name(dev), MAJOR(dev->devt), MINOR(dev->devt)); |
2574 |
++ return err; |
2575 |
++ } |
2576 |
+ clk->cdev.owner = clk->ops.owner; |
2577 |
+- err = cdev_add(&clk->cdev, devid, 1); |
2578 |
++ clk->dev = dev; |
2579 |
+ |
2580 |
+- return err; |
2581 |
++ return 0; |
2582 |
+ } |
2583 |
+ EXPORT_SYMBOL_GPL(posix_clock_register); |
2584 |
+ |
2585 |
+-static void delete_clock(struct kref *kref) |
2586 |
+-{ |
2587 |
+- struct posix_clock *clk = container_of(kref, struct posix_clock, kref); |
2588 |
+- |
2589 |
+- if (clk->release) |
2590 |
+- clk->release(clk); |
2591 |
+-} |
2592 |
+- |
2593 |
+ void posix_clock_unregister(struct posix_clock *clk) |
2594 |
+ { |
2595 |
+- cdev_del(&clk->cdev); |
2596 |
++ cdev_device_del(&clk->cdev, clk->dev); |
2597 |
+ |
2598 |
+ down_write(&clk->rwsem); |
2599 |
+ clk->zombie = true; |
2600 |
+ up_write(&clk->rwsem); |
2601 |
+ |
2602 |
+- kref_put(&clk->kref, delete_clock); |
2603 |
++ put_device(clk->dev); |
2604 |
+ } |
2605 |
+ EXPORT_SYMBOL_GPL(posix_clock_unregister); |
2606 |
+ |
2607 |
+diff --git a/lib/dma-debug.c b/lib/dma-debug.c |
2608 |
+index ea4cc3dde4f1..61e7240947f5 100644 |
2609 |
+--- a/lib/dma-debug.c |
2610 |
++++ b/lib/dma-debug.c |
2611 |
+@@ -437,6 +437,7 @@ void debug_dma_dump_mappings(struct device *dev) |
2612 |
+ } |
2613 |
+ |
2614 |
+ spin_unlock_irqrestore(&bucket->lock, flags); |
2615 |
++ cond_resched(); |
2616 |
+ } |
2617 |
+ } |
2618 |
+ EXPORT_SYMBOL(debug_dma_dump_mappings); |
2619 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
2620 |
+index 89936e0d55c9..6feab2279143 100644 |
2621 |
+--- a/net/bridge/br_netfilter_hooks.c |
2622 |
++++ b/net/bridge/br_netfilter_hooks.c |
2623 |
+@@ -643,6 +643,9 @@ static unsigned int br_nf_forward_arp(void *priv, |
2624 |
+ nf_bridge_pull_encap_header(skb); |
2625 |
+ } |
2626 |
+ |
2627 |
++ if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr)))) |
2628 |
++ return NF_DROP; |
2629 |
++ |
2630 |
+ if (arp_hdr(skb)->ar_pln != 4) { |
2631 |
+ if (IS_VLAN_ARP(skb)) |
2632 |
+ nf_bridge_push_encap_header(skb); |
2633 |
+diff --git a/net/bridge/br_nf_core.c b/net/bridge/br_nf_core.c |
2634 |
+index 20cbb727df4d..c217276bd76a 100644 |
2635 |
+--- a/net/bridge/br_nf_core.c |
2636 |
++++ b/net/bridge/br_nf_core.c |
2637 |
+@@ -26,7 +26,8 @@ |
2638 |
+ #endif |
2639 |
+ |
2640 |
+ static void fake_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2641 |
+- struct sk_buff *skb, u32 mtu) |
2642 |
++ struct sk_buff *skb, u32 mtu, |
2643 |
++ bool confirm_neigh) |
2644 |
+ { |
2645 |
+ } |
2646 |
+ |
2647 |
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
2648 |
+index 100b4f88179a..35a670ec9077 100644 |
2649 |
+--- a/net/bridge/netfilter/ebtables.c |
2650 |
++++ b/net/bridge/netfilter/ebtables.c |
2651 |
+@@ -1876,7 +1876,7 @@ static int ebt_buf_count(struct ebt_entries_buf_state *state, unsigned int sz) |
2652 |
+ } |
2653 |
+ |
2654 |
+ static int ebt_buf_add(struct ebt_entries_buf_state *state, |
2655 |
+- void *data, unsigned int sz) |
2656 |
++ const void *data, unsigned int sz) |
2657 |
+ { |
2658 |
+ if (state->buf_kern_start == NULL) |
2659 |
+ goto count_only; |
2660 |
+@@ -1910,7 +1910,7 @@ enum compat_mwt { |
2661 |
+ EBT_COMPAT_TARGET, |
2662 |
+ }; |
2663 |
+ |
2664 |
+-static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
2665 |
++static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, |
2666 |
+ enum compat_mwt compat_mwt, |
2667 |
+ struct ebt_entries_buf_state *state, |
2668 |
+ const unsigned char *base) |
2669 |
+@@ -1986,22 +1986,23 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
2670 |
+ /* return size of all matches, watchers or target, including necessary |
2671 |
+ * alignment and padding. |
2672 |
+ */ |
2673 |
+-static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
2674 |
++static int ebt_size_mwt(const struct compat_ebt_entry_mwt *match32, |
2675 |
+ unsigned int size_left, enum compat_mwt type, |
2676 |
+ struct ebt_entries_buf_state *state, const void *base) |
2677 |
+ { |
2678 |
++ const char *buf = (const char *)match32; |
2679 |
+ int growth = 0; |
2680 |
+- char *buf; |
2681 |
+ |
2682 |
+ if (size_left == 0) |
2683 |
+ return 0; |
2684 |
+ |
2685 |
+- buf = (char *) match32; |
2686 |
+- |
2687 |
+- while (size_left >= sizeof(*match32)) { |
2688 |
++ do { |
2689 |
+ struct ebt_entry_match *match_kern; |
2690 |
+ int ret; |
2691 |
+ |
2692 |
++ if (size_left < sizeof(*match32)) |
2693 |
++ return -EINVAL; |
2694 |
++ |
2695 |
+ match_kern = (struct ebt_entry_match *) state->buf_kern_start; |
2696 |
+ if (match_kern) { |
2697 |
+ char *tmp; |
2698 |
+@@ -2038,22 +2039,18 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
2699 |
+ if (match_kern) |
2700 |
+ match_kern->match_size = ret; |
2701 |
+ |
2702 |
+- /* rule should have no remaining data after target */ |
2703 |
+- if (type == EBT_COMPAT_TARGET && size_left) |
2704 |
+- return -EINVAL; |
2705 |
+- |
2706 |
+ match32 = (struct compat_ebt_entry_mwt *) buf; |
2707 |
+- } |
2708 |
++ } while (size_left); |
2709 |
+ |
2710 |
+ return growth; |
2711 |
+ } |
2712 |
+ |
2713 |
+ /* called for all ebt_entry structures. */ |
2714 |
+-static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
2715 |
++static int size_entry_mwt(const struct ebt_entry *entry, const unsigned char *base, |
2716 |
+ unsigned int *total, |
2717 |
+ struct ebt_entries_buf_state *state) |
2718 |
+ { |
2719 |
+- unsigned int i, j, startoff, new_offset = 0; |
2720 |
++ unsigned int i, j, startoff, next_expected_off, new_offset = 0; |
2721 |
+ /* stores match/watchers/targets & offset of next struct ebt_entry: */ |
2722 |
+ unsigned int offsets[4]; |
2723 |
+ unsigned int *offsets_update = NULL; |
2724 |
+@@ -2140,11 +2137,13 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
2725 |
+ return ret; |
2726 |
+ } |
2727 |
+ |
2728 |
+- startoff = state->buf_user_offset - startoff; |
2729 |
++ next_expected_off = state->buf_user_offset - startoff; |
2730 |
++ if (next_expected_off != entry->next_offset) |
2731 |
++ return -EINVAL; |
2732 |
+ |
2733 |
+- if (WARN_ON(*total < startoff)) |
2734 |
++ if (*total < entry->next_offset) |
2735 |
+ return -EINVAL; |
2736 |
+- *total -= startoff; |
2737 |
++ *total -= entry->next_offset; |
2738 |
+ return 0; |
2739 |
+ } |
2740 |
+ |
2741 |
+diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c |
2742 |
+index 144cd1acd7e3..069e3c4fcc44 100644 |
2743 |
+--- a/net/core/sysctl_net_core.c |
2744 |
++++ b/net/core/sysctl_net_core.c |
2745 |
+@@ -274,6 +274,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, |
2746 |
+ return ret; |
2747 |
+ } |
2748 |
+ |
2749 |
++# ifdef CONFIG_HAVE_EBPF_JIT |
2750 |
+ static int |
2751 |
+ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
2752 |
+ void __user *buffer, size_t *lenp, |
2753 |
+@@ -284,6 +285,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
2754 |
+ |
2755 |
+ return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
2756 |
+ } |
2757 |
++# endif /* CONFIG_HAVE_EBPF_JIT */ |
2758 |
+ |
2759 |
+ static int |
2760 |
+ proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
2761 |
+diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c |
2762 |
+index 0bd3afd01dd2..ccc189bc3617 100644 |
2763 |
+--- a/net/decnet/dn_route.c |
2764 |
++++ b/net/decnet/dn_route.c |
2765 |
+@@ -118,7 +118,8 @@ static void dn_dst_ifdown(struct dst_entry *, struct net_device *dev, int how); |
2766 |
+ static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); |
2767 |
+ static void dn_dst_link_failure(struct sk_buff *); |
2768 |
+ static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2769 |
+- struct sk_buff *skb , u32 mtu); |
2770 |
++ struct sk_buff *skb , u32 mtu, |
2771 |
++ bool confirm_neigh); |
2772 |
+ static void dn_dst_redirect(struct dst_entry *dst, struct sock *sk, |
2773 |
+ struct sk_buff *skb); |
2774 |
+ static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, |
2775 |
+@@ -259,7 +260,8 @@ static int dn_dst_gc(struct dst_ops *ops) |
2776 |
+ * advertise to the other end). |
2777 |
+ */ |
2778 |
+ static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2779 |
+- struct sk_buff *skb, u32 mtu) |
2780 |
++ struct sk_buff *skb, u32 mtu, |
2781 |
++ bool confirm_neigh) |
2782 |
+ { |
2783 |
+ struct dn_route *rt = (struct dn_route *) dst; |
2784 |
+ struct neighbour *n = rt->n; |
2785 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
2786 |
+index f9d790b058d2..995ef3d23368 100644 |
2787 |
+--- a/net/ipv4/icmp.c |
2788 |
++++ b/net/ipv4/icmp.c |
2789 |
+@@ -254,10 +254,11 @@ bool icmp_global_allow(void) |
2790 |
+ bool rc = false; |
2791 |
+ |
2792 |
+ /* Check if token bucket is empty and cannot be refilled |
2793 |
+- * without taking the spinlock. |
2794 |
++ * without taking the spinlock. The READ_ONCE() are paired |
2795 |
++ * with the following WRITE_ONCE() in this same function. |
2796 |
+ */ |
2797 |
+- if (!icmp_global.credit) { |
2798 |
+- delta = min_t(u32, now - icmp_global.stamp, HZ); |
2799 |
++ if (!READ_ONCE(icmp_global.credit)) { |
2800 |
++ delta = min_t(u32, now - READ_ONCE(icmp_global.stamp), HZ); |
2801 |
+ if (delta < HZ / 50) |
2802 |
+ return false; |
2803 |
+ } |
2804 |
+@@ -267,14 +268,14 @@ bool icmp_global_allow(void) |
2805 |
+ if (delta >= HZ / 50) { |
2806 |
+ incr = sysctl_icmp_msgs_per_sec * delta / HZ ; |
2807 |
+ if (incr) |
2808 |
+- icmp_global.stamp = now; |
2809 |
++ WRITE_ONCE(icmp_global.stamp, now); |
2810 |
+ } |
2811 |
+ credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); |
2812 |
+ if (credit) { |
2813 |
+ credit--; |
2814 |
+ rc = true; |
2815 |
+ } |
2816 |
+- icmp_global.credit = credit; |
2817 |
++ WRITE_ONCE(icmp_global.credit, credit); |
2818 |
+ spin_unlock(&icmp_global.lock); |
2819 |
+ return rc; |
2820 |
+ } |
2821 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
2822 |
+index 9d6b172caf6c..f7224c4fc30f 100644 |
2823 |
+--- a/net/ipv4/inet_connection_sock.c |
2824 |
++++ b/net/ipv4/inet_connection_sock.c |
2825 |
+@@ -1088,7 +1088,7 @@ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu) |
2826 |
+ if (!dst) |
2827 |
+ goto out; |
2828 |
+ } |
2829 |
+- dst->ops->update_pmtu(dst, sk, NULL, mtu); |
2830 |
++ dst->ops->update_pmtu(dst, sk, NULL, mtu, true); |
2831 |
+ |
2832 |
+ dst = __sk_dst_check(sk, 0); |
2833 |
+ if (!dst) |
2834 |
+diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c |
2835 |
+index 33edccfebc30..eb158badebc4 100644 |
2836 |
+--- a/net/ipv4/inet_diag.c |
2837 |
++++ b/net/ipv4/inet_diag.c |
2838 |
+@@ -911,11 +911,12 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, |
2839 |
+ |
2840 |
+ for (i = s_i; i < INET_LHTABLE_SIZE; i++) { |
2841 |
+ struct inet_listen_hashbucket *ilb; |
2842 |
++ struct hlist_nulls_node *node; |
2843 |
+ |
2844 |
+ num = 0; |
2845 |
+ ilb = &hashinfo->listening_hash[i]; |
2846 |
+ spin_lock(&ilb->lock); |
2847 |
+- sk_for_each(sk, &ilb->head) { |
2848 |
++ sk_nulls_for_each(sk, node, &ilb->nulls_head) { |
2849 |
+ struct inet_sock *inet = inet_sk(sk); |
2850 |
+ |
2851 |
+ if (!net_eq(sock_net(sk), net)) |
2852 |
+diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c |
2853 |
+index 1f26627c7fad..0af13f5bdc9a 100644 |
2854 |
+--- a/net/ipv4/inet_hashtables.c |
2855 |
++++ b/net/ipv4/inet_hashtables.c |
2856 |
+@@ -219,9 +219,10 @@ struct sock *__inet_lookup_listener(struct net *net, |
2857 |
+ int score, hiscore = 0, matches = 0, reuseport = 0; |
2858 |
+ bool exact_dif = inet_exact_dif_match(net, skb); |
2859 |
+ struct sock *sk, *result = NULL; |
2860 |
++ struct hlist_nulls_node *node; |
2861 |
+ u32 phash = 0; |
2862 |
+ |
2863 |
+- sk_for_each_rcu(sk, &ilb->head) { |
2864 |
++ sk_nulls_for_each_rcu(sk, node, &ilb->nulls_head) { |
2865 |
+ score = compute_score(sk, net, hnum, daddr, |
2866 |
+ dif, sdif, exact_dif); |
2867 |
+ if (score > hiscore) { |
2868 |
+@@ -442,10 +443,11 @@ static int inet_reuseport_add_sock(struct sock *sk, |
2869 |
+ struct inet_listen_hashbucket *ilb) |
2870 |
+ { |
2871 |
+ struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash; |
2872 |
++ const struct hlist_nulls_node *node; |
2873 |
+ struct sock *sk2; |
2874 |
+ kuid_t uid = sock_i_uid(sk); |
2875 |
+ |
2876 |
+- sk_for_each_rcu(sk2, &ilb->head) { |
2877 |
++ sk_nulls_for_each_rcu(sk2, node, &ilb->nulls_head) { |
2878 |
+ if (sk2 != sk && |
2879 |
+ sk2->sk_family == sk->sk_family && |
2880 |
+ ipv6_only_sock(sk2) == ipv6_only_sock(sk) && |
2881 |
+@@ -480,9 +482,9 @@ int __inet_hash(struct sock *sk, struct sock *osk) |
2882 |
+ } |
2883 |
+ if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport && |
2884 |
+ sk->sk_family == AF_INET6) |
2885 |
+- hlist_add_tail_rcu(&sk->sk_node, &ilb->head); |
2886 |
++ __sk_nulls_add_node_tail_rcu(sk, &ilb->nulls_head); |
2887 |
+ else |
2888 |
+- hlist_add_head_rcu(&sk->sk_node, &ilb->head); |
2889 |
++ __sk_nulls_add_node_rcu(sk, &ilb->nulls_head); |
2890 |
+ sock_set_flag(sk, SOCK_RCU_FREE); |
2891 |
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
2892 |
+ unlock: |
2893 |
+@@ -525,10 +527,7 @@ void inet_unhash(struct sock *sk) |
2894 |
+ spin_lock_bh(lock); |
2895 |
+ if (rcu_access_pointer(sk->sk_reuseport_cb)) |
2896 |
+ reuseport_detach_sock(sk); |
2897 |
+- if (listener) |
2898 |
+- done = __sk_del_node_init(sk); |
2899 |
+- else |
2900 |
+- done = __sk_nulls_del_node_init_rcu(sk); |
2901 |
++ done = __sk_nulls_del_node_init_rcu(sk); |
2902 |
+ if (done) |
2903 |
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
2904 |
+ spin_unlock_bh(lock); |
2905 |
+@@ -664,7 +663,8 @@ void inet_hashinfo_init(struct inet_hashinfo *h) |
2906 |
+ |
2907 |
+ for (i = 0; i < INET_LHTABLE_SIZE; i++) { |
2908 |
+ spin_lock_init(&h->listening_hash[i].lock); |
2909 |
+- INIT_HLIST_HEAD(&h->listening_hash[i].head); |
2910 |
++ INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].nulls_head, |
2911 |
++ i + LISTENING_NULLS_BASE); |
2912 |
+ } |
2913 |
+ } |
2914 |
+ EXPORT_SYMBOL_GPL(inet_hashinfo_init); |
2915 |
+diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c |
2916 |
+index f9cef27907ed..f94881412d5b 100644 |
2917 |
+--- a/net/ipv4/inetpeer.c |
2918 |
++++ b/net/ipv4/inetpeer.c |
2919 |
+@@ -159,7 +159,12 @@ static void inet_peer_gc(struct inet_peer_base *base, |
2920 |
+ base->total / inet_peer_threshold * HZ; |
2921 |
+ for (i = 0; i < gc_cnt; i++) { |
2922 |
+ p = gc_stack[i]; |
2923 |
+- delta = (__u32)jiffies - p->dtime; |
2924 |
++ |
2925 |
++ /* The READ_ONCE() pairs with the WRITE_ONCE() |
2926 |
++ * in inet_putpeer() |
2927 |
++ */ |
2928 |
++ delta = (__u32)jiffies - READ_ONCE(p->dtime); |
2929 |
++ |
2930 |
+ if (delta < ttl || !refcount_dec_if_one(&p->refcnt)) |
2931 |
+ gc_stack[i] = NULL; |
2932 |
+ } |
2933 |
+@@ -236,7 +241,10 @@ EXPORT_SYMBOL_GPL(inet_getpeer); |
2934 |
+ |
2935 |
+ void inet_putpeer(struct inet_peer *p) |
2936 |
+ { |
2937 |
+- p->dtime = (__u32)jiffies; |
2938 |
++ /* The WRITE_ONCE() pairs with itself (we run lockless) |
2939 |
++ * and the READ_ONCE() in inet_peer_gc() |
2940 |
++ */ |
2941 |
++ WRITE_ONCE(p->dtime, (__u32)jiffies); |
2942 |
+ |
2943 |
+ if (refcount_dec_and_test(&p->refcnt)) |
2944 |
+ call_rcu(&p->rcu, inetpeer_free_rcu); |
2945 |
+diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c |
2946 |
+index 7a31287ff123..f1784162acc2 100644 |
2947 |
+--- a/net/ipv4/ip_tunnel.c |
2948 |
++++ b/net/ipv4/ip_tunnel.c |
2949 |
+@@ -521,7 +521,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, |
2950 |
+ else |
2951 |
+ mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; |
2952 |
+ |
2953 |
+- skb_dst_update_pmtu(skb, mtu); |
2954 |
++ skb_dst_update_pmtu_no_confirm(skb, mtu); |
2955 |
+ |
2956 |
+ if (skb->protocol == htons(ETH_P_IP)) { |
2957 |
+ if (!skb_is_gso(skb) && |
2958 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
2959 |
+index c07065b7e3b0..08c15dd42d93 100644 |
2960 |
+--- a/net/ipv4/ip_vti.c |
2961 |
++++ b/net/ipv4/ip_vti.c |
2962 |
+@@ -244,7 +244,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, |
2963 |
+ |
2964 |
+ mtu = dst_mtu(dst); |
2965 |
+ if (skb->len > mtu) { |
2966 |
+- skb_dst_update_pmtu(skb, mtu); |
2967 |
++ skb_dst_update_pmtu_no_confirm(skb, mtu); |
2968 |
+ if (skb->protocol == htons(ETH_P_IP)) { |
2969 |
+ icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, |
2970 |
+ htonl(mtu)); |
2971 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
2972 |
+index de7f955ffd0a..8b855d3eec9e 100644 |
2973 |
+--- a/net/ipv4/route.c |
2974 |
++++ b/net/ipv4/route.c |
2975 |
+@@ -145,7 +145,8 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst); |
2976 |
+ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); |
2977 |
+ static void ipv4_link_failure(struct sk_buff *skb); |
2978 |
+ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2979 |
+- struct sk_buff *skb, u32 mtu); |
2980 |
++ struct sk_buff *skb, u32 mtu, |
2981 |
++ bool confirm_neigh); |
2982 |
+ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, |
2983 |
+ struct sk_buff *skb); |
2984 |
+ static void ipv4_dst_destroy(struct dst_entry *dst); |
2985 |
+@@ -1042,7 +1043,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) |
2986 |
+ } |
2987 |
+ |
2988 |
+ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2989 |
+- struct sk_buff *skb, u32 mtu) |
2990 |
++ struct sk_buff *skb, u32 mtu, |
2991 |
++ bool confirm_neigh) |
2992 |
+ { |
2993 |
+ struct rtable *rt = (struct rtable *) dst; |
2994 |
+ struct flowi4 fl4; |
2995 |
+@@ -2529,7 +2531,8 @@ static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) |
2996 |
+ } |
2997 |
+ |
2998 |
+ static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, |
2999 |
+- struct sk_buff *skb, u32 mtu) |
3000 |
++ struct sk_buff *skb, u32 mtu, |
3001 |
++ bool confirm_neigh) |
3002 |
+ { |
3003 |
+ } |
3004 |
+ |
3005 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
3006 |
+index 44a41ac2b0ca..b4f0fc34b0ed 100644 |
3007 |
+--- a/net/ipv4/tcp_ipv4.c |
3008 |
++++ b/net/ipv4/tcp_ipv4.c |
3009 |
+@@ -1936,13 +1936,14 @@ static void *listening_get_next(struct seq_file *seq, void *cur) |
3010 |
+ struct tcp_iter_state *st = seq->private; |
3011 |
+ struct net *net = seq_file_net(seq); |
3012 |
+ struct inet_listen_hashbucket *ilb; |
3013 |
++ struct hlist_nulls_node *node; |
3014 |
+ struct sock *sk = cur; |
3015 |
+ |
3016 |
+ if (!sk) { |
3017 |
+ get_head: |
3018 |
+ ilb = &tcp_hashinfo.listening_hash[st->bucket]; |
3019 |
+ spin_lock(&ilb->lock); |
3020 |
+- sk = sk_head(&ilb->head); |
3021 |
++ sk = sk_nulls_head(&ilb->nulls_head); |
3022 |
+ st->offset = 0; |
3023 |
+ goto get_sk; |
3024 |
+ } |
3025 |
+@@ -1950,9 +1951,9 @@ get_head: |
3026 |
+ ++st->num; |
3027 |
+ ++st->offset; |
3028 |
+ |
3029 |
+- sk = sk_next(sk); |
3030 |
++ sk = sk_nulls_next(sk); |
3031 |
+ get_sk: |
3032 |
+- sk_for_each_from(sk) { |
3033 |
++ sk_nulls_for_each_from(sk, node) { |
3034 |
+ if (!net_eq(sock_net(sk), net)) |
3035 |
+ continue; |
3036 |
+ if (sk->sk_family == st->family) |
3037 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
3038 |
+index e3b28140c10b..e1eb56e21dd5 100644 |
3039 |
+--- a/net/ipv4/tcp_output.c |
3040 |
++++ b/net/ipv4/tcp_output.c |
3041 |
+@@ -2380,6 +2380,14 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, |
3042 |
+ if (tcp_small_queue_check(sk, skb, 0)) |
3043 |
+ break; |
3044 |
+ |
3045 |
++ /* Argh, we hit an empty skb(), presumably a thread |
3046 |
++ * is sleeping in sendmsg()/sk_stream_wait_memory(). |
3047 |
++ * We do not want to send a pure-ack packet and have |
3048 |
++ * a strange looking rtx queue with empty packet(s). |
3049 |
++ */ |
3050 |
++ if (TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) |
3051 |
++ break; |
3052 |
++ |
3053 |
+ if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp))) |
3054 |
+ break; |
3055 |
+ |
3056 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
3057 |
+index ab3f272a0884..e33258d69246 100644 |
3058 |
+--- a/net/ipv4/udp.c |
3059 |
++++ b/net/ipv4/udp.c |
3060 |
+@@ -1338,7 +1338,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) |
3061 |
+ * queue contains some other skb |
3062 |
+ */ |
3063 |
+ rmem = atomic_add_return(size, &sk->sk_rmem_alloc); |
3064 |
+- if (rmem > (size + sk->sk_rcvbuf)) |
3065 |
++ if (rmem > (size + (unsigned int)sk->sk_rcvbuf)) |
3066 |
+ goto uncharge_drop; |
3067 |
+ |
3068 |
+ spin_lock(&list->lock); |
3069 |
+diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c |
3070 |
+index 5952dca98e6b..08f00225ed1b 100644 |
3071 |
+--- a/net/ipv4/xfrm4_policy.c |
3072 |
++++ b/net/ipv4/xfrm4_policy.c |
3073 |
+@@ -222,12 +222,13 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) |
3074 |
+ } |
3075 |
+ |
3076 |
+ static void xfrm4_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3077 |
+- struct sk_buff *skb, u32 mtu) |
3078 |
++ struct sk_buff *skb, u32 mtu, |
3079 |
++ bool confirm_neigh) |
3080 |
+ { |
3081 |
+ struct xfrm_dst *xdst = (struct xfrm_dst *)dst; |
3082 |
+ struct dst_entry *path = xdst->route; |
3083 |
+ |
3084 |
+- path->ops->update_pmtu(path, sk, skb, mtu); |
3085 |
++ path->ops->update_pmtu(path, sk, skb, mtu, confirm_neigh); |
3086 |
+ } |
3087 |
+ |
3088 |
+ static void xfrm4_redirect(struct dst_entry *dst, struct sock *sk, |
3089 |
+diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c |
3090 |
+index 9a31d13bf180..890adadcda16 100644 |
3091 |
+--- a/net/ipv6/inet6_connection_sock.c |
3092 |
++++ b/net/ipv6/inet6_connection_sock.c |
3093 |
+@@ -150,7 +150,7 @@ struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu) |
3094 |
+ |
3095 |
+ if (IS_ERR(dst)) |
3096 |
+ return NULL; |
3097 |
+- dst->ops->update_pmtu(dst, sk, NULL, mtu); |
3098 |
++ dst->ops->update_pmtu(dst, sk, NULL, mtu, true); |
3099 |
+ |
3100 |
+ dst = inet6_csk_route_socket(sk, &fl6); |
3101 |
+ return IS_ERR(dst) ? NULL : dst; |
3102 |
+diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c |
3103 |
+index 228983a5531b..24a21979d7df 100644 |
3104 |
+--- a/net/ipv6/inet6_hashtables.c |
3105 |
++++ b/net/ipv6/inet6_hashtables.c |
3106 |
+@@ -137,9 +137,10 @@ struct sock *inet6_lookup_listener(struct net *net, |
3107 |
+ int score, hiscore = 0, matches = 0, reuseport = 0; |
3108 |
+ bool exact_dif = inet6_exact_dif_match(net, skb); |
3109 |
+ struct sock *sk, *result = NULL; |
3110 |
++ struct hlist_nulls_node *node; |
3111 |
+ u32 phash = 0; |
3112 |
+ |
3113 |
+- sk_for_each(sk, &ilb->head) { |
3114 |
++ sk_nulls_for_each(sk, node, &ilb->nulls_head) { |
3115 |
+ score = compute_score(sk, net, hnum, daddr, dif, sdif, exact_dif); |
3116 |
+ if (score > hiscore) { |
3117 |
+ reuseport = sk->sk_reuseport; |
3118 |
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
3119 |
+index 4228f3b2f347..726ba41133a3 100644 |
3120 |
+--- a/net/ipv6/ip6_gre.c |
3121 |
++++ b/net/ipv6/ip6_gre.c |
3122 |
+@@ -527,7 +527,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, |
3123 |
+ |
3124 |
+ /* TooBig packet may have updated dst->dev's mtu */ |
3125 |
+ if (dst && dst_mtu(dst) > dst->dev->mtu) |
3126 |
+- dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu); |
3127 |
++ dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu, false); |
3128 |
+ |
3129 |
+ return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, |
3130 |
+ NEXTHDR_GRE); |
3131 |
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
3132 |
+index 067fc78cc529..5bc2788e6ba4 100644 |
3133 |
+--- a/net/ipv6/ip6_tunnel.c |
3134 |
++++ b/net/ipv6/ip6_tunnel.c |
3135 |
+@@ -652,7 +652,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
3136 |
+ if (rel_info > dst_mtu(skb_dst(skb2))) |
3137 |
+ goto out; |
3138 |
+ |
3139 |
+- skb_dst_update_pmtu(skb2, rel_info); |
3140 |
++ skb_dst_update_pmtu_no_confirm(skb2, rel_info); |
3141 |
+ } |
3142 |
+ if (rel_type == ICMP_REDIRECT) |
3143 |
+ skb_dst(skb2)->ops->redirect(skb_dst(skb2), NULL, skb2); |
3144 |
+@@ -1138,7 +1138,7 @@ route_lookup: |
3145 |
+ mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ? |
3146 |
+ IPV6_MIN_MTU : IPV4_MIN_MTU); |
3147 |
+ |
3148 |
+- skb_dst_update_pmtu(skb, mtu); |
3149 |
++ skb_dst_update_pmtu_no_confirm(skb, mtu); |
3150 |
+ if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { |
3151 |
+ *pmtu = mtu; |
3152 |
+ err = -EMSGSIZE; |
3153 |
+diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
3154 |
+index 6b2416b4a53e..557fe3880a3f 100644 |
3155 |
+--- a/net/ipv6/ip6_vti.c |
3156 |
++++ b/net/ipv6/ip6_vti.c |
3157 |
+@@ -483,7 +483,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) |
3158 |
+ |
3159 |
+ mtu = dst_mtu(dst); |
3160 |
+ if (skb->len > mtu) { |
3161 |
+- skb_dst_update_pmtu(skb, mtu); |
3162 |
++ skb_dst_update_pmtu_no_confirm(skb, mtu); |
3163 |
+ |
3164 |
+ if (skb->protocol == htons(ETH_P_IPV6)) { |
3165 |
+ if (mtu < IPV6_MIN_MTU) |
3166 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
3167 |
+index 00f8fe8cebd5..b81522bcf223 100644 |
3168 |
+--- a/net/ipv6/route.c |
3169 |
++++ b/net/ipv6/route.c |
3170 |
+@@ -93,7 +93,8 @@ static int ip6_pkt_prohibit(struct sk_buff *skb); |
3171 |
+ static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb); |
3172 |
+ static void ip6_link_failure(struct sk_buff *skb); |
3173 |
+ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3174 |
+- struct sk_buff *skb, u32 mtu); |
3175 |
++ struct sk_buff *skb, u32 mtu, |
3176 |
++ bool confirm_neigh); |
3177 |
+ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, |
3178 |
+ struct sk_buff *skb); |
3179 |
+ static void rt6_dst_from_metrics_check(struct rt6_info *rt); |
3180 |
+@@ -264,7 +265,8 @@ static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
3181 |
+ } |
3182 |
+ |
3183 |
+ static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3184 |
+- struct sk_buff *skb, u32 mtu) |
3185 |
++ struct sk_buff *skb, u32 mtu, |
3186 |
++ bool confirm_neigh) |
3187 |
+ { |
3188 |
+ } |
3189 |
+ |
3190 |
+@@ -1471,7 +1473,8 @@ static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt) |
3191 |
+ } |
3192 |
+ |
3193 |
+ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, |
3194 |
+- const struct ipv6hdr *iph, u32 mtu) |
3195 |
++ const struct ipv6hdr *iph, u32 mtu, |
3196 |
++ bool confirm_neigh) |
3197 |
+ { |
3198 |
+ const struct in6_addr *daddr, *saddr; |
3199 |
+ struct rt6_info *rt6 = (struct rt6_info *)dst; |
3200 |
+@@ -1489,7 +1492,10 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, |
3201 |
+ daddr = NULL; |
3202 |
+ saddr = NULL; |
3203 |
+ } |
3204 |
+- dst_confirm_neigh(dst, daddr); |
3205 |
++ |
3206 |
++ if (confirm_neigh) |
3207 |
++ dst_confirm_neigh(dst, daddr); |
3208 |
++ |
3209 |
+ mtu = max_t(u32, mtu, IPV6_MIN_MTU); |
3210 |
+ if (mtu >= dst_mtu(dst)) |
3211 |
+ return; |
3212 |
+@@ -1518,9 +1524,11 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, |
3213 |
+ } |
3214 |
+ |
3215 |
+ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3216 |
+- struct sk_buff *skb, u32 mtu) |
3217 |
++ struct sk_buff *skb, u32 mtu, |
3218 |
++ bool confirm_neigh) |
3219 |
+ { |
3220 |
+- __ip6_rt_update_pmtu(dst, sk, skb ? ipv6_hdr(skb) : NULL, mtu); |
3221 |
++ __ip6_rt_update_pmtu(dst, sk, skb ? ipv6_hdr(skb) : NULL, mtu, |
3222 |
++ confirm_neigh); |
3223 |
+ } |
3224 |
+ |
3225 |
+ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, |
3226 |
+@@ -1540,7 +1548,7 @@ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, |
3227 |
+ |
3228 |
+ dst = ip6_route_output(net, NULL, &fl6); |
3229 |
+ if (!dst->error) |
3230 |
+- __ip6_rt_update_pmtu(dst, NULL, iph, ntohl(mtu)); |
3231 |
++ __ip6_rt_update_pmtu(dst, NULL, iph, ntohl(mtu), true); |
3232 |
+ dst_release(dst); |
3233 |
+ } |
3234 |
+ EXPORT_SYMBOL_GPL(ip6_update_pmtu); |
3235 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
3236 |
+index d2529c38e7e4..fb3f917db57a 100644 |
3237 |
+--- a/net/ipv6/sit.c |
3238 |
++++ b/net/ipv6/sit.c |
3239 |
+@@ -932,7 +932,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, |
3240 |
+ } |
3241 |
+ |
3242 |
+ if (tunnel->parms.iph.daddr) |
3243 |
+- skb_dst_update_pmtu(skb, mtu); |
3244 |
++ skb_dst_update_pmtu_no_confirm(skb, mtu); |
3245 |
+ |
3246 |
+ if (skb->len > mtu && !skb_is_gso(skb)) { |
3247 |
+ icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
3248 |
+diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c |
3249 |
+index d6b012295b45..b0d80cef7c2b 100644 |
3250 |
+--- a/net/ipv6/xfrm6_policy.c |
3251 |
++++ b/net/ipv6/xfrm6_policy.c |
3252 |
+@@ -219,12 +219,13 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) |
3253 |
+ } |
3254 |
+ |
3255 |
+ static void xfrm6_update_pmtu(struct dst_entry *dst, struct sock *sk, |
3256 |
+- struct sk_buff *skb, u32 mtu) |
3257 |
++ struct sk_buff *skb, u32 mtu, |
3258 |
++ bool confirm_neigh) |
3259 |
+ { |
3260 |
+ struct xfrm_dst *xdst = (struct xfrm_dst *)dst; |
3261 |
+ struct dst_entry *path = xdst->route; |
3262 |
+ |
3263 |
+- path->ops->update_pmtu(path, sk, skb, mtu); |
3264 |
++ path->ops->update_pmtu(path, sk, skb, mtu, confirm_neigh); |
3265 |
+ } |
3266 |
+ |
3267 |
+ static void xfrm6_redirect(struct dst_entry *dst, struct sock *sk, |
3268 |
+diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c |
3269 |
+index 4527921b1c3a..97d411033f8a 100644 |
3270 |
+--- a/net/netfilter/ipvs/ip_vs_xmit.c |
3271 |
++++ b/net/netfilter/ipvs/ip_vs_xmit.c |
3272 |
+@@ -209,7 +209,7 @@ static inline void maybe_update_pmtu(int skb_af, struct sk_buff *skb, int mtu) |
3273 |
+ struct rtable *ort = skb_rtable(skb); |
3274 |
+ |
3275 |
+ if (!skb->dev && sk && sk_fullsock(sk)) |
3276 |
+- ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu); |
3277 |
++ ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu, true); |
3278 |
+ } |
3279 |
+ |
3280 |
+ static inline bool ensure_mtu_is_adequate(struct netns_ipvs *ipvs, int skb_af, |
3281 |
+diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c |
3282 |
+index 37efcc1c8887..b06ef4c62522 100644 |
3283 |
+--- a/net/netfilter/nf_queue.c |
3284 |
++++ b/net/netfilter/nf_queue.c |
3285 |
+@@ -138,7 +138,7 @@ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, |
3286 |
+ goto err; |
3287 |
+ } |
3288 |
+ |
3289 |
+- if (!skb_dst_force(skb) && state->hook != NF_INET_PRE_ROUTING) { |
3290 |
++ if (skb_dst(skb) && !skb_dst_force(skb)) { |
3291 |
+ status = -ENETDOWN; |
3292 |
+ goto err; |
3293 |
+ } |
3294 |
+diff --git a/net/sctp/transport.c b/net/sctp/transport.c |
3295 |
+index 274df899e7bf..4c55b759a58e 100644 |
3296 |
+--- a/net/sctp/transport.c |
3297 |
++++ b/net/sctp/transport.c |
3298 |
+@@ -272,7 +272,7 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
3299 |
+ |
3300 |
+ pf->af->from_sk(&addr, sk); |
3301 |
+ pf->to_sk_daddr(&t->ipaddr, sk); |
3302 |
+- dst->ops->update_pmtu(dst, sk, NULL, pmtu); |
3303 |
++ dst->ops->update_pmtu(dst, sk, NULL, pmtu, true); |
3304 |
+ pf->to_sk_daddr(&addr, sk); |
3305 |
+ |
3306 |
+ dst = sctp_transport_dst_check(t); |
3307 |
+diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c |
3308 |
+index b471022c8162..b43531899648 100644 |
3309 |
+--- a/scripts/kallsyms.c |
3310 |
++++ b/scripts/kallsyms.c |
3311 |
+@@ -510,6 +510,8 @@ static void build_initial_tok_table(void) |
3312 |
+ table[pos] = table[i]; |
3313 |
+ learn_symbol(table[pos].sym, table[pos].len); |
3314 |
+ pos++; |
3315 |
++ } else { |
3316 |
++ free(table[i].sym); |
3317 |
+ } |
3318 |
+ } |
3319 |
+ table_cnt = pos; |
3320 |
+diff --git a/security/apparmor/label.c b/security/apparmor/label.c |
3321 |
+index c5b99b954580..ea63710442ae 100644 |
3322 |
+--- a/security/apparmor/label.c |
3323 |
++++ b/security/apparmor/label.c |
3324 |
+@@ -1463,11 +1463,13 @@ static inline bool use_label_hname(struct aa_ns *ns, struct aa_label *label, |
3325 |
+ /* helper macro for snprint routines */ |
3326 |
+ #define update_for_len(total, len, size, str) \ |
3327 |
+ do { \ |
3328 |
++ size_t ulen = len; \ |
3329 |
++ \ |
3330 |
+ AA_BUG(len < 0); \ |
3331 |
+- total += len; \ |
3332 |
+- len = min(len, size); \ |
3333 |
+- size -= len; \ |
3334 |
+- str += len; \ |
3335 |
++ total += ulen; \ |
3336 |
++ ulen = min(ulen, size); \ |
3337 |
++ size -= ulen; \ |
3338 |
++ str += ulen; \ |
3339 |
+ } while (0) |
3340 |
+ |
3341 |
+ /** |
3342 |
+@@ -1602,7 +1604,7 @@ int aa_label_snxprint(char *str, size_t size, struct aa_ns *ns, |
3343 |
+ struct aa_ns *prev_ns = NULL; |
3344 |
+ struct label_it i; |
3345 |
+ int count = 0, total = 0; |
3346 |
+- size_t len; |
3347 |
++ ssize_t len; |
3348 |
+ |
3349 |
+ AA_BUG(!str && size != 0); |
3350 |
+ AA_BUG(!label); |
3351 |
+diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c |
3352 |
+index 8fcb421193e0..fa261b27d858 100644 |
3353 |
+--- a/sound/pci/hda/hda_controller.c |
3354 |
++++ b/sound/pci/hda/hda_controller.c |
3355 |
+@@ -883,7 +883,7 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, |
3356 |
+ return -EAGAIN; /* give a chance to retry */ |
3357 |
+ } |
3358 |
+ |
3359 |
+- dev_WARN(chip->card->dev, |
3360 |
++ dev_err(chip->card->dev, |
3361 |
+ "azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n", |
3362 |
+ bus->last_cmd[addr]); |
3363 |
+ chip->single_cmd = 1; |
3364 |
+diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c |
3365 |
+index 76789523429a..09c4380bc225 100644 |
3366 |
+--- a/tools/perf/builtin-script.c |
3367 |
++++ b/tools/perf/builtin-script.c |
3368 |
+@@ -355,7 +355,7 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, |
3369 |
+ "selected. Hence, no address to lookup the source line number.\n"); |
3370 |
+ return -EINVAL; |
3371 |
+ } |
3372 |
+- if (PRINT_FIELD(BRSTACKINSN) && |
3373 |
++ if (PRINT_FIELD(BRSTACKINSN) && !allow_user_set && |
3374 |
+ !(perf_evlist__combined_branch_type(session->evlist) & |
3375 |
+ PERF_SAMPLE_BRANCH_ANY)) { |
3376 |
+ pr_err("Display of branch stack assembler requested, but non all-branch filter set\n" |
3377 |
+diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h |
3378 |
+index c9319f8d17a6..f732e3af2bd4 100644 |
3379 |
+--- a/tools/perf/util/perf_regs.h |
3380 |
++++ b/tools/perf/util/perf_regs.h |
3381 |
+@@ -34,7 +34,7 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); |
3382 |
+ |
3383 |
+ static inline const char *perf_reg_name(int id __maybe_unused) |
3384 |
+ { |
3385 |
+- return NULL; |
3386 |
++ return "unknown"; |
3387 |
+ } |
3388 |
+ |
3389 |
+ static inline int perf_reg_value(u64 *valp __maybe_unused, |
3390 |
+diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c |
3391 |
+index 9005fbe0780e..23092fd6451d 100644 |
3392 |
+--- a/tools/perf/util/strbuf.c |
3393 |
++++ b/tools/perf/util/strbuf.c |
3394 |
+@@ -109,7 +109,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap) |
3395 |
+ return ret; |
3396 |
+ } |
3397 |
+ len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved); |
3398 |
+- va_end(ap_saved); |
3399 |
+ if (len > strbuf_avail(sb)) { |
3400 |
+ pr_debug("this should not happen, your vsnprintf is broken"); |
3401 |
+ va_end(ap_saved); |