1 |
commit: e735967d53114565a8f1cca6fee1f471490c4b2b |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 8 14:25:12 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 8 14:25:12 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e735967d |
7 |
|
8 |
Linux patch 4.4.127 |
9 |
|
10 |
0000_README | 8 +- |
11 |
1126_linux-4.4.127.patch | 2344 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 2350 insertions(+), 2 deletions(-) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index a22a4ac..67e1c31 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -543,9 +543,13 @@ Patch: 1124_linux-4.4.125.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.4.125 |
21 |
|
22 |
-Patch: 1125_linux-4.4.125.patch |
23 |
+Patch: 1125_linux-4.4.126.patch |
24 |
From: http://www.kernel.org |
25 |
-Desc: Linux 4.4.125 |
26 |
+Desc: Linux 4.4.126 |
27 |
+ |
28 |
+Patch: 1126_linux-4.4.127.patch |
29 |
+From: http://www.kernel.org |
30 |
+Desc: Linux 4.4.127 |
31 |
|
32 |
Patch: 1500_XATTR_USER_PREFIX.patch |
33 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
34 |
|
35 |
diff --git a/1126_linux-4.4.127.patch b/1126_linux-4.4.127.patch |
36 |
new file mode 100644 |
37 |
index 0000000..8cd3c43 |
38 |
--- /dev/null |
39 |
+++ b/1126_linux-4.4.127.patch |
40 |
@@ -0,0 +1,2344 @@ |
41 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt |
42 |
+index caf297bee1fb..c28d4eb83b76 100644 |
43 |
+--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt |
44 |
++++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt |
45 |
+@@ -35,6 +35,15 @@ Optional properties: |
46 |
+ - ti,palmas-enable-dvfs2: Enable DVFS2. Configure pins for DVFS2 mode. |
47 |
+ Selection primary or secondary function associated to GPADC_START |
48 |
+ and SYSEN2 pin/pad for DVFS2 interface |
49 |
++- ti,palmas-override-powerhold: This is applicable for PMICs for which |
50 |
++ GPIO7 is configured in POWERHOLD mode which has higher priority |
51 |
++ over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON |
52 |
++ bit is turned off. This property enables driver to over ride the |
53 |
++ POWERHOLD value to GPIO7 so as to turn off the PMIC in power off |
54 |
++ scenarios. So for GPIO7 if ti,palmas-override-powerhold is set |
55 |
++ then the GPIO_7 field should never be muxed to anything else. |
56 |
++ It should be set to POWERHOLD by default and only in case of |
57 |
++ power off scenarios the driver will over ride the mux value. |
58 |
+ |
59 |
+ This binding uses the following generic properties as defined in |
60 |
+ pinctrl-bindings.txt: |
61 |
+diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt |
62 |
+index 6716413c17ba..6d2689ebf824 100644 |
63 |
+--- a/Documentation/filesystems/proc.txt |
64 |
++++ b/Documentation/filesystems/proc.txt |
65 |
+@@ -383,32 +383,6 @@ is not associated with a file: |
66 |
+ |
67 |
+ or if empty, the mapping is anonymous. |
68 |
+ |
69 |
+-The /proc/PID/task/TID/maps is a view of the virtual memory from the viewpoint |
70 |
+-of the individual tasks of a process. In this file you will see a mapping marked |
71 |
+-as [stack] if that task sees it as a stack. Hence, for the example above, the |
72 |
+-task-level map, i.e. /proc/PID/task/TID/maps for thread 1001 will look like this: |
73 |
+- |
74 |
+-08048000-08049000 r-xp 00000000 03:00 8312 /opt/test |
75 |
+-08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test |
76 |
+-0804a000-0806b000 rw-p 00000000 00:00 0 [heap] |
77 |
+-a7cb1000-a7cb2000 ---p 00000000 00:00 0 |
78 |
+-a7cb2000-a7eb2000 rw-p 00000000 00:00 0 |
79 |
+-a7eb2000-a7eb3000 ---p 00000000 00:00 0 |
80 |
+-a7eb3000-a7ed5000 rw-p 00000000 00:00 0 [stack] |
81 |
+-a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6 |
82 |
+-a8008000-a800a000 r--p 00133000 03:00 4222 /lib/libc.so.6 |
83 |
+-a800a000-a800b000 rw-p 00135000 03:00 4222 /lib/libc.so.6 |
84 |
+-a800b000-a800e000 rw-p 00000000 00:00 0 |
85 |
+-a800e000-a8022000 r-xp 00000000 03:00 14462 /lib/libpthread.so.0 |
86 |
+-a8022000-a8023000 r--p 00013000 03:00 14462 /lib/libpthread.so.0 |
87 |
+-a8023000-a8024000 rw-p 00014000 03:00 14462 /lib/libpthread.so.0 |
88 |
+-a8024000-a8027000 rw-p 00000000 00:00 0 |
89 |
+-a8027000-a8043000 r-xp 00000000 03:00 8317 /lib/ld-linux.so.2 |
90 |
+-a8043000-a8044000 r--p 0001b000 03:00 8317 /lib/ld-linux.so.2 |
91 |
+-a8044000-a8045000 rw-p 0001c000 03:00 8317 /lib/ld-linux.so.2 |
92 |
+-aff35000-aff4a000 rw-p 00000000 00:00 0 |
93 |
+-ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] |
94 |
+- |
95 |
+ The /proc/PID/smaps is an extension based on maps, showing the memory |
96 |
+ consumption for each of the process's mappings. For each of mappings there |
97 |
+ is a series of lines such as the following: |
98 |
+diff --git a/Makefile b/Makefile |
99 |
+index 2b699c5f6de4..58c0390573c1 100644 |
100 |
+--- a/Makefile |
101 |
++++ b/Makefile |
102 |
+@@ -1,6 +1,6 @@ |
103 |
+ VERSION = 4 |
104 |
+ PATCHLEVEL = 4 |
105 |
+-SUBLEVEL = 126 |
106 |
++SUBLEVEL = 127 |
107 |
+ EXTRAVERSION = |
108 |
+ NAME = Blurry Fish Butt |
109 |
+ |
110 |
+diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts |
111 |
+index 2dbe13a3d89b..7106114c7464 100644 |
112 |
+--- a/arch/arm/boot/dts/am335x-pepper.dts |
113 |
++++ b/arch/arm/boot/dts/am335x-pepper.dts |
114 |
+@@ -139,7 +139,7 @@ |
115 |
+ &audio_codec { |
116 |
+ status = "okay"; |
117 |
+ |
118 |
+- reset-gpios = <&gpio1 16 GPIO_ACTIVE_LOW>; |
119 |
++ gpio-reset = <&gpio1 16 GPIO_ACTIVE_LOW>; |
120 |
+ AVDD-supply = <&ldo3_reg>; |
121 |
+ IOVDD-supply = <&ldo3_reg>; |
122 |
+ DRVDD-supply = <&ldo3_reg>; |
123 |
+diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts |
124 |
+index 00352e761b8c..5c3bd34af9fd 100644 |
125 |
+--- a/arch/arm/boot/dts/am57xx-beagle-x15.dts |
126 |
++++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts |
127 |
+@@ -411,6 +411,7 @@ |
128 |
+ interrupt-controller; |
129 |
+ |
130 |
+ ti,system-power-controller; |
131 |
++ ti,palmas-override-powerhold; |
132 |
+ |
133 |
+ tps659038_pmic { |
134 |
+ compatible = "ti,tps659038-pmic"; |
135 |
+diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts |
136 |
+index 864f60020124..0736d04f032e 100644 |
137 |
+--- a/arch/arm/boot/dts/dra7-evm.dts |
138 |
++++ b/arch/arm/boot/dts/dra7-evm.dts |
139 |
+@@ -410,6 +410,8 @@ |
140 |
+ tps659038: tps659038@58 { |
141 |
+ compatible = "ti,tps659038"; |
142 |
+ reg = <0x58>; |
143 |
++ ti,palmas-override-powerhold; |
144 |
++ ti,system-power-controller; |
145 |
+ |
146 |
+ tps659038_pmic { |
147 |
+ compatible = "ti,tps659038-pmic"; |
148 |
+diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts |
149 |
+index 731860314ab5..27cd4abfc74d 100644 |
150 |
+--- a/arch/arm/boot/dts/omap3-n900.dts |
151 |
++++ b/arch/arm/boot/dts/omap3-n900.dts |
152 |
+@@ -488,7 +488,7 @@ |
153 |
+ tlv320aic3x: tlv320aic3x@18 { |
154 |
+ compatible = "ti,tlv320aic3x"; |
155 |
+ reg = <0x18>; |
156 |
+- reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
157 |
++ gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
158 |
+ ai3x-gpio-func = < |
159 |
+ 0 /* AIC3X_GPIO1_FUNC_DISABLED */ |
160 |
+ 5 /* AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT */ |
161 |
+@@ -505,7 +505,7 @@ |
162 |
+ tlv320aic3x_aux: tlv320aic3x@19 { |
163 |
+ compatible = "ti,tlv320aic3x"; |
164 |
+ reg = <0x19>; |
165 |
+- reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>; /* 60 */ |
166 |
++ gpio-reset = <&gpio2 28 GPIO_ACTIVE_HIGH>; /* 60 */ |
167 |
+ |
168 |
+ AVDD-supply = <&vmmc2>; |
169 |
+ DRVDD-supply = <&vmmc2>; |
170 |
+diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h |
171 |
+index 853953cd1f08..b42b930cc19a 100644 |
172 |
+--- a/arch/arm64/include/asm/memory.h |
173 |
++++ b/arch/arm64/include/asm/memory.h |
174 |
+@@ -49,8 +49,10 @@ |
175 |
+ * and PAGE_OFFSET - it must be within 128MB of the kernel text. |
176 |
+ */ |
177 |
+ #define VA_BITS (CONFIG_ARM64_VA_BITS) |
178 |
+-#define VA_START (UL(0xffffffffffffffff) << VA_BITS) |
179 |
+-#define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1)) |
180 |
++#define VA_START (UL(0xffffffffffffffff) - \ |
181 |
++ (UL(1) << VA_BITS) + 1) |
182 |
++#define PAGE_OFFSET (UL(0xffffffffffffffff) - \ |
183 |
++ (UL(1) << (VA_BITS - 1)) + 1) |
184 |
+ #define MODULES_END (PAGE_OFFSET) |
185 |
+ #define MODULES_VADDR (MODULES_END - SZ_64M) |
186 |
+ #define PCI_IO_END (MODULES_VADDR - SZ_2M) |
187 |
+diff --git a/arch/frv/include/asm/timex.h b/arch/frv/include/asm/timex.h |
188 |
+index a89bddefdacf..139093fab326 100644 |
189 |
+--- a/arch/frv/include/asm/timex.h |
190 |
++++ b/arch/frv/include/asm/timex.h |
191 |
+@@ -16,5 +16,11 @@ static inline cycles_t get_cycles(void) |
192 |
+ #define vxtime_lock() do {} while (0) |
193 |
+ #define vxtime_unlock() do {} while (0) |
194 |
+ |
195 |
++/* This attribute is used in include/linux/jiffies.h alongside with |
196 |
++ * __cacheline_aligned_in_smp. It is assumed that __cacheline_aligned_in_smp |
197 |
++ * for frv does not contain another section specification. |
198 |
++ */ |
199 |
++#define __jiffy_arch_data __attribute__((__section__(".data"))) |
200 |
++ |
201 |
+ #endif |
202 |
+ |
203 |
+diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c |
204 |
+index 8648158f3916..f8fe11d24cde 100644 |
205 |
+--- a/arch/x86/crypto/cast5_avx_glue.c |
206 |
++++ b/arch/x86/crypto/cast5_avx_glue.c |
207 |
+@@ -66,8 +66,6 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, |
208 |
+ void (*fn)(struct cast5_ctx *ctx, u8 *dst, const u8 *src); |
209 |
+ int err; |
210 |
+ |
211 |
+- fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; |
212 |
+- |
213 |
+ err = blkcipher_walk_virt(desc, walk); |
214 |
+ desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
215 |
+ |
216 |
+@@ -79,6 +77,7 @@ static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, |
217 |
+ |
218 |
+ /* Process multi-block batch */ |
219 |
+ if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { |
220 |
++ fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; |
221 |
+ do { |
222 |
+ fn(ctx, wdst, wsrc); |
223 |
+ |
224 |
+diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
225 |
+index 565e24e9ddf2..df9be5b91270 100644 |
226 |
+--- a/arch/x86/kernel/kprobes/core.c |
227 |
++++ b/arch/x86/kernel/kprobes/core.c |
228 |
+@@ -49,6 +49,7 @@ |
229 |
+ #include <linux/kdebug.h> |
230 |
+ #include <linux/kallsyms.h> |
231 |
+ #include <linux/ftrace.h> |
232 |
++#include <linux/moduleloader.h> |
233 |
+ |
234 |
+ #include <asm/cacheflush.h> |
235 |
+ #include <asm/desc.h> |
236 |
+@@ -402,6 +403,14 @@ int __copy_instruction(u8 *dest, u8 *src) |
237 |
+ return length; |
238 |
+ } |
239 |
+ |
240 |
++/* Recover page to RW mode before releasing it */ |
241 |
++void free_insn_page(void *page) |
242 |
++{ |
243 |
++ set_memory_nx((unsigned long)page & PAGE_MASK, 1); |
244 |
++ set_memory_rw((unsigned long)page & PAGE_MASK, 1); |
245 |
++ module_memfree(page); |
246 |
++} |
247 |
++ |
248 |
+ static int arch_copy_kprobe(struct kprobe *p) |
249 |
+ { |
250 |
+ int ret; |
251 |
+diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c |
252 |
+index 5610cd537da7..7d8d50c11ce7 100644 |
253 |
+--- a/block/partitions/msdos.c |
254 |
++++ b/block/partitions/msdos.c |
255 |
+@@ -300,7 +300,9 @@ static void parse_bsd(struct parsed_partitions *state, |
256 |
+ continue; |
257 |
+ bsd_start = le32_to_cpu(p->p_offset); |
258 |
+ bsd_size = le32_to_cpu(p->p_size); |
259 |
+- if (memcmp(flavour, "bsd\0", 4) == 0) |
260 |
++ /* FreeBSD has relative offset if C partition offset is zero */ |
261 |
++ if (memcmp(flavour, "bsd\0", 4) == 0 && |
262 |
++ le32_to_cpu(l->d_partitions[2].p_offset) == 0) |
263 |
+ bsd_start += offset; |
264 |
+ if (offset == bsd_start && size == bsd_size) |
265 |
+ /* full parent partition, we have it already */ |
266 |
+diff --git a/crypto/ahash.c b/crypto/ahash.c |
267 |
+index 7006dbfd39bd..6978ad86e516 100644 |
268 |
+--- a/crypto/ahash.c |
269 |
++++ b/crypto/ahash.c |
270 |
+@@ -91,13 +91,14 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) |
271 |
+ |
272 |
+ if (nbytes && walk->offset & alignmask && !err) { |
273 |
+ walk->offset = ALIGN(walk->offset, alignmask + 1); |
274 |
+- walk->data += walk->offset; |
275 |
+- |
276 |
+ nbytes = min(nbytes, |
277 |
+ ((unsigned int)(PAGE_SIZE)) - walk->offset); |
278 |
+ walk->entrylen -= nbytes; |
279 |
+ |
280 |
+- return nbytes; |
281 |
++ if (nbytes) { |
282 |
++ walk->data += walk->offset; |
283 |
++ return nbytes; |
284 |
++ } |
285 |
+ } |
286 |
+ |
287 |
+ if (walk->flags & CRYPTO_ALG_ASYNC) |
288 |
+diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c |
289 |
+index 8a10a7ae6a8a..c8e169e46673 100644 |
290 |
+--- a/drivers/acpi/pci_irq.c |
291 |
++++ b/drivers/acpi/pci_irq.c |
292 |
+@@ -131,9 +131,6 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, |
293 |
+ quirk = &prt_quirks[i]; |
294 |
+ |
295 |
+ /* All current quirks involve link devices, not GSIs */ |
296 |
+- if (!prt->source) |
297 |
+- continue; |
298 |
+- |
299 |
+ if (dmi_check_system(quirk->system) && |
300 |
+ entry->id.segment == quirk->segment && |
301 |
+ entry->id.bus == quirk->bus && |
302 |
+diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c |
303 |
+index 9ba89315dae1..55d3d1da72de 100644 |
304 |
+--- a/drivers/block/mtip32xx/mtip32xx.c |
305 |
++++ b/drivers/block/mtip32xx/mtip32xx.c |
306 |
+@@ -169,25 +169,6 @@ static bool mtip_check_surprise_removal(struct pci_dev *pdev) |
307 |
+ return false; /* device present */ |
308 |
+ } |
309 |
+ |
310 |
+-/* we have to use runtime tag to setup command header */ |
311 |
+-static void mtip_init_cmd_header(struct request *rq) |
312 |
+-{ |
313 |
+- struct driver_data *dd = rq->q->queuedata; |
314 |
+- struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
315 |
+- u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; |
316 |
+- |
317 |
+- /* Point the command headers at the command tables. */ |
318 |
+- cmd->command_header = dd->port->command_list + |
319 |
+- (sizeof(struct mtip_cmd_hdr) * rq->tag); |
320 |
+- cmd->command_header_dma = dd->port->command_list_dma + |
321 |
+- (sizeof(struct mtip_cmd_hdr) * rq->tag); |
322 |
+- |
323 |
+- if (host_cap_64) |
324 |
+- cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16); |
325 |
+- |
326 |
+- cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF); |
327 |
+-} |
328 |
+- |
329 |
+ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) |
330 |
+ { |
331 |
+ struct request *rq; |
332 |
+@@ -199,9 +180,6 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) |
333 |
+ if (IS_ERR(rq)) |
334 |
+ return NULL; |
335 |
+ |
336 |
+- /* Internal cmd isn't submitted via .queue_rq */ |
337 |
+- mtip_init_cmd_header(rq); |
338 |
+- |
339 |
+ return blk_mq_rq_to_pdu(rq); |
340 |
+ } |
341 |
+ |
342 |
+@@ -3840,8 +3818,6 @@ static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx, |
343 |
+ struct request *rq = bd->rq; |
344 |
+ int ret; |
345 |
+ |
346 |
+- mtip_init_cmd_header(rq); |
347 |
+- |
348 |
+ if (unlikely(mtip_check_unal_depth(hctx, rq))) |
349 |
+ return BLK_MQ_RQ_QUEUE_BUSY; |
350 |
+ |
351 |
+@@ -3873,6 +3849,7 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, |
352 |
+ { |
353 |
+ struct driver_data *dd = data; |
354 |
+ struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
355 |
++ u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; |
356 |
+ |
357 |
+ /* |
358 |
+ * For flush requests, request_idx starts at the end of the |
359 |
+@@ -3889,6 +3866,17 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, |
360 |
+ |
361 |
+ memset(cmd->command, 0, CMD_DMA_ALLOC_SZ); |
362 |
+ |
363 |
++ /* Point the command headers at the command tables. */ |
364 |
++ cmd->command_header = dd->port->command_list + |
365 |
++ (sizeof(struct mtip_cmd_hdr) * request_idx); |
366 |
++ cmd->command_header_dma = dd->port->command_list_dma + |
367 |
++ (sizeof(struct mtip_cmd_hdr) * request_idx); |
368 |
++ |
369 |
++ if (host_cap_64) |
370 |
++ cmd->command_header->ctbau = __force_bit2int cpu_to_le32((cmd->command_dma >> 16) >> 16); |
371 |
++ |
372 |
++ cmd->command_header->ctba = __force_bit2int cpu_to_le32(cmd->command_dma & 0xFFFFFFFF); |
373 |
++ |
374 |
+ sg_init_table(cmd->sg, MTIP_MAX_SG); |
375 |
+ return 0; |
376 |
+ } |
377 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
378 |
+index c0fb6f12f547..ebed319657e7 100644 |
379 |
+--- a/drivers/cpufreq/cpufreq.c |
380 |
++++ b/drivers/cpufreq/cpufreq.c |
381 |
+@@ -551,8 +551,6 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, |
382 |
+ *governor = t; |
383 |
+ err = 0; |
384 |
+ } |
385 |
+- if (t && !try_module_get(t->owner)) |
386 |
+- t = NULL; |
387 |
+ |
388 |
+ mutex_unlock(&cpufreq_governor_mutex); |
389 |
+ } |
390 |
+@@ -671,10 +669,6 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, |
391 |
+ return -EINVAL; |
392 |
+ |
393 |
+ ret = cpufreq_set_policy(policy, &new_policy); |
394 |
+- |
395 |
+- if (new_policy.governor) |
396 |
+- module_put(new_policy.governor->owner); |
397 |
+- |
398 |
+ return ret ? ret : count; |
399 |
+ } |
400 |
+ |
401 |
+diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c |
402 |
+index 6a8024d9d742..864a7c8d82d3 100644 |
403 |
+--- a/drivers/infiniband/core/addr.c |
404 |
++++ b/drivers/infiniband/core/addr.c |
405 |
+@@ -86,6 +86,22 @@ int rdma_addr_size(struct sockaddr *addr) |
406 |
+ } |
407 |
+ EXPORT_SYMBOL(rdma_addr_size); |
408 |
+ |
409 |
++int rdma_addr_size_in6(struct sockaddr_in6 *addr) |
410 |
++{ |
411 |
++ int ret = rdma_addr_size((struct sockaddr *) addr); |
412 |
++ |
413 |
++ return ret <= sizeof(*addr) ? ret : 0; |
414 |
++} |
415 |
++EXPORT_SYMBOL(rdma_addr_size_in6); |
416 |
++ |
417 |
++int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr) |
418 |
++{ |
419 |
++ int ret = rdma_addr_size((struct sockaddr *) addr); |
420 |
++ |
421 |
++ return ret <= sizeof(*addr) ? ret : 0; |
422 |
++} |
423 |
++EXPORT_SYMBOL(rdma_addr_size_kss); |
424 |
++ |
425 |
+ static struct rdma_addr_client self; |
426 |
+ |
427 |
+ void rdma_addr_register_client(struct rdma_addr_client *client) |
428 |
+diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
429 |
+index cdac2c9421ab..960fcb613198 100644 |
430 |
+--- a/drivers/infiniband/core/ucma.c |
431 |
++++ b/drivers/infiniband/core/ucma.c |
432 |
+@@ -131,7 +131,7 @@ static inline struct ucma_context *_ucma_find_context(int id, |
433 |
+ ctx = idr_find(&ctx_idr, id); |
434 |
+ if (!ctx) |
435 |
+ ctx = ERR_PTR(-ENOENT); |
436 |
+- else if (ctx->file != file) |
437 |
++ else if (ctx->file != file || !ctx->cm_id) |
438 |
+ ctx = ERR_PTR(-EINVAL); |
439 |
+ return ctx; |
440 |
+ } |
441 |
+@@ -453,6 +453,7 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
442 |
+ struct rdma_ucm_create_id cmd; |
443 |
+ struct rdma_ucm_create_id_resp resp; |
444 |
+ struct ucma_context *ctx; |
445 |
++ struct rdma_cm_id *cm_id; |
446 |
+ enum ib_qp_type qp_type; |
447 |
+ int ret; |
448 |
+ |
449 |
+@@ -473,10 +474,10 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
450 |
+ return -ENOMEM; |
451 |
+ |
452 |
+ ctx->uid = cmd.uid; |
453 |
+- ctx->cm_id = rdma_create_id(current->nsproxy->net_ns, |
454 |
+- ucma_event_handler, ctx, cmd.ps, qp_type); |
455 |
+- if (IS_ERR(ctx->cm_id)) { |
456 |
+- ret = PTR_ERR(ctx->cm_id); |
457 |
++ cm_id = rdma_create_id(current->nsproxy->net_ns, |
458 |
++ ucma_event_handler, ctx, cmd.ps, qp_type); |
459 |
++ if (IS_ERR(cm_id)) { |
460 |
++ ret = PTR_ERR(cm_id); |
461 |
+ goto err1; |
462 |
+ } |
463 |
+ |
464 |
+@@ -486,14 +487,19 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, |
465 |
+ ret = -EFAULT; |
466 |
+ goto err2; |
467 |
+ } |
468 |
++ |
469 |
++ ctx->cm_id = cm_id; |
470 |
+ return 0; |
471 |
+ |
472 |
+ err2: |
473 |
+- rdma_destroy_id(ctx->cm_id); |
474 |
++ rdma_destroy_id(cm_id); |
475 |
+ err1: |
476 |
+ mutex_lock(&mut); |
477 |
+ idr_remove(&ctx_idr, ctx->id); |
478 |
+ mutex_unlock(&mut); |
479 |
++ mutex_lock(&file->mut); |
480 |
++ list_del(&ctx->list); |
481 |
++ mutex_unlock(&file->mut); |
482 |
+ kfree(ctx); |
483 |
+ return ret; |
484 |
+ } |
485 |
+@@ -623,6 +629,9 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf, |
486 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
487 |
+ return -EFAULT; |
488 |
+ |
489 |
++ if (!rdma_addr_size_in6(&cmd.addr)) |
490 |
++ return -EINVAL; |
491 |
++ |
492 |
+ ctx = ucma_get_ctx(file, cmd.id); |
493 |
+ if (IS_ERR(ctx)) |
494 |
+ return PTR_ERR(ctx); |
495 |
+@@ -636,22 +645,21 @@ static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf, |
496 |
+ int in_len, int out_len) |
497 |
+ { |
498 |
+ struct rdma_ucm_bind cmd; |
499 |
+- struct sockaddr *addr; |
500 |
+ struct ucma_context *ctx; |
501 |
+ int ret; |
502 |
+ |
503 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
504 |
+ return -EFAULT; |
505 |
+ |
506 |
+- addr = (struct sockaddr *) &cmd.addr; |
507 |
+- if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr))) |
508 |
++ if (cmd.reserved || !cmd.addr_size || |
509 |
++ cmd.addr_size != rdma_addr_size_kss(&cmd.addr)) |
510 |
+ return -EINVAL; |
511 |
+ |
512 |
+ ctx = ucma_get_ctx(file, cmd.id); |
513 |
+ if (IS_ERR(ctx)) |
514 |
+ return PTR_ERR(ctx); |
515 |
+ |
516 |
+- ret = rdma_bind_addr(ctx->cm_id, addr); |
517 |
++ ret = rdma_bind_addr(ctx->cm_id, (struct sockaddr *) &cmd.addr); |
518 |
+ ucma_put_ctx(ctx); |
519 |
+ return ret; |
520 |
+ } |
521 |
+@@ -667,13 +675,16 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file, |
522 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
523 |
+ return -EFAULT; |
524 |
+ |
525 |
++ if (!rdma_addr_size_in6(&cmd.src_addr) || |
526 |
++ !rdma_addr_size_in6(&cmd.dst_addr)) |
527 |
++ return -EINVAL; |
528 |
++ |
529 |
+ ctx = ucma_get_ctx(file, cmd.id); |
530 |
+ if (IS_ERR(ctx)) |
531 |
+ return PTR_ERR(ctx); |
532 |
+ |
533 |
+ ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, |
534 |
+- (struct sockaddr *) &cmd.dst_addr, |
535 |
+- cmd.timeout_ms); |
536 |
++ (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); |
537 |
+ ucma_put_ctx(ctx); |
538 |
+ return ret; |
539 |
+ } |
540 |
+@@ -683,24 +694,23 @@ static ssize_t ucma_resolve_addr(struct ucma_file *file, |
541 |
+ int in_len, int out_len) |
542 |
+ { |
543 |
+ struct rdma_ucm_resolve_addr cmd; |
544 |
+- struct sockaddr *src, *dst; |
545 |
+ struct ucma_context *ctx; |
546 |
+ int ret; |
547 |
+ |
548 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
549 |
+ return -EFAULT; |
550 |
+ |
551 |
+- src = (struct sockaddr *) &cmd.src_addr; |
552 |
+- dst = (struct sockaddr *) &cmd.dst_addr; |
553 |
+- if (cmd.reserved || (cmd.src_size && (cmd.src_size != rdma_addr_size(src))) || |
554 |
+- !cmd.dst_size || (cmd.dst_size != rdma_addr_size(dst))) |
555 |
++ if (cmd.reserved || |
556 |
++ (cmd.src_size && (cmd.src_size != rdma_addr_size_kss(&cmd.src_addr))) || |
557 |
++ !cmd.dst_size || (cmd.dst_size != rdma_addr_size_kss(&cmd.dst_addr))) |
558 |
+ return -EINVAL; |
559 |
+ |
560 |
+ ctx = ucma_get_ctx(file, cmd.id); |
561 |
+ if (IS_ERR(ctx)) |
562 |
+ return PTR_ERR(ctx); |
563 |
+ |
564 |
+- ret = rdma_resolve_addr(ctx->cm_id, src, dst, cmd.timeout_ms); |
565 |
++ ret = rdma_resolve_addr(ctx->cm_id, (struct sockaddr *) &cmd.src_addr, |
566 |
++ (struct sockaddr *) &cmd.dst_addr, cmd.timeout_ms); |
567 |
+ ucma_put_ctx(ctx); |
568 |
+ return ret; |
569 |
+ } |
570 |
+@@ -1145,6 +1155,11 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file, |
571 |
+ if (IS_ERR(ctx)) |
572 |
+ return PTR_ERR(ctx); |
573 |
+ |
574 |
++ if (!ctx->cm_id->device) { |
575 |
++ ret = -EINVAL; |
576 |
++ goto out; |
577 |
++ } |
578 |
++ |
579 |
+ resp.qp_attr_mask = 0; |
580 |
+ memset(&qp_attr, 0, sizeof qp_attr); |
581 |
+ qp_attr.qp_state = cmd.qp_state; |
582 |
+@@ -1301,7 +1316,7 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, |
583 |
+ { |
584 |
+ struct rdma_ucm_notify cmd; |
585 |
+ struct ucma_context *ctx; |
586 |
+- int ret; |
587 |
++ int ret = -EINVAL; |
588 |
+ |
589 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
590 |
+ return -EFAULT; |
591 |
+@@ -1310,7 +1325,9 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf, |
592 |
+ if (IS_ERR(ctx)) |
593 |
+ return PTR_ERR(ctx); |
594 |
+ |
595 |
+- ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event); |
596 |
++ if (ctx->cm_id->device) |
597 |
++ ret = rdma_notify(ctx->cm_id, (enum ib_event_type)cmd.event); |
598 |
++ |
599 |
+ ucma_put_ctx(ctx); |
600 |
+ return ret; |
601 |
+ } |
602 |
+@@ -1328,7 +1345,7 @@ static ssize_t ucma_process_join(struct ucma_file *file, |
603 |
+ return -ENOSPC; |
604 |
+ |
605 |
+ addr = (struct sockaddr *) &cmd->addr; |
606 |
+- if (cmd->reserved || !cmd->addr_size || (cmd->addr_size != rdma_addr_size(addr))) |
607 |
++ if (cmd->reserved || (cmd->addr_size != rdma_addr_size(addr))) |
608 |
+ return -EINVAL; |
609 |
+ |
610 |
+ ctx = ucma_get_ctx(file, cmd->id); |
611 |
+@@ -1387,7 +1404,10 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file, |
612 |
+ join_cmd.response = cmd.response; |
613 |
+ join_cmd.uid = cmd.uid; |
614 |
+ join_cmd.id = cmd.id; |
615 |
+- join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr); |
616 |
++ join_cmd.addr_size = rdma_addr_size_in6(&cmd.addr); |
617 |
++ if (!join_cmd.addr_size) |
618 |
++ return -EINVAL; |
619 |
++ |
620 |
+ join_cmd.reserved = 0; |
621 |
+ memcpy(&join_cmd.addr, &cmd.addr, join_cmd.addr_size); |
622 |
+ |
623 |
+@@ -1403,6 +1423,9 @@ static ssize_t ucma_join_multicast(struct ucma_file *file, |
624 |
+ if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
625 |
+ return -EFAULT; |
626 |
+ |
627 |
++ if (!rdma_addr_size_kss(&cmd.addr)) |
628 |
++ return -EINVAL; |
629 |
++ |
630 |
+ return ucma_process_join(file, &cmd, out_len); |
631 |
+ } |
632 |
+ |
633 |
+diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c |
634 |
+index b604564dec5c..30328e57fdda 100644 |
635 |
+--- a/drivers/input/mousedev.c |
636 |
++++ b/drivers/input/mousedev.c |
637 |
+@@ -15,6 +15,7 @@ |
638 |
+ #define MOUSEDEV_MINORS 31 |
639 |
+ #define MOUSEDEV_MIX 63 |
640 |
+ |
641 |
++#include <linux/bitops.h> |
642 |
+ #include <linux/sched.h> |
643 |
+ #include <linux/slab.h> |
644 |
+ #include <linux/poll.h> |
645 |
+@@ -103,7 +104,7 @@ struct mousedev_client { |
646 |
+ spinlock_t packet_lock; |
647 |
+ int pos_x, pos_y; |
648 |
+ |
649 |
+- signed char ps2[6]; |
650 |
++ u8 ps2[6]; |
651 |
+ unsigned char ready, buffer, bufsiz; |
652 |
+ unsigned char imexseq, impsseq; |
653 |
+ enum mousedev_emul mode; |
654 |
+@@ -291,11 +292,10 @@ static void mousedev_notify_readers(struct mousedev *mousedev, |
655 |
+ } |
656 |
+ |
657 |
+ client->pos_x += packet->dx; |
658 |
+- client->pos_x = client->pos_x < 0 ? |
659 |
+- 0 : (client->pos_x >= xres ? xres : client->pos_x); |
660 |
++ client->pos_x = clamp_val(client->pos_x, 0, xres); |
661 |
++ |
662 |
+ client->pos_y += packet->dy; |
663 |
+- client->pos_y = client->pos_y < 0 ? |
664 |
+- 0 : (client->pos_y >= yres ? yres : client->pos_y); |
665 |
++ client->pos_y = clamp_val(client->pos_y, 0, yres); |
666 |
+ |
667 |
+ p->dx += packet->dx; |
668 |
+ p->dy += packet->dy; |
669 |
+@@ -571,44 +571,50 @@ static int mousedev_open(struct inode *inode, struct file *file) |
670 |
+ return error; |
671 |
+ } |
672 |
+ |
673 |
+-static inline int mousedev_limit_delta(int delta, int limit) |
674 |
+-{ |
675 |
+- return delta > limit ? limit : (delta < -limit ? -limit : delta); |
676 |
+-} |
677 |
+- |
678 |
+-static void mousedev_packet(struct mousedev_client *client, |
679 |
+- signed char *ps2_data) |
680 |
++static void mousedev_packet(struct mousedev_client *client, u8 *ps2_data) |
681 |
+ { |
682 |
+ struct mousedev_motion *p = &client->packets[client->tail]; |
683 |
++ s8 dx, dy, dz; |
684 |
++ |
685 |
++ dx = clamp_val(p->dx, -127, 127); |
686 |
++ p->dx -= dx; |
687 |
++ |
688 |
++ dy = clamp_val(p->dy, -127, 127); |
689 |
++ p->dy -= dy; |
690 |
+ |
691 |
+- ps2_data[0] = 0x08 | |
692 |
+- ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); |
693 |
+- ps2_data[1] = mousedev_limit_delta(p->dx, 127); |
694 |
+- ps2_data[2] = mousedev_limit_delta(p->dy, 127); |
695 |
+- p->dx -= ps2_data[1]; |
696 |
+- p->dy -= ps2_data[2]; |
697 |
++ ps2_data[0] = BIT(3); |
698 |
++ ps2_data[0] |= ((dx & BIT(7)) >> 3) | ((dy & BIT(7)) >> 2); |
699 |
++ ps2_data[0] |= p->buttons & 0x07; |
700 |
++ ps2_data[1] = dx; |
701 |
++ ps2_data[2] = dy; |
702 |
+ |
703 |
+ switch (client->mode) { |
704 |
+ case MOUSEDEV_EMUL_EXPS: |
705 |
+- ps2_data[3] = mousedev_limit_delta(p->dz, 7); |
706 |
+- p->dz -= ps2_data[3]; |
707 |
+- ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); |
708 |
++ dz = clamp_val(p->dz, -7, 7); |
709 |
++ p->dz -= dz; |
710 |
++ |
711 |
++ ps2_data[3] = (dz & 0x0f) | ((p->buttons & 0x18) << 1); |
712 |
+ client->bufsiz = 4; |
713 |
+ break; |
714 |
+ |
715 |
+ case MOUSEDEV_EMUL_IMPS: |
716 |
+- ps2_data[0] |= |
717 |
+- ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); |
718 |
+- ps2_data[3] = mousedev_limit_delta(p->dz, 127); |
719 |
+- p->dz -= ps2_data[3]; |
720 |
++ dz = clamp_val(p->dz, -127, 127); |
721 |
++ p->dz -= dz; |
722 |
++ |
723 |
++ ps2_data[0] |= ((p->buttons & 0x10) >> 3) | |
724 |
++ ((p->buttons & 0x08) >> 1); |
725 |
++ ps2_data[3] = dz; |
726 |
++ |
727 |
+ client->bufsiz = 4; |
728 |
+ break; |
729 |
+ |
730 |
+ case MOUSEDEV_EMUL_PS2: |
731 |
+ default: |
732 |
+- ps2_data[0] |= |
733 |
+- ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); |
734 |
+ p->dz = 0; |
735 |
++ |
736 |
++ ps2_data[0] |= ((p->buttons & 0x10) >> 3) | |
737 |
++ ((p->buttons & 0x08) >> 1); |
738 |
++ |
739 |
+ client->bufsiz = 3; |
740 |
+ break; |
741 |
+ } |
742 |
+@@ -714,7 +720,7 @@ static ssize_t mousedev_read(struct file *file, char __user *buffer, |
743 |
+ { |
744 |
+ struct mousedev_client *client = file->private_data; |
745 |
+ struct mousedev *mousedev = client->mousedev; |
746 |
+- signed char data[sizeof(client->ps2)]; |
747 |
++ u8 data[sizeof(client->ps2)]; |
748 |
+ int retval = 0; |
749 |
+ |
750 |
+ if (!client->ready && !client->buffer && mousedev->exist && |
751 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
752 |
+index d1051e3ce819..e484ea2dc787 100644 |
753 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
754 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
755 |
+@@ -530,6 +530,20 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
756 |
+ { } |
757 |
+ }; |
758 |
+ |
759 |
++static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = { |
760 |
++ { |
761 |
++ /* |
762 |
++ * Sony Vaio VGN-CS series require MUX or the touch sensor |
763 |
++ * buttons will disturb touchpad operation |
764 |
++ */ |
765 |
++ .matches = { |
766 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
767 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"), |
768 |
++ }, |
769 |
++ }, |
770 |
++ { } |
771 |
++}; |
772 |
++ |
773 |
+ /* |
774 |
+ * On some Asus laptops, just running self tests cause problems. |
775 |
+ */ |
776 |
+@@ -692,6 +706,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { |
777 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "20046"), |
778 |
+ }, |
779 |
+ }, |
780 |
++ { |
781 |
++ /* Lenovo ThinkPad L460 */ |
782 |
++ .matches = { |
783 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
784 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"), |
785 |
++ }, |
786 |
++ }, |
787 |
+ { |
788 |
+ /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */ |
789 |
+ .matches = { |
790 |
+@@ -1223,6 +1244,9 @@ static int __init i8042_platform_init(void) |
791 |
+ if (dmi_check_system(i8042_dmi_nomux_table)) |
792 |
+ i8042_nomux = true; |
793 |
+ |
794 |
++ if (dmi_check_system(i8042_dmi_forcemux_table)) |
795 |
++ i8042_nomux = false; |
796 |
++ |
797 |
+ if (dmi_check_system(i8042_dmi_notimeout_table)) |
798 |
+ i8042_notimeout = true; |
799 |
+ |
800 |
+diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c |
801 |
+index e503279c34fc..6865b186f749 100644 |
802 |
+--- a/drivers/md/dm-ioctl.c |
803 |
++++ b/drivers/md/dm-ioctl.c |
804 |
+@@ -1773,12 +1773,12 @@ static int validate_params(uint cmd, struct dm_ioctl *param) |
805 |
+ cmd == DM_LIST_VERSIONS_CMD) |
806 |
+ return 0; |
807 |
+ |
808 |
+- if ((cmd == DM_DEV_CREATE_CMD)) { |
809 |
++ if (cmd == DM_DEV_CREATE_CMD) { |
810 |
+ if (!*param->name) { |
811 |
+ DMWARN("name not supplied when creating device"); |
812 |
+ return -EINVAL; |
813 |
+ } |
814 |
+- } else if ((*param->uuid && *param->name)) { |
815 |
++ } else if (*param->uuid && *param->name) { |
816 |
+ DMWARN("only supply one of name or uuid, cmd(%u)", cmd); |
817 |
+ return -EINVAL; |
818 |
+ } |
819 |
+diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
820 |
+index 3a0d557146c7..bf0410403a6f 100644 |
821 |
+--- a/drivers/md/raid10.c |
822 |
++++ b/drivers/md/raid10.c |
823 |
+@@ -3638,6 +3638,7 @@ static int run(struct mddev *mddev) |
824 |
+ |
825 |
+ if (blk_queue_discard(bdev_get_queue(rdev->bdev))) |
826 |
+ discard_supported = true; |
827 |
++ first = 0; |
828 |
+ } |
829 |
+ |
830 |
+ if (mddev->queue) { |
831 |
+diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c |
832 |
+index 3bbc77aa6a33..483457d4904f 100644 |
833 |
+--- a/drivers/media/usb/usbtv/usbtv-core.c |
834 |
++++ b/drivers/media/usb/usbtv/usbtv-core.c |
835 |
+@@ -95,6 +95,8 @@ static int usbtv_probe(struct usb_interface *intf, |
836 |
+ return 0; |
837 |
+ |
838 |
+ usbtv_audio_fail: |
839 |
++ /* we must not free at this point */ |
840 |
++ usb_get_dev(usbtv->udev); |
841 |
+ usbtv_video_free(usbtv); |
842 |
+ |
843 |
+ usbtv_video_fail: |
844 |
+diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c |
845 |
+index 4ef189a7a2fb..8c04e342e30a 100644 |
846 |
+--- a/drivers/misc/mei/main.c |
847 |
++++ b/drivers/misc/mei/main.c |
848 |
+@@ -571,7 +571,6 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) |
849 |
+ break; |
850 |
+ |
851 |
+ default: |
852 |
+- dev_err(dev->dev, ": unsupported ioctl %d.\n", cmd); |
853 |
+ rets = -ENOIOCTLCMD; |
854 |
+ } |
855 |
+ |
856 |
+diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c |
857 |
+index 7c0b27d132b1..b479bd81120b 100644 |
858 |
+--- a/drivers/mtd/chips/jedec_probe.c |
859 |
++++ b/drivers/mtd/chips/jedec_probe.c |
860 |
+@@ -1889,6 +1889,8 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base, |
861 |
+ do { |
862 |
+ uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi); |
863 |
+ mask = (1 << (cfi->device_type * 8)) - 1; |
864 |
++ if (ofs >= map->size) |
865 |
++ return 0; |
866 |
+ result = map_read(map, base + ofs); |
867 |
+ bank++; |
868 |
+ } while ((result.x[0] & mask) == CFI_MFR_CONTINUATION); |
869 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c |
870 |
+index cc1725616f9d..50747573f42e 100644 |
871 |
+--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c |
872 |
++++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c |
873 |
+@@ -2823,7 +2823,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) |
874 |
+ if (!g) { |
875 |
+ netif_info(lio, tx_err, lio->netdev, |
876 |
+ "Transmit scatter gather: glist null!\n"); |
877 |
+- goto lio_xmit_dma_failed; |
878 |
++ goto lio_xmit_failed; |
879 |
+ } |
880 |
+ |
881 |
+ cmdsetup.s.gather = 1; |
882 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
883 |
+index a20bd8362712..b8517b00e706 100644 |
884 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
885 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |
886 |
+@@ -648,7 +648,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data) |
887 |
+ |
888 |
+ static int hns_gmac_get_sset_count(int stringset) |
889 |
+ { |
890 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
891 |
++ if (stringset == ETH_SS_STATS) |
892 |
+ return ARRAY_SIZE(g_gmac_stats_string); |
893 |
+ |
894 |
+ return 0; |
895 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
896 |
+index 6634aef0e841..67f33f185a44 100644 |
897 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
898 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |
899 |
+@@ -384,7 +384,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb) |
900 |
+ |
901 |
+ int hns_ppe_get_sset_count(int stringset) |
902 |
+ { |
903 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
904 |
++ if (stringset == ETH_SS_STATS) |
905 |
+ return ETH_PPE_STATIC_NUM; |
906 |
+ return 0; |
907 |
+ } |
908 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
909 |
+index 1d5b18d7a1d7..4db32c62f062 100644 |
910 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
911 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |
912 |
+@@ -807,7 +807,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data) |
913 |
+ */ |
914 |
+ int hns_rcb_get_ring_sset_count(int stringset) |
915 |
+ { |
916 |
+- if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS) |
917 |
++ if (stringset == ETH_SS_STATS) |
918 |
+ return HNS_RING_STATIC_REG_NUM; |
919 |
+ |
920 |
+ return 0; |
921 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
922 |
+index a0332129970b..4b91eb70c683 100644 |
923 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
924 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |
925 |
+@@ -1000,8 +1000,10 @@ int hns_get_sset_count(struct net_device *netdev, int stringset) |
926 |
+ cnt--; |
927 |
+ |
928 |
+ return cnt; |
929 |
+- } else { |
930 |
++ } else if (stringset == ETH_SS_STATS) { |
931 |
+ return (HNS_NET_STATS_CNT + ops->get_sset_count(h, stringset)); |
932 |
++ } else { |
933 |
++ return -EOPNOTSUPP; |
934 |
+ } |
935 |
+ } |
936 |
+ |
937 |
+diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c |
938 |
+index 78530d1714dc..bdce0679674c 100644 |
939 |
+--- a/drivers/parport/parport_pc.c |
940 |
++++ b/drivers/parport/parport_pc.c |
941 |
+@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards { |
942 |
+ netmos_9901, |
943 |
+ netmos_9865, |
944 |
+ quatech_sppxp100, |
945 |
++ wch_ch382l, |
946 |
+ }; |
947 |
+ |
948 |
+ |
949 |
+@@ -2708,6 +2709,7 @@ static struct parport_pc_pci { |
950 |
+ /* netmos_9901 */ { 1, { { 0, -1 }, } }, |
951 |
+ /* netmos_9865 */ { 1, { { 0, -1 }, } }, |
952 |
+ /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, |
953 |
++ /* wch_ch382l */ { 1, { { 2, -1 }, } }, |
954 |
+ }; |
955 |
+ |
956 |
+ static const struct pci_device_id parport_pc_pci_tbl[] = { |
957 |
+@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { |
958 |
+ /* Quatech SPPXP-100 Parallel port PCI ExpressCard */ |
959 |
+ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, |
960 |
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, |
961 |
++ /* WCH CH382L PCI-E single parallel port card */ |
962 |
++ { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l }, |
963 |
+ { 0, } /* terminate list */ |
964 |
+ }; |
965 |
+ MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl); |
966 |
+diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c |
967 |
+index 5e42b5f2f565..32bd8ab79d53 100644 |
968 |
+--- a/drivers/pci/pci-driver.c |
969 |
++++ b/drivers/pci/pci-driver.c |
970 |
+@@ -463,6 +463,8 @@ static void pci_device_shutdown(struct device *dev) |
971 |
+ |
972 |
+ if (drv && drv->shutdown) |
973 |
+ drv->shutdown(pci_dev); |
974 |
++ pci_msi_shutdown(pci_dev); |
975 |
++ pci_msix_shutdown(pci_dev); |
976 |
+ |
977 |
+ #ifdef CONFIG_KEXEC_CORE |
978 |
+ /* |
979 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
980 |
+index 193ac13de49b..566897f24dee 100644 |
981 |
+--- a/drivers/pci/probe.c |
982 |
++++ b/drivers/pci/probe.c |
983 |
+@@ -230,7 +230,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, |
984 |
+ res->flags |= IORESOURCE_ROM_ENABLE; |
985 |
+ l64 = l & PCI_ROM_ADDRESS_MASK; |
986 |
+ sz64 = sz & PCI_ROM_ADDRESS_MASK; |
987 |
+- mask64 = (u32)PCI_ROM_ADDRESS_MASK; |
988 |
++ mask64 = PCI_ROM_ADDRESS_MASK; |
989 |
+ } |
990 |
+ |
991 |
+ if (res->flags & IORESOURCE_MEM_64) { |
992 |
+diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c |
993 |
+index 25062966cbfa..8b2f8b2a574e 100644 |
994 |
+--- a/drivers/pci/setup-res.c |
995 |
++++ b/drivers/pci/setup-res.c |
996 |
+@@ -63,7 +63,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno) |
997 |
+ mask = (u32)PCI_BASE_ADDRESS_IO_MASK; |
998 |
+ new |= res->flags & ~PCI_BASE_ADDRESS_IO_MASK; |
999 |
+ } else if (resno == PCI_ROM_RESOURCE) { |
1000 |
+- mask = (u32)PCI_ROM_ADDRESS_MASK; |
1001 |
++ mask = PCI_ROM_ADDRESS_MASK; |
1002 |
+ } else { |
1003 |
+ mask = (u32)PCI_BASE_ADDRESS_MEM_MASK; |
1004 |
+ new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK; |
1005 |
+diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c |
1006 |
+index 578fae4d474f..8ef905cbfc9c 100644 |
1007 |
+--- a/drivers/scsi/virtio_scsi.c |
1008 |
++++ b/drivers/scsi/virtio_scsi.c |
1009 |
+@@ -819,6 +819,7 @@ static struct scsi_host_template virtscsi_host_template_multi = { |
1010 |
+ .eh_abort_handler = virtscsi_abort, |
1011 |
+ .eh_device_reset_handler = virtscsi_device_reset, |
1012 |
+ |
1013 |
++ .slave_alloc = virtscsi_device_alloc, |
1014 |
+ .can_queue = 1024, |
1015 |
+ .dma_boundary = UINT_MAX, |
1016 |
+ .use_clustering = ENABLE_CLUSTERING, |
1017 |
+diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c |
1018 |
+index 1ddba9ae8c0f..c872a2e54c4b 100644 |
1019 |
+--- a/drivers/spi/spi-davinci.c |
1020 |
++++ b/drivers/spi/spi-davinci.c |
1021 |
+@@ -651,7 +651,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) |
1022 |
+ buf = t->rx_buf; |
1023 |
+ t->rx_dma = dma_map_single(&spi->dev, buf, |
1024 |
+ t->len, DMA_FROM_DEVICE); |
1025 |
+- if (dma_mapping_error(&spi->dev, !t->rx_dma)) { |
1026 |
++ if (dma_mapping_error(&spi->dev, t->rx_dma)) { |
1027 |
+ ret = -EFAULT; |
1028 |
+ goto err_rx_map; |
1029 |
+ } |
1030 |
+diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c |
1031 |
+index c975f6e8be49..8f181caffca3 100644 |
1032 |
+--- a/drivers/staging/comedi/drivers/ni_mio_common.c |
1033 |
++++ b/drivers/staging/comedi/drivers/ni_mio_common.c |
1034 |
+@@ -1348,6 +1348,8 @@ static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status) |
1035 |
+ ack |= NISTC_INTA_ACK_AI_START; |
1036 |
+ if (a_status & NISTC_AI_STATUS1_STOP) |
1037 |
+ ack |= NISTC_INTA_ACK_AI_STOP; |
1038 |
++ if (a_status & NISTC_AI_STATUS1_OVER) |
1039 |
++ ack |= NISTC_INTA_ACK_AI_ERR; |
1040 |
+ if (ack) |
1041 |
+ ni_stc_writew(dev, ack, NISTC_INTA_ACK_REG); |
1042 |
+ } |
1043 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1044 |
+index 251315c35747..ff3286fc22d8 100644 |
1045 |
+--- a/drivers/tty/vt/vt.c |
1046 |
++++ b/drivers/tty/vt/vt.c |
1047 |
+@@ -1312,6 +1312,11 @@ static void csi_m(struct vc_data *vc) |
1048 |
+ case 3: |
1049 |
+ vc->vc_italic = 1; |
1050 |
+ break; |
1051 |
++ case 21: |
1052 |
++ /* |
1053 |
++ * No console drivers support double underline, so |
1054 |
++ * convert it to a single underline. |
1055 |
++ */ |
1056 |
+ case 4: |
1057 |
+ vc->vc_underline = 1; |
1058 |
+ break; |
1059 |
+@@ -1348,7 +1353,6 @@ static void csi_m(struct vc_data *vc) |
1060 |
+ vc->vc_disp_ctrl = 1; |
1061 |
+ vc->vc_toggle_meta = 1; |
1062 |
+ break; |
1063 |
+- case 21: |
1064 |
+ case 22: |
1065 |
+ vc->vc_intensity = 1; |
1066 |
+ break; |
1067 |
+diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c |
1068 |
+index 88bd950665fa..85fb6226770c 100644 |
1069 |
+--- a/drivers/usb/dwc2/hcd.c |
1070 |
++++ b/drivers/usb/dwc2/hcd.c |
1071 |
+@@ -1385,7 +1385,6 @@ static void dwc2_conn_id_status_change(struct work_struct *work) |
1072 |
+ dwc2_core_init(hsotg, false, -1); |
1073 |
+ dwc2_enable_global_interrupts(hsotg); |
1074 |
+ spin_lock_irqsave(&hsotg->lock, flags); |
1075 |
+- dwc2_hsotg_disconnect(hsotg); |
1076 |
+ dwc2_hsotg_core_init_disconnected(hsotg, false); |
1077 |
+ spin_unlock_irqrestore(&hsotg->lock, flags); |
1078 |
+ dwc2_hsotg_core_connect(hsotg); |
1079 |
+@@ -1403,8 +1402,12 @@ static void dwc2_conn_id_status_change(struct work_struct *work) |
1080 |
+ if (count > 250) |
1081 |
+ dev_err(hsotg->dev, |
1082 |
+ "Connection id status change timed out\n"); |
1083 |
+- hsotg->op_state = OTG_STATE_A_HOST; |
1084 |
+ |
1085 |
++ spin_lock_irqsave(&hsotg->lock, flags); |
1086 |
++ dwc2_hsotg_disconnect(hsotg); |
1087 |
++ spin_unlock_irqrestore(&hsotg->lock, flags); |
1088 |
++ |
1089 |
++ hsotg->op_state = OTG_STATE_A_HOST; |
1090 |
+ /* Initialize the Core for Host mode */ |
1091 |
+ dwc2_core_init(hsotg, false, -1); |
1092 |
+ dwc2_enable_global_interrupts(hsotg); |
1093 |
+diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c |
1094 |
+index ee579ba2b59e..a5dae5bb62ab 100644 |
1095 |
+--- a/drivers/usb/gadget/function/f_hid.c |
1096 |
++++ b/drivers/usb/gadget/function/f_hid.c |
1097 |
+@@ -223,6 +223,13 @@ static ssize_t f_hidg_read(struct file *file, char __user *buffer, |
1098 |
+ /* pick the first one */ |
1099 |
+ list = list_first_entry(&hidg->completed_out_req, |
1100 |
+ struct f_hidg_req_list, list); |
1101 |
++ |
1102 |
++ /* |
1103 |
++ * Remove this from list to protect it from beign free() |
1104 |
++ * while host disables our function |
1105 |
++ */ |
1106 |
++ list_del(&list->list); |
1107 |
++ |
1108 |
+ req = list->req; |
1109 |
+ count = min_t(unsigned int, count, req->actual - list->pos); |
1110 |
+ spin_unlock_irqrestore(&hidg->spinlock, flags); |
1111 |
+@@ -238,15 +245,20 @@ static ssize_t f_hidg_read(struct file *file, char __user *buffer, |
1112 |
+ * call, taking into account its current read position. |
1113 |
+ */ |
1114 |
+ if (list->pos == req->actual) { |
1115 |
+- spin_lock_irqsave(&hidg->spinlock, flags); |
1116 |
+- list_del(&list->list); |
1117 |
+ kfree(list); |
1118 |
+- spin_unlock_irqrestore(&hidg->spinlock, flags); |
1119 |
+ |
1120 |
+ req->length = hidg->report_length; |
1121 |
+ ret = usb_ep_queue(hidg->out_ep, req, GFP_KERNEL); |
1122 |
+- if (ret < 0) |
1123 |
++ if (ret < 0) { |
1124 |
++ free_ep_req(hidg->out_ep, req); |
1125 |
+ return ret; |
1126 |
++ } |
1127 |
++ } else { |
1128 |
++ spin_lock_irqsave(&hidg->spinlock, flags); |
1129 |
++ list_add(&list->list, &hidg->completed_out_req); |
1130 |
++ spin_unlock_irqrestore(&hidg->spinlock, flags); |
1131 |
++ |
1132 |
++ wake_up(&hidg->read_queue); |
1133 |
+ } |
1134 |
+ |
1135 |
+ return count; |
1136 |
+@@ -490,14 +502,18 @@ static void hidg_disable(struct usb_function *f) |
1137 |
+ { |
1138 |
+ struct f_hidg *hidg = func_to_hidg(f); |
1139 |
+ struct f_hidg_req_list *list, *next; |
1140 |
++ unsigned long flags; |
1141 |
+ |
1142 |
+ usb_ep_disable(hidg->in_ep); |
1143 |
+ usb_ep_disable(hidg->out_ep); |
1144 |
+ |
1145 |
++ spin_lock_irqsave(&hidg->spinlock, flags); |
1146 |
+ list_for_each_entry_safe(list, next, &hidg->completed_out_req, list) { |
1147 |
++ free_ep_req(hidg->out_ep, list->req); |
1148 |
+ list_del(&list->list); |
1149 |
+ kfree(list); |
1150 |
+ } |
1151 |
++ spin_unlock_irqrestore(&hidg->spinlock, flags); |
1152 |
+ } |
1153 |
+ |
1154 |
+ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
1155 |
+diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c |
1156 |
+index af60cc3714c1..5ead414586a1 100644 |
1157 |
+--- a/drivers/usb/gadget/function/f_midi.c |
1158 |
++++ b/drivers/usb/gadget/function/f_midi.c |
1159 |
+@@ -201,12 +201,6 @@ static inline struct usb_request *midi_alloc_ep_req(struct usb_ep *ep, |
1160 |
+ return alloc_ep_req(ep, length, length); |
1161 |
+ } |
1162 |
+ |
1163 |
+-static void free_ep_req(struct usb_ep *ep, struct usb_request *req) |
1164 |
+-{ |
1165 |
+- kfree(req->buf); |
1166 |
+- usb_ep_free_request(ep, req); |
1167 |
+-} |
1168 |
+- |
1169 |
+ static const uint8_t f_midi_cin_length[] = { |
1170 |
+ 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1 |
1171 |
+ }; |
1172 |
+diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c |
1173 |
+index 9f3ced62d916..67b243989938 100644 |
1174 |
+--- a/drivers/usb/gadget/function/f_sourcesink.c |
1175 |
++++ b/drivers/usb/gadget/function/f_sourcesink.c |
1176 |
+@@ -303,12 +303,6 @@ static inline struct usb_request *ss_alloc_ep_req(struct usb_ep *ep, int len) |
1177 |
+ return alloc_ep_req(ep, len, ss->buflen); |
1178 |
+ } |
1179 |
+ |
1180 |
+-void free_ep_req(struct usb_ep *ep, struct usb_request *req) |
1181 |
+-{ |
1182 |
+- kfree(req->buf); |
1183 |
+- usb_ep_free_request(ep, req); |
1184 |
+-} |
1185 |
+- |
1186 |
+ static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep) |
1187 |
+ { |
1188 |
+ int value; |
1189 |
+diff --git a/drivers/usb/gadget/function/g_zero.h b/drivers/usb/gadget/function/g_zero.h |
1190 |
+index 15f180904f8a..5ed90b437f18 100644 |
1191 |
+--- a/drivers/usb/gadget/function/g_zero.h |
1192 |
++++ b/drivers/usb/gadget/function/g_zero.h |
1193 |
+@@ -59,7 +59,6 @@ void lb_modexit(void); |
1194 |
+ int lb_modinit(void); |
1195 |
+ |
1196 |
+ /* common utilities */ |
1197 |
+-void free_ep_req(struct usb_ep *ep, struct usb_request *req); |
1198 |
+ void disable_endpoints(struct usb_composite_dev *cdev, |
1199 |
+ struct usb_ep *in, struct usb_ep *out, |
1200 |
+ struct usb_ep *iso_in, struct usb_ep *iso_out); |
1201 |
+diff --git a/drivers/usb/gadget/u_f.c b/drivers/usb/gadget/u_f.c |
1202 |
+index c6276f0268ae..907f8144813c 100644 |
1203 |
+--- a/drivers/usb/gadget/u_f.c |
1204 |
++++ b/drivers/usb/gadget/u_f.c |
1205 |
+@@ -11,16 +11,18 @@ |
1206 |
+ * published by the Free Software Foundation. |
1207 |
+ */ |
1208 |
+ |
1209 |
+-#include <linux/usb/gadget.h> |
1210 |
+ #include "u_f.h" |
1211 |
++#include <linux/usb/ch9.h> |
1212 |
+ |
1213 |
+-struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len) |
1214 |
++struct usb_request *alloc_ep_req(struct usb_ep *ep, size_t len, int default_len) |
1215 |
+ { |
1216 |
+ struct usb_request *req; |
1217 |
+ |
1218 |
+ req = usb_ep_alloc_request(ep, GFP_ATOMIC); |
1219 |
+ if (req) { |
1220 |
+ req->length = len ?: default_len; |
1221 |
++ if (usb_endpoint_dir_out(ep->desc)) |
1222 |
++ req->length = usb_ep_align(ep, req->length); |
1223 |
+ req->buf = kmalloc(req->length, GFP_ATOMIC); |
1224 |
+ if (!req->buf) { |
1225 |
+ usb_ep_free_request(ep, req); |
1226 |
+diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h |
1227 |
+index 1d5f0eb68552..69a1d10df04f 100644 |
1228 |
+--- a/drivers/usb/gadget/u_f.h |
1229 |
++++ b/drivers/usb/gadget/u_f.h |
1230 |
+@@ -16,6 +16,8 @@ |
1231 |
+ #ifndef __U_F_H__ |
1232 |
+ #define __U_F_H__ |
1233 |
+ |
1234 |
++#include <linux/usb/gadget.h> |
1235 |
++ |
1236 |
+ /* Variable Length Array Macros **********************************************/ |
1237 |
+ #define vla_group(groupname) size_t groupname##__next = 0 |
1238 |
+ #define vla_group_size(groupname) groupname##__next |
1239 |
+@@ -45,8 +47,26 @@ |
1240 |
+ struct usb_ep; |
1241 |
+ struct usb_request; |
1242 |
+ |
1243 |
+-struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len); |
1244 |
+- |
1245 |
+-#endif /* __U_F_H__ */ |
1246 |
++/** |
1247 |
++ * alloc_ep_req - returns a usb_request allocated by the gadget driver and |
1248 |
++ * allocates the request's buffer. |
1249 |
++ * |
1250 |
++ * @ep: the endpoint to allocate a usb_request |
1251 |
++ * @len: usb_requests's buffer suggested size |
1252 |
++ * @default_len: used if @len is not provided, ie, is 0 |
1253 |
++ * |
1254 |
++ * In case @ep direction is OUT, the @len will be aligned to ep's |
1255 |
++ * wMaxPacketSize. In order to avoid memory leaks or drops, *always* use |
1256 |
++ * usb_requests's length (req->length) to refer to the allocated buffer size. |
1257 |
++ * Requests allocated via alloc_ep_req() *must* be freed by free_ep_req(). |
1258 |
++ */ |
1259 |
++struct usb_request *alloc_ep_req(struct usb_ep *ep, size_t len, int default_len); |
1260 |
+ |
1261 |
++/* Frees a usb_request previously allocated by alloc_ep_req() */ |
1262 |
++static inline void free_ep_req(struct usb_ep *ep, struct usb_request *req) |
1263 |
++{ |
1264 |
++ kfree(req->buf); |
1265 |
++ usb_ep_free_request(ep, req); |
1266 |
++} |
1267 |
+ |
1268 |
++#endif /* __U_F_H__ */ |
1269 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1270 |
+index a4ab4fdf5ba3..64a4427678b0 100644 |
1271 |
+--- a/drivers/usb/serial/cp210x.c |
1272 |
++++ b/drivers/usb/serial/cp210x.c |
1273 |
+@@ -151,6 +151,7 @@ static const struct usb_device_id id_table[] = { |
1274 |
+ { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ |
1275 |
+ { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
1276 |
+ { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
1277 |
++ { USB_DEVICE(0x155A, 0x1006) }, /* ELDAT Easywave RX09 */ |
1278 |
+ { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ |
1279 |
+ { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */ |
1280 |
+ { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
1281 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1282 |
+index 64fe9dc25ed4..a224c7a3ce09 100644 |
1283 |
+--- a/drivers/usb/serial/ftdi_sio.c |
1284 |
++++ b/drivers/usb/serial/ftdi_sio.c |
1285 |
+@@ -773,6 +773,7 @@ static const struct usb_device_id id_table_combined[] = { |
1286 |
+ .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
1287 |
+ { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
1288 |
+ { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, |
1289 |
++ { USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) }, |
1290 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
1291 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
1292 |
+ { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
1293 |
+@@ -935,6 +936,7 @@ static const struct usb_device_id id_table_combined[] = { |
1294 |
+ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, |
1295 |
+ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, |
1296 |
+ { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) }, |
1297 |
++ { USB_DEVICE(FTDI_VID, FTDI_FHE_PID) }, |
1298 |
+ { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, |
1299 |
+ { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
1300 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
1301 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
1302 |
+index 543d2801632b..76a10b222ff9 100644 |
1303 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
1304 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
1305 |
+@@ -922,6 +922,9 @@ |
1306 |
+ /* |
1307 |
+ * RT Systems programming cables for various ham radios |
1308 |
+ */ |
1309 |
++/* This device uses the VID of FTDI */ |
1310 |
++#define RTSYSTEMS_USB_VX8_PID 0x9e50 /* USB-VX8 USB to 7 pin modular plug for Yaesu VX-8 radio */ |
1311 |
++ |
1312 |
+ #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
1313 |
+ #define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */ |
1314 |
+ #define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */ |
1315 |
+@@ -1440,6 +1443,12 @@ |
1316 |
+ */ |
1317 |
+ #define FTDI_CINTERION_MC55I_PID 0xA951 |
1318 |
+ |
1319 |
++/* |
1320 |
++ * Product: FirmwareHubEmulator |
1321 |
++ * Manufacturer: Harman Becker Automotive Systems |
1322 |
++ */ |
1323 |
++#define FTDI_FHE_PID 0xA9A0 |
1324 |
++ |
1325 |
+ /* |
1326 |
+ * Product: Comet Caller ID decoder |
1327 |
+ * Manufacturer: Crucible Technologies |
1328 |
+diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c |
1329 |
+index dcf26537c935..a52ca5cba015 100644 |
1330 |
+--- a/fs/compat_ioctl.c |
1331 |
++++ b/fs/compat_ioctl.c |
1332 |
+@@ -811,7 +811,7 @@ static int compat_ioctl_preallocate(struct file *file, |
1333 |
+ */ |
1334 |
+ #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) |
1335 |
+ |
1336 |
+-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd), |
1337 |
++#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), |
1338 |
+ /* ioctl should not be warned about even if it's not implemented. |
1339 |
+ Valid reasons to use this: |
1340 |
+ - It is implemented with ->compat_ioctl on some device, but programs |
1341 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
1342 |
+index 07ef85e19fbc..75691a20313c 100644 |
1343 |
+--- a/fs/proc/task_mmu.c |
1344 |
++++ b/fs/proc/task_mmu.c |
1345 |
+@@ -253,24 +253,15 @@ static int do_maps_open(struct inode *inode, struct file *file, |
1346 |
+ * /proc/PID/maps that is the stack of the main task. |
1347 |
+ */ |
1348 |
+ static int is_stack(struct proc_maps_private *priv, |
1349 |
+- struct vm_area_struct *vma, int is_pid) |
1350 |
++ struct vm_area_struct *vma) |
1351 |
+ { |
1352 |
+- int stack = 0; |
1353 |
+- |
1354 |
+- if (is_pid) { |
1355 |
+- stack = vma->vm_start <= vma->vm_mm->start_stack && |
1356 |
+- vma->vm_end >= vma->vm_mm->start_stack; |
1357 |
+- } else { |
1358 |
+- struct inode *inode = priv->inode; |
1359 |
+- struct task_struct *task; |
1360 |
+- |
1361 |
+- rcu_read_lock(); |
1362 |
+- task = pid_task(proc_pid(inode), PIDTYPE_PID); |
1363 |
+- if (task) |
1364 |
+- stack = vma_is_stack_for_task(vma, task); |
1365 |
+- rcu_read_unlock(); |
1366 |
+- } |
1367 |
+- return stack; |
1368 |
++ /* |
1369 |
++ * We make no effort to guess what a given thread considers to be |
1370 |
++ * its "stack". It's not even well-defined for programs written |
1371 |
++ * languages like Go. |
1372 |
++ */ |
1373 |
++ return vma->vm_start <= vma->vm_mm->start_stack && |
1374 |
++ vma->vm_end >= vma->vm_mm->start_stack; |
1375 |
+ } |
1376 |
+ |
1377 |
+ static void |
1378 |
+@@ -337,7 +328,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) |
1379 |
+ goto done; |
1380 |
+ } |
1381 |
+ |
1382 |
+- if (is_stack(priv, vma, is_pid)) |
1383 |
++ if (is_stack(priv, vma)) |
1384 |
+ name = "[stack]"; |
1385 |
+ } |
1386 |
+ |
1387 |
+@@ -1560,7 +1551,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) |
1388 |
+ seq_file_path(m, file, "\n\t= "); |
1389 |
+ } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { |
1390 |
+ seq_puts(m, " heap"); |
1391 |
+- } else if (is_stack(proc_priv, vma, is_pid)) { |
1392 |
++ } else if (is_stack(proc_priv, vma)) { |
1393 |
+ seq_puts(m, " stack"); |
1394 |
+ } |
1395 |
+ |
1396 |
+diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c |
1397 |
+index faacb0c0d857..37175621e890 100644 |
1398 |
+--- a/fs/proc/task_nommu.c |
1399 |
++++ b/fs/proc/task_nommu.c |
1400 |
+@@ -124,25 +124,17 @@ unsigned long task_statm(struct mm_struct *mm, |
1401 |
+ } |
1402 |
+ |
1403 |
+ static int is_stack(struct proc_maps_private *priv, |
1404 |
+- struct vm_area_struct *vma, int is_pid) |
1405 |
++ struct vm_area_struct *vma) |
1406 |
+ { |
1407 |
+ struct mm_struct *mm = vma->vm_mm; |
1408 |
+- int stack = 0; |
1409 |
+- |
1410 |
+- if (is_pid) { |
1411 |
+- stack = vma->vm_start <= mm->start_stack && |
1412 |
+- vma->vm_end >= mm->start_stack; |
1413 |
+- } else { |
1414 |
+- struct inode *inode = priv->inode; |
1415 |
+- struct task_struct *task; |
1416 |
+- |
1417 |
+- rcu_read_lock(); |
1418 |
+- task = pid_task(proc_pid(inode), PIDTYPE_PID); |
1419 |
+- if (task) |
1420 |
+- stack = vma_is_stack_for_task(vma, task); |
1421 |
+- rcu_read_unlock(); |
1422 |
+- } |
1423 |
+- return stack; |
1424 |
++ |
1425 |
++ /* |
1426 |
++ * We make no effort to guess what a given thread considers to be |
1427 |
++ * its "stack". It's not even well-defined for programs written |
1428 |
++ * languages like Go. |
1429 |
++ */ |
1430 |
++ return vma->vm_start <= mm->start_stack && |
1431 |
++ vma->vm_end >= mm->start_stack; |
1432 |
+ } |
1433 |
+ |
1434 |
+ /* |
1435 |
+@@ -184,7 +176,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, |
1436 |
+ if (file) { |
1437 |
+ seq_pad(m, ' '); |
1438 |
+ seq_file_path(m, file, ""); |
1439 |
+- } else if (mm && is_stack(priv, vma, is_pid)) { |
1440 |
++ } else if (mm && is_stack(priv, vma)) { |
1441 |
+ seq_pad(m, ' '); |
1442 |
+ seq_printf(m, "[stack]"); |
1443 |
+ } |
1444 |
+diff --git a/include/linux/audit.h b/include/linux/audit.h |
1445 |
+index faac391badac..9b95bb222e73 100644 |
1446 |
+--- a/include/linux/audit.h |
1447 |
++++ b/include/linux/audit.h |
1448 |
+@@ -26,6 +26,7 @@ |
1449 |
+ #include <linux/sched.h> |
1450 |
+ #include <linux/ptrace.h> |
1451 |
+ #include <uapi/linux/audit.h> |
1452 |
++#include <linux/tty.h> |
1453 |
+ |
1454 |
+ #define AUDIT_INO_UNSET ((unsigned long)-1) |
1455 |
+ #define AUDIT_DEV_UNSET ((dev_t)-1) |
1456 |
+@@ -239,6 +240,23 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) |
1457 |
+ return tsk->sessionid; |
1458 |
+ } |
1459 |
+ |
1460 |
++static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) |
1461 |
++{ |
1462 |
++ struct tty_struct *tty = NULL; |
1463 |
++ unsigned long flags; |
1464 |
++ |
1465 |
++ spin_lock_irqsave(&tsk->sighand->siglock, flags); |
1466 |
++ if (tsk->signal) |
1467 |
++ tty = tty_kref_get(tsk->signal->tty); |
1468 |
++ spin_unlock_irqrestore(&tsk->sighand->siglock, flags); |
1469 |
++ return tty; |
1470 |
++} |
1471 |
++ |
1472 |
++static inline void audit_put_tty(struct tty_struct *tty) |
1473 |
++{ |
1474 |
++ tty_kref_put(tty); |
1475 |
++} |
1476 |
++ |
1477 |
+ extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
1478 |
+ extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
1479 |
+ extern void __audit_bprm(struct linux_binprm *bprm); |
1480 |
+@@ -410,6 +428,12 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) |
1481 |
+ { |
1482 |
+ return -1; |
1483 |
+ } |
1484 |
++static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) |
1485 |
++{ |
1486 |
++ return NULL; |
1487 |
++} |
1488 |
++static inline void audit_put_tty(struct tty_struct *tty) |
1489 |
++{ } |
1490 |
+ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
1491 |
+ { } |
1492 |
+ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, |
1493 |
+diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h |
1494 |
+index a91b3b75da0f..bb3a4bb35183 100644 |
1495 |
+--- a/include/linux/cpumask.h |
1496 |
++++ b/include/linux/cpumask.h |
1497 |
+@@ -661,6 +661,11 @@ void alloc_bootmem_cpumask_var(cpumask_var_t *mask); |
1498 |
+ void free_cpumask_var(cpumask_var_t mask); |
1499 |
+ void free_bootmem_cpumask_var(cpumask_var_t mask); |
1500 |
+ |
1501 |
++static inline bool cpumask_available(cpumask_var_t mask) |
1502 |
++{ |
1503 |
++ return mask != NULL; |
1504 |
++} |
1505 |
++ |
1506 |
+ #else |
1507 |
+ typedef struct cpumask cpumask_var_t[1]; |
1508 |
+ |
1509 |
+@@ -701,6 +706,11 @@ static inline void free_cpumask_var(cpumask_var_t mask) |
1510 |
+ static inline void free_bootmem_cpumask_var(cpumask_var_t mask) |
1511 |
+ { |
1512 |
+ } |
1513 |
++ |
1514 |
++static inline bool cpumask_available(cpumask_var_t mask) |
1515 |
++{ |
1516 |
++ return true; |
1517 |
++} |
1518 |
+ #endif /* CONFIG_CPUMASK_OFFSTACK */ |
1519 |
+ |
1520 |
+ /* It's common to want to use cpu_all_mask in struct member initializers, |
1521 |
+diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h |
1522 |
+index 5fdc55312334..2fb10601febe 100644 |
1523 |
+--- a/include/linux/jiffies.h |
1524 |
++++ b/include/linux/jiffies.h |
1525 |
+@@ -1,6 +1,7 @@ |
1526 |
+ #ifndef _LINUX_JIFFIES_H |
1527 |
+ #define _LINUX_JIFFIES_H |
1528 |
+ |
1529 |
++#include <linux/cache.h> |
1530 |
+ #include <linux/math64.h> |
1531 |
+ #include <linux/kernel.h> |
1532 |
+ #include <linux/types.h> |
1533 |
+@@ -63,19 +64,17 @@ extern int register_refined_jiffies(long clock_tick_rate); |
1534 |
+ /* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ |
1535 |
+ #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) |
1536 |
+ |
1537 |
+-/* some arch's have a small-data section that can be accessed register-relative |
1538 |
+- * but that can only take up to, say, 4-byte variables. jiffies being part of |
1539 |
+- * an 8-byte variable may not be correctly accessed unless we force the issue |
1540 |
+- */ |
1541 |
+-#define __jiffy_data __attribute__((section(".data"))) |
1542 |
++#ifndef __jiffy_arch_data |
1543 |
++#define __jiffy_arch_data |
1544 |
++#endif |
1545 |
+ |
1546 |
+ /* |
1547 |
+ * The 64-bit value is not atomic - you MUST NOT read it |
1548 |
+ * without sampling the sequence number in jiffies_lock. |
1549 |
+ * get_jiffies_64() will do this for you as appropriate. |
1550 |
+ */ |
1551 |
+-extern u64 __jiffy_data jiffies_64; |
1552 |
+-extern unsigned long volatile __jiffy_data jiffies; |
1553 |
++extern u64 __cacheline_aligned_in_smp jiffies_64; |
1554 |
++extern unsigned long volatile __cacheline_aligned_in_smp __jiffy_arch_data jiffies; |
1555 |
+ |
1556 |
+ #if (BITS_PER_LONG < 64) |
1557 |
+ u64 get_jiffies_64(void); |
1558 |
+diff --git a/include/linux/llist.h b/include/linux/llist.h |
1559 |
+index fd4ca0b4fe0f..ac6796138ba0 100644 |
1560 |
+--- a/include/linux/llist.h |
1561 |
++++ b/include/linux/llist.h |
1562 |
+@@ -87,6 +87,23 @@ static inline void init_llist_head(struct llist_head *list) |
1563 |
+ #define llist_entry(ptr, type, member) \ |
1564 |
+ container_of(ptr, type, member) |
1565 |
+ |
1566 |
++/** |
1567 |
++ * member_address_is_nonnull - check whether the member address is not NULL |
1568 |
++ * @ptr: the object pointer (struct type * that contains the llist_node) |
1569 |
++ * @member: the name of the llist_node within the struct. |
1570 |
++ * |
1571 |
++ * This macro is conceptually the same as |
1572 |
++ * &ptr->member != NULL |
1573 |
++ * but it works around the fact that compilers can decide that taking a member |
1574 |
++ * address is never a NULL pointer. |
1575 |
++ * |
1576 |
++ * Real objects that start at a high address and have a member at NULL are |
1577 |
++ * unlikely to exist, but such pointers may be returned e.g. by the |
1578 |
++ * container_of() macro. |
1579 |
++ */ |
1580 |
++#define member_address_is_nonnull(ptr, member) \ |
1581 |
++ ((uintptr_t)(ptr) + offsetof(typeof(*(ptr)), member) != 0) |
1582 |
++ |
1583 |
+ /** |
1584 |
+ * llist_for_each - iterate over some deleted entries of a lock-less list |
1585 |
+ * @pos: the &struct llist_node to use as a loop cursor |
1586 |
+@@ -121,7 +138,7 @@ static inline void init_llist_head(struct llist_head *list) |
1587 |
+ */ |
1588 |
+ #define llist_for_each_entry(pos, node, member) \ |
1589 |
+ for ((pos) = llist_entry((node), typeof(*(pos)), member); \ |
1590 |
+- &(pos)->member != NULL; \ |
1591 |
++ member_address_is_nonnull(pos, member); \ |
1592 |
+ (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) |
1593 |
+ |
1594 |
+ /** |
1595 |
+@@ -143,7 +160,7 @@ static inline void init_llist_head(struct llist_head *list) |
1596 |
+ */ |
1597 |
+ #define llist_for_each_entry_safe(pos, n, node, member) \ |
1598 |
+ for (pos = llist_entry((node), typeof(*pos), member); \ |
1599 |
+- &pos->member != NULL && \ |
1600 |
++ member_address_is_nonnull(pos, member) && \ |
1601 |
+ (n = llist_entry(pos->member.next, typeof(*n), member), true); \ |
1602 |
+ pos = n) |
1603 |
+ |
1604 |
+diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h |
1605 |
+index 53e361a9af79..6923e4049de3 100644 |
1606 |
+--- a/include/linux/netfilter/x_tables.h |
1607 |
++++ b/include/linux/netfilter/x_tables.h |
1608 |
+@@ -247,6 +247,8 @@ unsigned int *xt_alloc_entry_offsets(unsigned int size); |
1609 |
+ bool xt_find_jump_offset(const unsigned int *offsets, |
1610 |
+ unsigned int target, unsigned int size); |
1611 |
+ |
1612 |
++int xt_check_proc_name(const char *name, unsigned int size); |
1613 |
++ |
1614 |
+ int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto, |
1615 |
+ bool inv_proto); |
1616 |
+ int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto, |
1617 |
+diff --git a/include/linux/nospec.h b/include/linux/nospec.h |
1618 |
+index 115381228203..e791ebc65c9c 100644 |
1619 |
+--- a/include/linux/nospec.h |
1620 |
++++ b/include/linux/nospec.h |
1621 |
+@@ -20,20 +20,6 @@ |
1622 |
+ static inline unsigned long array_index_mask_nospec(unsigned long index, |
1623 |
+ unsigned long size) |
1624 |
+ { |
1625 |
+- /* |
1626 |
+- * Warn developers about inappropriate array_index_nospec() usage. |
1627 |
+- * |
1628 |
+- * Even if the CPU speculates past the WARN_ONCE branch, the |
1629 |
+- * sign bit of @index is taken into account when generating the |
1630 |
+- * mask. |
1631 |
+- * |
1632 |
+- * This warning is compiled out when the compiler can infer that |
1633 |
+- * @index and @size are less than LONG_MAX. |
1634 |
+- */ |
1635 |
+- if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX, |
1636 |
+- "array_index_nospec() limited to range of [0, LONG_MAX]\n")) |
1637 |
+- return 0; |
1638 |
+- |
1639 |
+ /* |
1640 |
+ * Always calculate and emit the mask even if the compiler |
1641 |
+ * thinks the mask is not needed. The compiler does not take |
1642 |
+diff --git a/include/linux/tty.h b/include/linux/tty.h |
1643 |
+index 83b264c52898..a1042afff99a 100644 |
1644 |
+--- a/include/linux/tty.h |
1645 |
++++ b/include/linux/tty.h |
1646 |
+@@ -372,6 +372,7 @@ extern void proc_clear_tty(struct task_struct *p); |
1647 |
+ extern struct tty_struct *get_current_tty(void); |
1648 |
+ /* tty_io.c */ |
1649 |
+ extern int __init tty_init(void); |
1650 |
++extern const char *tty_name(const struct tty_struct *tty); |
1651 |
+ #else |
1652 |
+ static inline void console_init(void) |
1653 |
+ { } |
1654 |
+@@ -392,6 +393,8 @@ static inline struct tty_struct *get_current_tty(void) |
1655 |
+ /* tty_io.c */ |
1656 |
+ static inline int __init tty_init(void) |
1657 |
+ { return 0; } |
1658 |
++static inline const char *tty_name(const struct tty_struct *tty) |
1659 |
++{ return "(none)"; } |
1660 |
+ #endif |
1661 |
+ |
1662 |
+ extern void tty_write_flush(struct tty_struct *); |
1663 |
+@@ -420,7 +423,6 @@ static inline struct tty_struct *tty_kref_get(struct tty_struct *tty) |
1664 |
+ |
1665 |
+ extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
1666 |
+ const char *routine); |
1667 |
+-extern const char *tty_name(const struct tty_struct *tty); |
1668 |
+ extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); |
1669 |
+ extern int __tty_check_change(struct tty_struct *tty, int sig); |
1670 |
+ extern int tty_check_change(struct tty_struct *tty); |
1671 |
+diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h |
1672 |
+index 3d583a10b926..7e84aac39ade 100644 |
1673 |
+--- a/include/linux/usb/gadget.h |
1674 |
++++ b/include/linux/usb/gadget.h |
1675 |
+@@ -662,9 +662,21 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) |
1676 |
+ #define gadget_for_each_ep(tmp, gadget) \ |
1677 |
+ list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) |
1678 |
+ |
1679 |
++/** |
1680 |
++ * usb_ep_align - returns @len aligned to ep's maxpacketsize. |
1681 |
++ * @ep: the endpoint whose maxpacketsize is used to align @len |
1682 |
++ * @len: buffer size's length to align to @ep's maxpacketsize |
1683 |
++ * |
1684 |
++ * This helper is used to align buffer's size to an ep's maxpacketsize. |
1685 |
++ */ |
1686 |
++static inline size_t usb_ep_align(struct usb_ep *ep, size_t len) |
1687 |
++{ |
1688 |
++ return round_up(len, (size_t)le16_to_cpu(ep->desc->wMaxPacketSize)); |
1689 |
++} |
1690 |
++ |
1691 |
+ /** |
1692 |
+ * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget |
1693 |
+- * requires quirk_ep_out_aligned_size, otherwise reguens len. |
1694 |
++ * requires quirk_ep_out_aligned_size, otherwise returns len. |
1695 |
+ * @g: controller to check for quirk |
1696 |
+ * @ep: the endpoint whose maxpacketsize is used to align @len |
1697 |
+ * @len: buffer size's length to align to @ep's maxpacketsize |
1698 |
+@@ -675,8 +687,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) |
1699 |
+ static inline size_t |
1700 |
+ usb_ep_align_maybe(struct usb_gadget *g, struct usb_ep *ep, size_t len) |
1701 |
+ { |
1702 |
+- return !g->quirk_ep_out_aligned_size ? len : |
1703 |
+- round_up(len, (size_t)ep->desc->wMaxPacketSize); |
1704 |
++ return g->quirk_ep_out_aligned_size ? usb_ep_align(ep, len) : len; |
1705 |
+ } |
1706 |
+ |
1707 |
+ /** |
1708 |
+diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h |
1709 |
+index a78ff97eb249..d77416963f05 100644 |
1710 |
+--- a/include/rdma/ib_addr.h |
1711 |
++++ b/include/rdma/ib_addr.h |
1712 |
+@@ -123,6 +123,8 @@ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, |
1713 |
+ const unsigned char *dst_dev_addr); |
1714 |
+ |
1715 |
+ int rdma_addr_size(struct sockaddr *addr); |
1716 |
++int rdma_addr_size_in6(struct sockaddr_in6 *addr); |
1717 |
++int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr); |
1718 |
+ |
1719 |
+ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id); |
1720 |
+ int rdma_addr_find_dmac_by_grh(const union ib_gid *sgid, const union ib_gid *dgid, |
1721 |
+diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h |
1722 |
+index 1becea86c73c..eb3c786afa70 100644 |
1723 |
+--- a/include/uapi/linux/pci_regs.h |
1724 |
++++ b/include/uapi/linux/pci_regs.h |
1725 |
+@@ -106,7 +106,7 @@ |
1726 |
+ #define PCI_SUBSYSTEM_ID 0x2e |
1727 |
+ #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ |
1728 |
+ #define PCI_ROM_ADDRESS_ENABLE 0x01 |
1729 |
+-#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) |
1730 |
++#define PCI_ROM_ADDRESS_MASK (~0x7ffU) |
1731 |
+ |
1732 |
+ #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ |
1733 |
+ |
1734 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
1735 |
+index 41f9a38bb800..6881b485aa2a 100644 |
1736 |
+--- a/kernel/audit.c |
1737 |
++++ b/kernel/audit.c |
1738 |
+@@ -64,7 +64,6 @@ |
1739 |
+ #include <linux/security.h> |
1740 |
+ #endif |
1741 |
+ #include <linux/freezer.h> |
1742 |
+-#include <linux/tty.h> |
1743 |
+ #include <linux/pid_namespace.h> |
1744 |
+ #include <net/netns/generic.h> |
1745 |
+ |
1746 |
+@@ -1876,21 +1875,14 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) |
1747 |
+ { |
1748 |
+ const struct cred *cred; |
1749 |
+ char comm[sizeof(tsk->comm)]; |
1750 |
+- char *tty; |
1751 |
++ struct tty_struct *tty; |
1752 |
+ |
1753 |
+ if (!ab) |
1754 |
+ return; |
1755 |
+ |
1756 |
+ /* tsk == current */ |
1757 |
+ cred = current_cred(); |
1758 |
+- |
1759 |
+- spin_lock_irq(&tsk->sighand->siglock); |
1760 |
+- if (tsk->signal && tsk->signal->tty && tsk->signal->tty->name) |
1761 |
+- tty = tsk->signal->tty->name; |
1762 |
+- else |
1763 |
+- tty = "(none)"; |
1764 |
+- spin_unlock_irq(&tsk->sighand->siglock); |
1765 |
+- |
1766 |
++ tty = audit_get_tty(tsk); |
1767 |
+ audit_log_format(ab, |
1768 |
+ " ppid=%d pid=%d auid=%u uid=%u gid=%u" |
1769 |
+ " euid=%u suid=%u fsuid=%u" |
1770 |
+@@ -1906,11 +1898,11 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) |
1771 |
+ from_kgid(&init_user_ns, cred->egid), |
1772 |
+ from_kgid(&init_user_ns, cred->sgid), |
1773 |
+ from_kgid(&init_user_ns, cred->fsgid), |
1774 |
+- tty, audit_get_sessionid(tsk)); |
1775 |
+- |
1776 |
++ tty ? tty_name(tty) : "(none)", |
1777 |
++ audit_get_sessionid(tsk)); |
1778 |
++ audit_put_tty(tty); |
1779 |
+ audit_log_format(ab, " comm="); |
1780 |
+ audit_log_untrustedstring(ab, get_task_comm(comm, tsk)); |
1781 |
+- |
1782 |
+ audit_log_d_path_exe(ab, tsk->mm); |
1783 |
+ audit_log_task_context(ab); |
1784 |
+ } |
1785 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
1786 |
+index 48f45987dc6c..4bdea31cf6ce 100644 |
1787 |
+--- a/kernel/auditsc.c |
1788 |
++++ b/kernel/auditsc.c |
1789 |
+@@ -1976,6 +1976,7 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid, |
1790 |
+ { |
1791 |
+ struct audit_buffer *ab; |
1792 |
+ uid_t uid, oldloginuid, loginuid; |
1793 |
++ struct tty_struct *tty; |
1794 |
+ |
1795 |
+ if (!audit_enabled) |
1796 |
+ return; |
1797 |
+@@ -1983,14 +1984,17 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid, |
1798 |
+ uid = from_kuid(&init_user_ns, task_uid(current)); |
1799 |
+ oldloginuid = from_kuid(&init_user_ns, koldloginuid); |
1800 |
+ loginuid = from_kuid(&init_user_ns, kloginuid), |
1801 |
++ tty = audit_get_tty(current); |
1802 |
+ |
1803 |
+ ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN); |
1804 |
+ if (!ab) |
1805 |
+ return; |
1806 |
+ audit_log_format(ab, "pid=%d uid=%u", task_pid_nr(current), uid); |
1807 |
+ audit_log_task_context(ab); |
1808 |
+- audit_log_format(ab, " old-auid=%u auid=%u old-ses=%u ses=%u res=%d", |
1809 |
+- oldloginuid, loginuid, oldsessionid, sessionid, !rc); |
1810 |
++ audit_log_format(ab, " old-auid=%u auid=%u tty=%s old-ses=%u ses=%u res=%d", |
1811 |
++ oldloginuid, loginuid, tty ? tty_name(tty) : "(none)", |
1812 |
++ oldsessionid, sessionid, !rc); |
1813 |
++ audit_put_tty(tty); |
1814 |
+ audit_log_end(ab); |
1815 |
+ } |
1816 |
+ |
1817 |
+diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c |
1818 |
+index 92ce5f4ccc26..a27245fdcd81 100644 |
1819 |
+--- a/kernel/events/hw_breakpoint.c |
1820 |
++++ b/kernel/events/hw_breakpoint.c |
1821 |
+@@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); |
1822 |
+ * modify_user_hw_breakpoint - modify a user-space hardware breakpoint |
1823 |
+ * @bp: the breakpoint structure to modify |
1824 |
+ * @attr: new breakpoint attributes |
1825 |
+- * @triggered: callback to trigger when we hit the breakpoint |
1826 |
+- * @tsk: pointer to 'task_struct' of the process to which the address belongs |
1827 |
+ */ |
1828 |
+ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) |
1829 |
+ { |
1830 |
+- u64 old_addr = bp->attr.bp_addr; |
1831 |
+- u64 old_len = bp->attr.bp_len; |
1832 |
+- int old_type = bp->attr.bp_type; |
1833 |
+- int err = 0; |
1834 |
+- |
1835 |
+ /* |
1836 |
+ * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it |
1837 |
+ * will not be possible to raise IPIs that invoke __perf_event_disable. |
1838 |
+@@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att |
1839 |
+ bp->attr.bp_addr = attr->bp_addr; |
1840 |
+ bp->attr.bp_type = attr->bp_type; |
1841 |
+ bp->attr.bp_len = attr->bp_len; |
1842 |
++ bp->attr.disabled = 1; |
1843 |
+ |
1844 |
+- if (attr->disabled) |
1845 |
+- goto end; |
1846 |
+- |
1847 |
+- err = validate_hw_breakpoint(bp); |
1848 |
+- if (!err) |
1849 |
+- perf_event_enable(bp); |
1850 |
++ if (!attr->disabled) { |
1851 |
++ int err = validate_hw_breakpoint(bp); |
1852 |
+ |
1853 |
+- if (err) { |
1854 |
+- bp->attr.bp_addr = old_addr; |
1855 |
+- bp->attr.bp_type = old_type; |
1856 |
+- bp->attr.bp_len = old_len; |
1857 |
+- if (!bp->attr.disabled) |
1858 |
+- perf_event_enable(bp); |
1859 |
++ if (err) |
1860 |
++ return err; |
1861 |
+ |
1862 |
+- return err; |
1863 |
++ perf_event_enable(bp); |
1864 |
++ bp->attr.disabled = 0; |
1865 |
+ } |
1866 |
+ |
1867 |
+-end: |
1868 |
+- bp->attr.disabled = attr->disabled; |
1869 |
+- |
1870 |
+ return 0; |
1871 |
+ } |
1872 |
+ EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint); |
1873 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
1874 |
+index a079ed14f230..5f55a8bf5264 100644 |
1875 |
+--- a/kernel/irq/manage.c |
1876 |
++++ b/kernel/irq/manage.c |
1877 |
+@@ -836,7 +836,7 @@ irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) |
1878 |
+ * This code is triggered unconditionally. Check the affinity |
1879 |
+ * mask pointer. For CPU_MASK_OFFSTACK=n this is optimized out. |
1880 |
+ */ |
1881 |
+- if (desc->irq_common_data.affinity) |
1882 |
++ if (cpumask_available(desc->irq_common_data.affinity)) |
1883 |
+ cpumask_copy(mask, desc->irq_common_data.affinity); |
1884 |
+ else |
1885 |
+ valid = false; |
1886 |
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
1887 |
+index 695763516908..bbe9dd0886bd 100644 |
1888 |
+--- a/kernel/kprobes.c |
1889 |
++++ b/kernel/kprobes.c |
1890 |
+@@ -125,7 +125,7 @@ static void *alloc_insn_page(void) |
1891 |
+ return module_alloc(PAGE_SIZE); |
1892 |
+ } |
1893 |
+ |
1894 |
+-static void free_insn_page(void *page) |
1895 |
++void __weak free_insn_page(void *page) |
1896 |
+ { |
1897 |
+ module_memfree(page); |
1898 |
+ } |
1899 |
+diff --git a/mm/backing-dev.c b/mm/backing-dev.c |
1900 |
+index a988d4ef39da..7f80b1a1bc34 100644 |
1901 |
+--- a/mm/backing-dev.c |
1902 |
++++ b/mm/backing-dev.c |
1903 |
+@@ -922,7 +922,7 @@ static atomic_t nr_wb_congested[2]; |
1904 |
+ void clear_wb_congested(struct bdi_writeback_congested *congested, int sync) |
1905 |
+ { |
1906 |
+ wait_queue_head_t *wqh = &congestion_wqh[sync]; |
1907 |
+- enum wb_state bit; |
1908 |
++ enum wb_congested_state bit; |
1909 |
+ |
1910 |
+ bit = sync ? WB_sync_congested : WB_async_congested; |
1911 |
+ if (test_and_clear_bit(bit, &congested->state)) |
1912 |
+@@ -935,7 +935,7 @@ EXPORT_SYMBOL(clear_wb_congested); |
1913 |
+ |
1914 |
+ void set_wb_congested(struct bdi_writeback_congested *congested, int sync) |
1915 |
+ { |
1916 |
+- enum wb_state bit; |
1917 |
++ enum wb_congested_state bit; |
1918 |
+ |
1919 |
+ bit = sync ? WB_sync_congested : WB_async_congested; |
1920 |
+ if (!test_and_set_bit(bit, &congested->state)) |
1921 |
+diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c |
1922 |
+index 906f88550cd8..0dc27d2e8f18 100644 |
1923 |
+--- a/net/bluetooth/smp.c |
1924 |
++++ b/net/bluetooth/smp.c |
1925 |
+@@ -2251,8 +2251,14 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) |
1926 |
+ else |
1927 |
+ sec_level = authreq_to_seclevel(auth); |
1928 |
+ |
1929 |
+- if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) |
1930 |
++ if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) { |
1931 |
++ /* If link is already encrypted with sufficient security we |
1932 |
++ * still need refresh encryption as per Core Spec 5.0 Vol 3, |
1933 |
++ * Part H 2.4.6 |
1934 |
++ */ |
1935 |
++ smp_ltk_encrypt(conn, hcon->sec_level); |
1936 |
+ return 0; |
1937 |
++ } |
1938 |
+ |
1939 |
+ if (sec_level > hcon->pending_sec_level) |
1940 |
+ hcon->pending_sec_level = sec_level; |
1941 |
+diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c |
1942 |
+index 9637a681bdda..9adf16258cab 100644 |
1943 |
+--- a/net/bridge/netfilter/ebt_among.c |
1944 |
++++ b/net/bridge/netfilter/ebt_among.c |
1945 |
+@@ -177,6 +177,28 @@ static bool poolsize_invalid(const struct ebt_mac_wormhash *w) |
1946 |
+ return w && w->poolsize >= (INT_MAX / sizeof(struct ebt_mac_wormhash_tuple)); |
1947 |
+ } |
1948 |
+ |
1949 |
++static bool wormhash_offset_invalid(int off, unsigned int len) |
1950 |
++{ |
1951 |
++ if (off == 0) /* not present */ |
1952 |
++ return false; |
1953 |
++ |
1954 |
++ if (off < (int)sizeof(struct ebt_among_info) || |
1955 |
++ off % __alignof__(struct ebt_mac_wormhash)) |
1956 |
++ return true; |
1957 |
++ |
1958 |
++ off += sizeof(struct ebt_mac_wormhash); |
1959 |
++ |
1960 |
++ return off > len; |
1961 |
++} |
1962 |
++ |
1963 |
++static bool wormhash_sizes_valid(const struct ebt_mac_wormhash *wh, int a, int b) |
1964 |
++{ |
1965 |
++ if (a == 0) |
1966 |
++ a = sizeof(struct ebt_among_info); |
1967 |
++ |
1968 |
++ return ebt_mac_wormhash_size(wh) + a == b; |
1969 |
++} |
1970 |
++ |
1971 |
+ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
1972 |
+ { |
1973 |
+ const struct ebt_among_info *info = par->matchinfo; |
1974 |
+@@ -189,6 +211,10 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
1975 |
+ if (expected_length > em->match_size) |
1976 |
+ return -EINVAL; |
1977 |
+ |
1978 |
++ if (wormhash_offset_invalid(info->wh_dst_ofs, em->match_size) || |
1979 |
++ wormhash_offset_invalid(info->wh_src_ofs, em->match_size)) |
1980 |
++ return -EINVAL; |
1981 |
++ |
1982 |
+ wh_dst = ebt_among_wh_dst(info); |
1983 |
+ if (poolsize_invalid(wh_dst)) |
1984 |
+ return -EINVAL; |
1985 |
+@@ -201,6 +227,14 @@ static int ebt_among_mt_check(const struct xt_mtchk_param *par) |
1986 |
+ if (poolsize_invalid(wh_src)) |
1987 |
+ return -EINVAL; |
1988 |
+ |
1989 |
++ if (info->wh_src_ofs < info->wh_dst_ofs) { |
1990 |
++ if (!wormhash_sizes_valid(wh_src, info->wh_src_ofs, info->wh_dst_ofs)) |
1991 |
++ return -EINVAL; |
1992 |
++ } else { |
1993 |
++ if (!wormhash_sizes_valid(wh_dst, info->wh_dst_ofs, info->wh_src_ofs)) |
1994 |
++ return -EINVAL; |
1995 |
++ } |
1996 |
++ |
1997 |
+ expected_length += ebt_mac_wormhash_size(wh_src); |
1998 |
+ |
1999 |
+ if (em->match_size != EBT_ALIGN(expected_length)) { |
2000 |
+diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c |
2001 |
+index 574f7ebba0b6..ac8342dcb55e 100644 |
2002 |
+--- a/net/ipv4/netfilter/nf_nat_h323.c |
2003 |
++++ b/net/ipv4/netfilter/nf_nat_h323.c |
2004 |
+@@ -252,16 +252,16 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct, |
2005 |
+ if (set_h245_addr(skb, protoff, data, dataoff, taddr, |
2006 |
+ &ct->tuplehash[!dir].tuple.dst.u3, |
2007 |
+ htons((port & htons(1)) ? nated_port + 1 : |
2008 |
+- nated_port)) == 0) { |
2009 |
+- /* Save ports */ |
2010 |
+- info->rtp_port[i][dir] = rtp_port; |
2011 |
+- info->rtp_port[i][!dir] = htons(nated_port); |
2012 |
+- } else { |
2013 |
++ nated_port))) { |
2014 |
+ nf_ct_unexpect_related(rtp_exp); |
2015 |
+ nf_ct_unexpect_related(rtcp_exp); |
2016 |
+ return -1; |
2017 |
+ } |
2018 |
+ |
2019 |
++ /* Save ports */ |
2020 |
++ info->rtp_port[i][dir] = rtp_port; |
2021 |
++ info->rtp_port[i][!dir] = htons(nated_port); |
2022 |
++ |
2023 |
+ /* Success */ |
2024 |
+ pr_debug("nf_nat_h323: expect RTP %pI4:%hu->%pI4:%hu\n", |
2025 |
+ &rtp_exp->tuple.src.u3.ip, |
2026 |
+@@ -370,15 +370,15 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct, |
2027 |
+ /* Modify signal */ |
2028 |
+ if (set_h225_addr(skb, protoff, data, dataoff, taddr, |
2029 |
+ &ct->tuplehash[!dir].tuple.dst.u3, |
2030 |
+- htons(nated_port)) == 0) { |
2031 |
+- /* Save ports */ |
2032 |
+- info->sig_port[dir] = port; |
2033 |
+- info->sig_port[!dir] = htons(nated_port); |
2034 |
+- } else { |
2035 |
++ htons(nated_port))) { |
2036 |
+ nf_ct_unexpect_related(exp); |
2037 |
+ return -1; |
2038 |
+ } |
2039 |
+ |
2040 |
++ /* Save ports */ |
2041 |
++ info->sig_port[dir] = port; |
2042 |
++ info->sig_port[!dir] = htons(nated_port); |
2043 |
++ |
2044 |
+ pr_debug("nf_nat_q931: expect H.245 %pI4:%hu->%pI4:%hu\n", |
2045 |
+ &exp->tuple.src.u3.ip, |
2046 |
+ ntohs(exp->tuple.src.u.tcp.port), |
2047 |
+@@ -462,24 +462,27 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct, |
2048 |
+ /* Modify signal */ |
2049 |
+ if (set_h225_addr(skb, protoff, data, 0, &taddr[idx], |
2050 |
+ &ct->tuplehash[!dir].tuple.dst.u3, |
2051 |
+- htons(nated_port)) == 0) { |
2052 |
+- /* Save ports */ |
2053 |
+- info->sig_port[dir] = port; |
2054 |
+- info->sig_port[!dir] = htons(nated_port); |
2055 |
+- |
2056 |
+- /* Fix for Gnomemeeting */ |
2057 |
+- if (idx > 0 && |
2058 |
+- get_h225_addr(ct, *data, &taddr[0], &addr, &port) && |
2059 |
+- (ntohl(addr.ip) & 0xff000000) == 0x7f000000) { |
2060 |
+- set_h225_addr(skb, protoff, data, 0, &taddr[0], |
2061 |
+- &ct->tuplehash[!dir].tuple.dst.u3, |
2062 |
+- info->sig_port[!dir]); |
2063 |
+- } |
2064 |
+- } else { |
2065 |
++ htons(nated_port))) { |
2066 |
+ nf_ct_unexpect_related(exp); |
2067 |
+ return -1; |
2068 |
+ } |
2069 |
+ |
2070 |
++ /* Save ports */ |
2071 |
++ info->sig_port[dir] = port; |
2072 |
++ info->sig_port[!dir] = htons(nated_port); |
2073 |
++ |
2074 |
++ /* Fix for Gnomemeeting */ |
2075 |
++ if (idx > 0 && |
2076 |
++ get_h225_addr(ct, *data, &taddr[0], &addr, &port) && |
2077 |
++ (ntohl(addr.ip) & 0xff000000) == 0x7f000000) { |
2078 |
++ if (set_h225_addr(skb, protoff, data, 0, &taddr[0], |
2079 |
++ &ct->tuplehash[!dir].tuple.dst.u3, |
2080 |
++ info->sig_port[!dir])) { |
2081 |
++ nf_ct_unexpect_related(exp); |
2082 |
++ return -1; |
2083 |
++ } |
2084 |
++ } |
2085 |
++ |
2086 |
+ /* Success */ |
2087 |
+ pr_debug("nf_nat_ras: expect Q.931 %pI4:%hu->%pI4:%hu\n", |
2088 |
+ &exp->tuple.src.u3.ip, |
2089 |
+@@ -550,9 +553,9 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct, |
2090 |
+ } |
2091 |
+ |
2092 |
+ /* Modify signal */ |
2093 |
+- if (!set_h225_addr(skb, protoff, data, dataoff, taddr, |
2094 |
+- &ct->tuplehash[!dir].tuple.dst.u3, |
2095 |
+- htons(nated_port)) == 0) { |
2096 |
++ if (set_h225_addr(skb, protoff, data, dataoff, taddr, |
2097 |
++ &ct->tuplehash[!dir].tuple.dst.u3, |
2098 |
++ htons(nated_port))) { |
2099 |
+ nf_ct_unexpect_related(exp); |
2100 |
+ return -1; |
2101 |
+ } |
2102 |
+diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
2103 |
+index e4b0fb2f06a3..d7105422bc63 100644 |
2104 |
+--- a/net/ipv6/ip6_vti.c |
2105 |
++++ b/net/ipv6/ip6_vti.c |
2106 |
+@@ -614,7 +614,6 @@ static void vti6_link_config(struct ip6_tnl *t) |
2107 |
+ { |
2108 |
+ struct net_device *dev = t->dev; |
2109 |
+ struct __ip6_tnl_parm *p = &t->parms; |
2110 |
+- struct net_device *tdev = NULL; |
2111 |
+ |
2112 |
+ memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); |
2113 |
+ memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); |
2114 |
+@@ -627,25 +626,6 @@ static void vti6_link_config(struct ip6_tnl *t) |
2115 |
+ dev->flags |= IFF_POINTOPOINT; |
2116 |
+ else |
2117 |
+ dev->flags &= ~IFF_POINTOPOINT; |
2118 |
+- |
2119 |
+- if (p->flags & IP6_TNL_F_CAP_XMIT) { |
2120 |
+- int strict = (ipv6_addr_type(&p->raddr) & |
2121 |
+- (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); |
2122 |
+- struct rt6_info *rt = rt6_lookup(t->net, |
2123 |
+- &p->raddr, &p->laddr, |
2124 |
+- p->link, strict); |
2125 |
+- |
2126 |
+- if (rt) |
2127 |
+- tdev = rt->dst.dev; |
2128 |
+- ip6_rt_put(rt); |
2129 |
+- } |
2130 |
+- |
2131 |
+- if (!tdev && p->link) |
2132 |
+- tdev = __dev_get_by_index(t->net, p->link); |
2133 |
+- |
2134 |
+- if (tdev) |
2135 |
+- dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, |
2136 |
+- IPV6_MIN_MTU); |
2137 |
+ } |
2138 |
+ |
2139 |
+ /** |
2140 |
+diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c |
2141 |
+index 660939df7c94..4ece07c68b3f 100644 |
2142 |
+--- a/net/netfilter/nf_conntrack_netlink.c |
2143 |
++++ b/net/netfilter/nf_conntrack_netlink.c |
2144 |
+@@ -999,9 +999,8 @@ static const struct nla_policy tuple_nla_policy[CTA_TUPLE_MAX+1] = { |
2145 |
+ |
2146 |
+ static int |
2147 |
+ ctnetlink_parse_tuple(const struct nlattr * const cda[], |
2148 |
+- struct nf_conntrack_tuple *tuple, |
2149 |
+- enum ctattr_type type, u_int8_t l3num, |
2150 |
+- struct nf_conntrack_zone *zone) |
2151 |
++ struct nf_conntrack_tuple *tuple, u32 type, |
2152 |
++ u_int8_t l3num, struct nf_conntrack_zone *zone) |
2153 |
+ { |
2154 |
+ struct nlattr *tb[CTA_TUPLE_MAX+1]; |
2155 |
+ int err; |
2156 |
+@@ -2416,7 +2415,7 @@ static struct nfnl_ct_hook ctnetlink_glue_hook = { |
2157 |
+ static inline int |
2158 |
+ ctnetlink_exp_dump_tuple(struct sk_buff *skb, |
2159 |
+ const struct nf_conntrack_tuple *tuple, |
2160 |
+- enum ctattr_expect type) |
2161 |
++ u32 type) |
2162 |
+ { |
2163 |
+ struct nlattr *nest_parms; |
2164 |
+ |
2165 |
+diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c |
2166 |
+index 34ae20490c94..1f3c305df45d 100644 |
2167 |
+--- a/net/netfilter/x_tables.c |
2168 |
++++ b/net/netfilter/x_tables.c |
2169 |
+@@ -366,6 +366,36 @@ textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto) |
2170 |
+ return buf; |
2171 |
+ } |
2172 |
+ |
2173 |
++/** |
2174 |
++ * xt_check_proc_name - check that name is suitable for /proc file creation |
2175 |
++ * |
2176 |
++ * @name: file name candidate |
2177 |
++ * @size: length of buffer |
2178 |
++ * |
2179 |
++ * some x_tables modules wish to create a file in /proc. |
2180 |
++ * This function makes sure that the name is suitable for this |
2181 |
++ * purpose, it checks that name is NUL terminated and isn't a 'special' |
2182 |
++ * name, like "..". |
2183 |
++ * |
2184 |
++ * returns negative number on error or 0 if name is useable. |
2185 |
++ */ |
2186 |
++int xt_check_proc_name(const char *name, unsigned int size) |
2187 |
++{ |
2188 |
++ if (name[0] == '\0') |
2189 |
++ return -EINVAL; |
2190 |
++ |
2191 |
++ if (strnlen(name, size) == size) |
2192 |
++ return -ENAMETOOLONG; |
2193 |
++ |
2194 |
++ if (strcmp(name, ".") == 0 || |
2195 |
++ strcmp(name, "..") == 0 || |
2196 |
++ strchr(name, '/')) |
2197 |
++ return -EINVAL; |
2198 |
++ |
2199 |
++ return 0; |
2200 |
++} |
2201 |
++EXPORT_SYMBOL(xt_check_proc_name); |
2202 |
++ |
2203 |
+ int xt_check_match(struct xt_mtchk_param *par, |
2204 |
+ unsigned int size, u_int8_t proto, bool inv_proto) |
2205 |
+ { |
2206 |
+diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c |
2207 |
+index 178696852bde..7381be0cdcdf 100644 |
2208 |
+--- a/net/netfilter/xt_hashlimit.c |
2209 |
++++ b/net/netfilter/xt_hashlimit.c |
2210 |
+@@ -668,8 +668,9 @@ static int hashlimit_mt_check(const struct xt_mtchk_param *par) |
2211 |
+ |
2212 |
+ if (info->cfg.gc_interval == 0 || info->cfg.expire == 0) |
2213 |
+ return -EINVAL; |
2214 |
+- if (info->name[sizeof(info->name)-1] != '\0') |
2215 |
+- return -EINVAL; |
2216 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2217 |
++ if (ret) |
2218 |
++ return ret; |
2219 |
+ if (par->family == NFPROTO_IPV4) { |
2220 |
+ if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32) |
2221 |
+ return -EINVAL; |
2222 |
+diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c |
2223 |
+index d725a27743a1..cd53b861a15c 100644 |
2224 |
+--- a/net/netfilter/xt_recent.c |
2225 |
++++ b/net/netfilter/xt_recent.c |
2226 |
+@@ -364,9 +364,9 @@ static int recent_mt_check(const struct xt_mtchk_param *par, |
2227 |
+ info->hit_count, XT_RECENT_MAX_NSTAMPS - 1); |
2228 |
+ return -EINVAL; |
2229 |
+ } |
2230 |
+- if (info->name[0] == '\0' || |
2231 |
+- strnlen(info->name, XT_RECENT_NAME_LEN) == XT_RECENT_NAME_LEN) |
2232 |
+- return -EINVAL; |
2233 |
++ ret = xt_check_proc_name(info->name, sizeof(info->name)); |
2234 |
++ if (ret) |
2235 |
++ return ret; |
2236 |
+ |
2237 |
+ if (ip_pkt_list_tot && info->hit_count < ip_pkt_list_tot) |
2238 |
+ nstamp_mask = roundup_pow_of_two(ip_pkt_list_tot) - 1; |
2239 |
+diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c |
2240 |
+index ccfdc7115a83..a00ec715aa46 100644 |
2241 |
+--- a/net/xfrm/xfrm_ipcomp.c |
2242 |
++++ b/net/xfrm/xfrm_ipcomp.c |
2243 |
+@@ -283,7 +283,7 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name) |
2244 |
+ struct crypto_comp *tfm; |
2245 |
+ |
2246 |
+ /* This can be any valid CPU ID so we don't need locking. */ |
2247 |
+- tfm = __this_cpu_read(*pos->tfms); |
2248 |
++ tfm = this_cpu_read(*pos->tfms); |
2249 |
+ |
2250 |
+ if (!strcmp(crypto_comp_name(tfm), alg_name)) { |
2251 |
+ pos->users++; |
2252 |
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
2253 |
+index 96d664e198bf..34b5b4bcf5cb 100644 |
2254 |
+--- a/net/xfrm/xfrm_state.c |
2255 |
++++ b/net/xfrm/xfrm_state.c |
2256 |
+@@ -1845,6 +1845,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen |
2257 |
+ struct xfrm_mgr *km; |
2258 |
+ struct xfrm_policy *pol = NULL; |
2259 |
+ |
2260 |
++#ifdef CONFIG_COMPAT |
2261 |
++ if (is_compat_task()) |
2262 |
++ return -EOPNOTSUPP; |
2263 |
++#endif |
2264 |
++ |
2265 |
+ if (!optval && !optlen) { |
2266 |
+ xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); |
2267 |
+ xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL); |
2268 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
2269 |
+index fa856a07e40b..5d9f25cb6426 100644 |
2270 |
+--- a/net/xfrm/xfrm_user.c |
2271 |
++++ b/net/xfrm/xfrm_user.c |
2272 |
+@@ -121,22 +121,17 @@ static inline int verify_replay(struct xfrm_usersa_info *p, |
2273 |
+ struct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL]; |
2274 |
+ struct xfrm_replay_state_esn *rs; |
2275 |
+ |
2276 |
+- if (p->flags & XFRM_STATE_ESN) { |
2277 |
+- if (!rt) |
2278 |
+- return -EINVAL; |
2279 |
++ if (!rt) |
2280 |
++ return (p->flags & XFRM_STATE_ESN) ? -EINVAL : 0; |
2281 |
+ |
2282 |
+- rs = nla_data(rt); |
2283 |
++ rs = nla_data(rt); |
2284 |
+ |
2285 |
+- if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8) |
2286 |
+- return -EINVAL; |
2287 |
+- |
2288 |
+- if (nla_len(rt) < xfrm_replay_state_esn_len(rs) && |
2289 |
+- nla_len(rt) != sizeof(*rs)) |
2290 |
+- return -EINVAL; |
2291 |
+- } |
2292 |
++ if (rs->bmp_len > XFRMA_REPLAY_ESN_MAX / sizeof(rs->bmp[0]) / 8) |
2293 |
++ return -EINVAL; |
2294 |
+ |
2295 |
+- if (!rt) |
2296 |
+- return 0; |
2297 |
++ if (nla_len(rt) < xfrm_replay_state_esn_len(rs) && |
2298 |
++ nla_len(rt) != sizeof(*rs)) |
2299 |
++ return -EINVAL; |
2300 |
+ |
2301 |
+ /* As only ESP and AH support ESN feature. */ |
2302 |
+ if ((p->id.proto != IPPROTO_ESP) && (p->id.proto != IPPROTO_AH)) |
2303 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
2304 |
+index 4c7db967b7bb..4f690ab0feed 100644 |
2305 |
+--- a/security/selinux/hooks.c |
2306 |
++++ b/security/selinux/hooks.c |
2307 |
+@@ -333,18 +333,6 @@ static void superblock_free_security(struct super_block *sb) |
2308 |
+ kfree(sbsec); |
2309 |
+ } |
2310 |
+ |
2311 |
+-/* The file system's label must be initialized prior to use. */ |
2312 |
+- |
2313 |
+-static const char *labeling_behaviors[7] = { |
2314 |
+- "uses xattr", |
2315 |
+- "uses transition SIDs", |
2316 |
+- "uses task SIDs", |
2317 |
+- "uses genfs_contexts", |
2318 |
+- "not configured for labeling", |
2319 |
+- "uses mountpoint labeling", |
2320 |
+- "uses native labeling", |
2321 |
+-}; |
2322 |
+- |
2323 |
+ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry); |
2324 |
+ |
2325 |
+ static inline int inode_doinit(struct inode *inode) |
2326 |
+@@ -456,10 +444,6 @@ static int sb_finish_set_opts(struct super_block *sb) |
2327 |
+ } |
2328 |
+ } |
2329 |
+ |
2330 |
+- if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) |
2331 |
+- printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", |
2332 |
+- sb->s_id, sb->s_type->name); |
2333 |
+- |
2334 |
+ sbsec->flags |= SE_SBINITIALIZED; |
2335 |
+ if (selinux_is_sblabel_mnt(sb)) |
2336 |
+ sbsec->flags |= SBLABEL_MNT; |
2337 |
+diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c |
2338 |
+index db7eff3573a9..23dca68ffe25 100644 |
2339 |
+--- a/security/selinux/ss/services.c |
2340 |
++++ b/security/selinux/ss/services.c |
2341 |
+@@ -155,7 +155,7 @@ static int selinux_set_mapping(struct policydb *pol, |
2342 |
+ } |
2343 |
+ |
2344 |
+ k = 0; |
2345 |
+- while (p_in->perms && p_in->perms[k]) { |
2346 |
++ while (p_in->perms[k]) { |
2347 |
+ /* An empty permission string skips ahead */ |
2348 |
+ if (!*p_in->perms[k]) { |
2349 |
+ k++; |
2350 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
2351 |
+index daa1feac66bf..6cd8aec146f2 100644 |
2352 |
+--- a/sound/core/oss/pcm_oss.c |
2353 |
++++ b/sound/core/oss/pcm_oss.c |
2354 |
+@@ -1361,7 +1361,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha |
2355 |
+ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size_t bytes) |
2356 |
+ { |
2357 |
+ size_t xfer = 0; |
2358 |
+- ssize_t tmp; |
2359 |
++ ssize_t tmp = 0; |
2360 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2361 |
+ |
2362 |
+ if (atomic_read(&substream->mmap_count)) |
2363 |
+@@ -1468,7 +1468,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, |
2364 |
+ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t bytes) |
2365 |
+ { |
2366 |
+ size_t xfer = 0; |
2367 |
+- ssize_t tmp; |
2368 |
++ ssize_t tmp = 0; |
2369 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2370 |
+ |
2371 |
+ if (atomic_read(&substream->mmap_count)) |
2372 |
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
2373 |
+index 4ba64fd49759..ce2954a31238 100644 |
2374 |
+--- a/sound/core/pcm_native.c |
2375 |
++++ b/sound/core/pcm_native.c |
2376 |
+@@ -3408,7 +3408,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, |
2377 |
+ area, |
2378 |
+ substream->runtime->dma_area, |
2379 |
+ substream->runtime->dma_addr, |
2380 |
+- area->vm_end - area->vm_start); |
2381 |
++ substream->runtime->dma_bytes); |
2382 |
+ #endif /* CONFIG_X86 */ |
2383 |
+ /* mmap with fault handler */ |
2384 |
+ area->vm_ops = &snd_pcm_vm_ops_data_fault; |