1 |
commit: 0c077b037e79fe4e2131005f8ce03da817f59a33 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 31 10:43:11 2017 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 31 10:43:11 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0c077b03 |
7 |
|
8 |
Linux patch 4.4.59 |
9 |
|
10 |
0000_README | 4 + |
11 |
1058_linux-4.4.59.patch | 548 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 552 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 62c89c5..1be1dd6 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -275,6 +275,10 @@ Patch: 1057_linux-4.4.58.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.4.58 |
21 |
|
22 |
+Patch: 1058_linux-4.4.59.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.4.59 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1058_linux-4.4.59.patch b/1058_linux-4.4.59.patch |
31 |
new file mode 100644 |
32 |
index 0000000..49788f7 |
33 |
--- /dev/null |
34 |
+++ b/1058_linux-4.4.59.patch |
35 |
@@ -0,0 +1,548 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index 3efe2ea99e2d..083724c6ca4d 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 4 |
43 |
+-SUBLEVEL = 58 |
44 |
++SUBLEVEL = 59 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Blurry Fish Butt |
47 |
+ |
48 |
+diff --git a/arch/c6x/kernel/ptrace.c b/arch/c6x/kernel/ptrace.c |
49 |
+index 3c494e84444d..a511ac16a8e3 100644 |
50 |
+--- a/arch/c6x/kernel/ptrace.c |
51 |
++++ b/arch/c6x/kernel/ptrace.c |
52 |
+@@ -69,46 +69,6 @@ static int gpr_get(struct task_struct *target, |
53 |
+ 0, sizeof(*regs)); |
54 |
+ } |
55 |
+ |
56 |
+-static int gpr_set(struct task_struct *target, |
57 |
+- const struct user_regset *regset, |
58 |
+- unsigned int pos, unsigned int count, |
59 |
+- const void *kbuf, const void __user *ubuf) |
60 |
+-{ |
61 |
+- int ret; |
62 |
+- struct pt_regs *regs = task_pt_regs(target); |
63 |
+- |
64 |
+- /* Don't copyin TSR or CSR */ |
65 |
+- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
66 |
+- ®s, |
67 |
+- 0, PT_TSR * sizeof(long)); |
68 |
+- if (ret) |
69 |
+- return ret; |
70 |
+- |
71 |
+- ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, |
72 |
+- PT_TSR * sizeof(long), |
73 |
+- (PT_TSR + 1) * sizeof(long)); |
74 |
+- if (ret) |
75 |
+- return ret; |
76 |
+- |
77 |
+- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
78 |
+- ®s, |
79 |
+- (PT_TSR + 1) * sizeof(long), |
80 |
+- PT_CSR * sizeof(long)); |
81 |
+- if (ret) |
82 |
+- return ret; |
83 |
+- |
84 |
+- ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, |
85 |
+- PT_CSR * sizeof(long), |
86 |
+- (PT_CSR + 1) * sizeof(long)); |
87 |
+- if (ret) |
88 |
+- return ret; |
89 |
+- |
90 |
+- ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
91 |
+- ®s, |
92 |
+- (PT_CSR + 1) * sizeof(long), -1); |
93 |
+- return ret; |
94 |
+-} |
95 |
+- |
96 |
+ enum c6x_regset { |
97 |
+ REGSET_GPR, |
98 |
+ }; |
99 |
+@@ -120,7 +80,6 @@ static const struct user_regset c6x_regsets[] = { |
100 |
+ .size = sizeof(u32), |
101 |
+ .align = sizeof(u32), |
102 |
+ .get = gpr_get, |
103 |
+- .set = gpr_set |
104 |
+ }, |
105 |
+ }; |
106 |
+ |
107 |
+diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c |
108 |
+index 92075544a19a..0dc1c8f622bc 100644 |
109 |
+--- a/arch/h8300/kernel/ptrace.c |
110 |
++++ b/arch/h8300/kernel/ptrace.c |
111 |
+@@ -95,7 +95,8 @@ static int regs_get(struct task_struct *target, |
112 |
+ long *reg = (long *)®s; |
113 |
+ |
114 |
+ /* build user regs in buffer */ |
115 |
+- for (r = 0; r < ARRAY_SIZE(register_offset); r++) |
116 |
++ BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0); |
117 |
++ for (r = 0; r < sizeof(regs) / sizeof(long); r++) |
118 |
+ *reg++ = h8300_get_reg(target, r); |
119 |
+ |
120 |
+ return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
121 |
+@@ -113,7 +114,8 @@ static int regs_set(struct task_struct *target, |
122 |
+ long *reg; |
123 |
+ |
124 |
+ /* build user regs in buffer */ |
125 |
+- for (reg = (long *)®s, r = 0; r < ARRAY_SIZE(register_offset); r++) |
126 |
++ BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0); |
127 |
++ for (reg = (long *)®s, r = 0; r < sizeof(regs) / sizeof(long); r++) |
128 |
+ *reg++ = h8300_get_reg(target, r); |
129 |
+ |
130 |
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
131 |
+@@ -122,7 +124,7 @@ static int regs_set(struct task_struct *target, |
132 |
+ return ret; |
133 |
+ |
134 |
+ /* write back to pt_regs */ |
135 |
+- for (reg = (long *)®s, r = 0; r < ARRAY_SIZE(register_offset); r++) |
136 |
++ for (reg = (long *)®s, r = 0; r < sizeof(regs) / sizeof(long); r++) |
137 |
+ h8300_put_reg(target, r, *reg++); |
138 |
+ return 0; |
139 |
+ } |
140 |
+diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c |
141 |
+index 7563628822bd..5e2dc7defd2c 100644 |
142 |
+--- a/arch/metag/kernel/ptrace.c |
143 |
++++ b/arch/metag/kernel/ptrace.c |
144 |
+@@ -24,6 +24,16 @@ |
145 |
+ * user_regset definitions. |
146 |
+ */ |
147 |
+ |
148 |
++static unsigned long user_txstatus(const struct pt_regs *regs) |
149 |
++{ |
150 |
++ unsigned long data = (unsigned long)regs->ctx.Flags; |
151 |
++ |
152 |
++ if (regs->ctx.SaveMask & TBICTX_CBUF_BIT) |
153 |
++ data |= USER_GP_REGS_STATUS_CATCH_BIT; |
154 |
++ |
155 |
++ return data; |
156 |
++} |
157 |
++ |
158 |
+ int metag_gp_regs_copyout(const struct pt_regs *regs, |
159 |
+ unsigned int pos, unsigned int count, |
160 |
+ void *kbuf, void __user *ubuf) |
161 |
+@@ -62,9 +72,7 @@ int metag_gp_regs_copyout(const struct pt_regs *regs, |
162 |
+ if (ret) |
163 |
+ goto out; |
164 |
+ /* TXSTATUS */ |
165 |
+- data = (unsigned long)regs->ctx.Flags; |
166 |
+- if (regs->ctx.SaveMask & TBICTX_CBUF_BIT) |
167 |
+- data |= USER_GP_REGS_STATUS_CATCH_BIT; |
168 |
++ data = user_txstatus(regs); |
169 |
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
170 |
+ &data, 4*25, 4*26); |
171 |
+ if (ret) |
172 |
+@@ -119,6 +127,7 @@ int metag_gp_regs_copyin(struct pt_regs *regs, |
173 |
+ if (ret) |
174 |
+ goto out; |
175 |
+ /* TXSTATUS */ |
176 |
++ data = user_txstatus(regs); |
177 |
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
178 |
+ &data, 4*25, 4*26); |
179 |
+ if (ret) |
180 |
+@@ -244,6 +253,8 @@ int metag_rp_state_copyin(struct pt_regs *regs, |
181 |
+ unsigned long long *ptr; |
182 |
+ int ret, i; |
183 |
+ |
184 |
++ if (count < 4*13) |
185 |
++ return -EINVAL; |
186 |
+ /* Read the entire pipeline before making any changes */ |
187 |
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
188 |
+ &rp, 0, 4*13); |
189 |
+@@ -303,7 +314,7 @@ static int metag_tls_set(struct task_struct *target, |
190 |
+ const void *kbuf, const void __user *ubuf) |
191 |
+ { |
192 |
+ int ret; |
193 |
+- void __user *tls; |
194 |
++ void __user *tls = target->thread.tls_ptr; |
195 |
+ |
196 |
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); |
197 |
+ if (ret) |
198 |
+diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c |
199 |
+index 74d581569778..c95bf18260f8 100644 |
200 |
+--- a/arch/mips/kernel/ptrace.c |
201 |
++++ b/arch/mips/kernel/ptrace.c |
202 |
+@@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *target, |
203 |
+ &target->thread.fpu, |
204 |
+ 0, sizeof(elf_fpregset_t)); |
205 |
+ |
206 |
+- for (i = 0; i < NUM_FPU_REGS; i++) { |
207 |
++ BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t)); |
208 |
++ for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) { |
209 |
+ err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
210 |
+ &fpr_val, i * sizeof(elf_fpreg_t), |
211 |
+ (i + 1) * sizeof(elf_fpreg_t)); |
212 |
+diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c |
213 |
+index 9ddc4928a089..c1566170964f 100644 |
214 |
+--- a/arch/sparc/kernel/ptrace_64.c |
215 |
++++ b/arch/sparc/kernel/ptrace_64.c |
216 |
+@@ -311,7 +311,7 @@ static int genregs64_set(struct task_struct *target, |
217 |
+ } |
218 |
+ |
219 |
+ if (!ret) { |
220 |
+- unsigned long y; |
221 |
++ unsigned long y = regs->y; |
222 |
+ |
223 |
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
224 |
+ &y, |
225 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c |
226 |
+index 146264a41ec8..9736f9be5447 100644 |
227 |
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c |
228 |
++++ b/drivers/pinctrl/qcom/pinctrl-msm.c |
229 |
+@@ -597,10 +597,6 @@ static void msm_gpio_irq_unmask(struct irq_data *d) |
230 |
+ |
231 |
+ spin_lock_irqsave(&pctrl->lock, flags); |
232 |
+ |
233 |
+- val = readl(pctrl->regs + g->intr_status_reg); |
234 |
+- val &= ~BIT(g->intr_status_bit); |
235 |
+- writel(val, pctrl->regs + g->intr_status_reg); |
236 |
+- |
237 |
+ val = readl(pctrl->regs + g->intr_cfg_reg); |
238 |
+ val |= BIT(g->intr_enable_bit); |
239 |
+ writel(val, pctrl->regs + g->intr_cfg_reg); |
240 |
+diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c |
241 |
+index 56f7e2521202..01d15dca940e 100644 |
242 |
+--- a/drivers/virtio/virtio_balloon.c |
243 |
++++ b/drivers/virtio/virtio_balloon.c |
244 |
+@@ -416,6 +416,8 @@ static int init_vqs(struct virtio_balloon *vb) |
245 |
+ * Prime this virtqueue with one buffer so the hypervisor can |
246 |
+ * use it to signal us later (it can't be broken yet!). |
247 |
+ */ |
248 |
++ update_balloon_stats(vb); |
249 |
++ |
250 |
+ sg_init_one(&sg, vb->stats, sizeof vb->stats); |
251 |
+ if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL) |
252 |
+ < 0) |
253 |
+diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c |
254 |
+index 9a16d1e75a49..505f8afde57c 100644 |
255 |
+--- a/fs/ext4/crypto_key.c |
256 |
++++ b/fs/ext4/crypto_key.c |
257 |
+@@ -88,8 +88,6 @@ void ext4_free_crypt_info(struct ext4_crypt_info *ci) |
258 |
+ if (!ci) |
259 |
+ return; |
260 |
+ |
261 |
+- if (ci->ci_keyring_key) |
262 |
+- key_put(ci->ci_keyring_key); |
263 |
+ crypto_free_ablkcipher(ci->ci_ctfm); |
264 |
+ kmem_cache_free(ext4_crypt_info_cachep, ci); |
265 |
+ } |
266 |
+@@ -111,7 +109,7 @@ void ext4_free_encryption_info(struct inode *inode, |
267 |
+ ext4_free_crypt_info(ci); |
268 |
+ } |
269 |
+ |
270 |
+-int _ext4_get_encryption_info(struct inode *inode) |
271 |
++int ext4_get_encryption_info(struct inode *inode) |
272 |
+ { |
273 |
+ struct ext4_inode_info *ei = EXT4_I(inode); |
274 |
+ struct ext4_crypt_info *crypt_info; |
275 |
+@@ -128,22 +126,15 @@ int _ext4_get_encryption_info(struct inode *inode) |
276 |
+ char mode; |
277 |
+ int res; |
278 |
+ |
279 |
++ if (ei->i_crypt_info) |
280 |
++ return 0; |
281 |
++ |
282 |
+ if (!ext4_read_workqueue) { |
283 |
+ res = ext4_init_crypto(); |
284 |
+ if (res) |
285 |
+ return res; |
286 |
+ } |
287 |
+ |
288 |
+-retry: |
289 |
+- crypt_info = ACCESS_ONCE(ei->i_crypt_info); |
290 |
+- if (crypt_info) { |
291 |
+- if (!crypt_info->ci_keyring_key || |
292 |
+- key_validate(crypt_info->ci_keyring_key) == 0) |
293 |
+- return 0; |
294 |
+- ext4_free_encryption_info(inode, crypt_info); |
295 |
+- goto retry; |
296 |
+- } |
297 |
+- |
298 |
+ res = ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION, |
299 |
+ EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, |
300 |
+ &ctx, sizeof(ctx)); |
301 |
+@@ -166,7 +157,6 @@ retry: |
302 |
+ crypt_info->ci_data_mode = ctx.contents_encryption_mode; |
303 |
+ crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; |
304 |
+ crypt_info->ci_ctfm = NULL; |
305 |
+- crypt_info->ci_keyring_key = NULL; |
306 |
+ memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, |
307 |
+ sizeof(crypt_info->ci_master_key)); |
308 |
+ if (S_ISREG(inode->i_mode)) |
309 |
+@@ -206,7 +196,6 @@ retry: |
310 |
+ keyring_key = NULL; |
311 |
+ goto out; |
312 |
+ } |
313 |
+- crypt_info->ci_keyring_key = keyring_key; |
314 |
+ if (keyring_key->type != &key_type_logon) { |
315 |
+ printk_once(KERN_WARNING |
316 |
+ "ext4: key type must be logon\n"); |
317 |
+@@ -253,16 +242,13 @@ got_key: |
318 |
+ ext4_encryption_key_size(mode)); |
319 |
+ if (res) |
320 |
+ goto out; |
321 |
+- memzero_explicit(raw_key, sizeof(raw_key)); |
322 |
+- if (cmpxchg(&ei->i_crypt_info, NULL, crypt_info) != NULL) { |
323 |
+- ext4_free_crypt_info(crypt_info); |
324 |
+- goto retry; |
325 |
+- } |
326 |
+- return 0; |
327 |
+ |
328 |
++ if (cmpxchg(&ei->i_crypt_info, NULL, crypt_info) == NULL) |
329 |
++ crypt_info = NULL; |
330 |
+ out: |
331 |
+ if (res == -ENOKEY) |
332 |
+ res = 0; |
333 |
++ key_put(keyring_key); |
334 |
+ ext4_free_crypt_info(crypt_info); |
335 |
+ memzero_explicit(raw_key, sizeof(raw_key)); |
336 |
+ return res; |
337 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
338 |
+index cd5914495ad7..362d59b24f1d 100644 |
339 |
+--- a/fs/ext4/ext4.h |
340 |
++++ b/fs/ext4/ext4.h |
341 |
+@@ -2330,23 +2330,11 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname) { } |
342 |
+ /* crypto_key.c */ |
343 |
+ void ext4_free_crypt_info(struct ext4_crypt_info *ci); |
344 |
+ void ext4_free_encryption_info(struct inode *inode, struct ext4_crypt_info *ci); |
345 |
+-int _ext4_get_encryption_info(struct inode *inode); |
346 |
+ |
347 |
+ #ifdef CONFIG_EXT4_FS_ENCRYPTION |
348 |
+ int ext4_has_encryption_key(struct inode *inode); |
349 |
+ |
350 |
+-static inline int ext4_get_encryption_info(struct inode *inode) |
351 |
+-{ |
352 |
+- struct ext4_crypt_info *ci = EXT4_I(inode)->i_crypt_info; |
353 |
+- |
354 |
+- if (!ci || |
355 |
+- (ci->ci_keyring_key && |
356 |
+- (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) | |
357 |
+- (1 << KEY_FLAG_REVOKED) | |
358 |
+- (1 << KEY_FLAG_DEAD))))) |
359 |
+- return _ext4_get_encryption_info(inode); |
360 |
+- return 0; |
361 |
+-} |
362 |
++int ext4_get_encryption_info(struct inode *inode); |
363 |
+ |
364 |
+ static inline struct ext4_crypt_info *ext4_encryption_info(struct inode *inode) |
365 |
+ { |
366 |
+diff --git a/fs/ext4/ext4_crypto.h b/fs/ext4/ext4_crypto.h |
367 |
+index ac7d4e813796..1b17b05b9f4d 100644 |
368 |
+--- a/fs/ext4/ext4_crypto.h |
369 |
++++ b/fs/ext4/ext4_crypto.h |
370 |
+@@ -78,7 +78,6 @@ struct ext4_crypt_info { |
371 |
+ char ci_filename_mode; |
372 |
+ char ci_flags; |
373 |
+ struct crypto_ablkcipher *ci_ctfm; |
374 |
+- struct key *ci_keyring_key; |
375 |
+ char ci_master_key[EXT4_KEY_DESCRIPTOR_SIZE]; |
376 |
+ }; |
377 |
+ |
378 |
+diff --git a/fs/f2fs/crypto_key.c b/fs/f2fs/crypto_key.c |
379 |
+index 5de2d866a25c..18595d7a0efc 100644 |
380 |
+--- a/fs/f2fs/crypto_key.c |
381 |
++++ b/fs/f2fs/crypto_key.c |
382 |
+@@ -92,7 +92,6 @@ static void f2fs_free_crypt_info(struct f2fs_crypt_info *ci) |
383 |
+ if (!ci) |
384 |
+ return; |
385 |
+ |
386 |
+- key_put(ci->ci_keyring_key); |
387 |
+ crypto_free_ablkcipher(ci->ci_ctfm); |
388 |
+ kmem_cache_free(f2fs_crypt_info_cachep, ci); |
389 |
+ } |
390 |
+@@ -113,7 +112,7 @@ void f2fs_free_encryption_info(struct inode *inode, struct f2fs_crypt_info *ci) |
391 |
+ f2fs_free_crypt_info(ci); |
392 |
+ } |
393 |
+ |
394 |
+-int _f2fs_get_encryption_info(struct inode *inode) |
395 |
++int f2fs_get_encryption_info(struct inode *inode) |
396 |
+ { |
397 |
+ struct f2fs_inode_info *fi = F2FS_I(inode); |
398 |
+ struct f2fs_crypt_info *crypt_info; |
399 |
+@@ -129,18 +128,12 @@ int _f2fs_get_encryption_info(struct inode *inode) |
400 |
+ char mode; |
401 |
+ int res; |
402 |
+ |
403 |
++ if (fi->i_crypt_info) |
404 |
++ return 0; |
405 |
++ |
406 |
+ res = f2fs_crypto_initialize(); |
407 |
+ if (res) |
408 |
+ return res; |
409 |
+-retry: |
410 |
+- crypt_info = ACCESS_ONCE(fi->i_crypt_info); |
411 |
+- if (crypt_info) { |
412 |
+- if (!crypt_info->ci_keyring_key || |
413 |
+- key_validate(crypt_info->ci_keyring_key) == 0) |
414 |
+- return 0; |
415 |
+- f2fs_free_encryption_info(inode, crypt_info); |
416 |
+- goto retry; |
417 |
+- } |
418 |
+ |
419 |
+ res = f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, |
420 |
+ F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, |
421 |
+@@ -159,7 +152,6 @@ retry: |
422 |
+ crypt_info->ci_data_mode = ctx.contents_encryption_mode; |
423 |
+ crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; |
424 |
+ crypt_info->ci_ctfm = NULL; |
425 |
+- crypt_info->ci_keyring_key = NULL; |
426 |
+ memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, |
427 |
+ sizeof(crypt_info->ci_master_key)); |
428 |
+ if (S_ISREG(inode->i_mode)) |
429 |
+@@ -197,7 +189,6 @@ retry: |
430 |
+ keyring_key = NULL; |
431 |
+ goto out; |
432 |
+ } |
433 |
+- crypt_info->ci_keyring_key = keyring_key; |
434 |
+ BUG_ON(keyring_key->type != &key_type_logon); |
435 |
+ ukp = user_key_payload(keyring_key); |
436 |
+ if (ukp->datalen != sizeof(struct f2fs_encryption_key)) { |
437 |
+@@ -230,17 +221,12 @@ retry: |
438 |
+ if (res) |
439 |
+ goto out; |
440 |
+ |
441 |
+- memzero_explicit(raw_key, sizeof(raw_key)); |
442 |
+- if (cmpxchg(&fi->i_crypt_info, NULL, crypt_info) != NULL) { |
443 |
+- f2fs_free_crypt_info(crypt_info); |
444 |
+- goto retry; |
445 |
+- } |
446 |
+- return 0; |
447 |
+- |
448 |
++ if (cmpxchg(&fi->i_crypt_info, NULL, crypt_info) == NULL) |
449 |
++ crypt_info = NULL; |
450 |
+ out: |
451 |
+ if (res == -ENOKEY && !S_ISREG(inode->i_mode)) |
452 |
+ res = 0; |
453 |
+- |
454 |
++ key_put(keyring_key); |
455 |
+ f2fs_free_crypt_info(crypt_info); |
456 |
+ memzero_explicit(raw_key, sizeof(raw_key)); |
457 |
+ return res; |
458 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
459 |
+index 9db5500d63d9..b1aeca83f4be 100644 |
460 |
+--- a/fs/f2fs/f2fs.h |
461 |
++++ b/fs/f2fs/f2fs.h |
462 |
+@@ -2149,7 +2149,6 @@ void f2fs_end_io_crypto_work(struct f2fs_crypto_ctx *, struct bio *); |
463 |
+ |
464 |
+ /* crypto_key.c */ |
465 |
+ void f2fs_free_encryption_info(struct inode *, struct f2fs_crypt_info *); |
466 |
+-int _f2fs_get_encryption_info(struct inode *inode); |
467 |
+ |
468 |
+ /* crypto_fname.c */ |
469 |
+ bool f2fs_valid_filenames_enc_mode(uint32_t); |
470 |
+@@ -2170,18 +2169,7 @@ void f2fs_exit_crypto(void); |
471 |
+ |
472 |
+ int f2fs_has_encryption_key(struct inode *); |
473 |
+ |
474 |
+-static inline int f2fs_get_encryption_info(struct inode *inode) |
475 |
+-{ |
476 |
+- struct f2fs_crypt_info *ci = F2FS_I(inode)->i_crypt_info; |
477 |
+- |
478 |
+- if (!ci || |
479 |
+- (ci->ci_keyring_key && |
480 |
+- (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) | |
481 |
+- (1 << KEY_FLAG_REVOKED) | |
482 |
+- (1 << KEY_FLAG_DEAD))))) |
483 |
+- return _f2fs_get_encryption_info(inode); |
484 |
+- return 0; |
485 |
+-} |
486 |
++int f2fs_get_encryption_info(struct inode *inode); |
487 |
+ |
488 |
+ void f2fs_fname_crypto_free_buffer(struct f2fs_str *); |
489 |
+ int f2fs_fname_setup_filename(struct inode *, const struct qstr *, |
490 |
+diff --git a/fs/f2fs/f2fs_crypto.h b/fs/f2fs/f2fs_crypto.h |
491 |
+index c2c1c2b63b25..f113f1a1e8c1 100644 |
492 |
+--- a/fs/f2fs/f2fs_crypto.h |
493 |
++++ b/fs/f2fs/f2fs_crypto.h |
494 |
+@@ -79,7 +79,6 @@ struct f2fs_crypt_info { |
495 |
+ char ci_filename_mode; |
496 |
+ char ci_flags; |
497 |
+ struct crypto_ablkcipher *ci_ctfm; |
498 |
+- struct key *ci_keyring_key; |
499 |
+ char ci_master_key[F2FS_KEY_DESCRIPTOR_SIZE]; |
500 |
+ }; |
501 |
+ |
502 |
+diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c |
503 |
+index 8b0a15e285f9..e984f059e5fc 100644 |
504 |
+--- a/kernel/sched/deadline.c |
505 |
++++ b/kernel/sched/deadline.c |
506 |
+@@ -1771,12 +1771,11 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) |
507 |
+ #ifdef CONFIG_SMP |
508 |
+ if (p->nr_cpus_allowed > 1 && rq->dl.overloaded) |
509 |
+ queue_push_tasks(rq); |
510 |
+-#else |
511 |
++#endif |
512 |
+ if (dl_task(rq->curr)) |
513 |
+ check_preempt_curr_dl(rq, p, 0); |
514 |
+ else |
515 |
+ resched_curr(rq); |
516 |
+-#endif |
517 |
+ } |
518 |
+ } |
519 |
+ |
520 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
521 |
+index 8ec86abe0ea1..78ae5c1d9412 100644 |
522 |
+--- a/kernel/sched/rt.c |
523 |
++++ b/kernel/sched/rt.c |
524 |
+@@ -2136,10 +2136,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p) |
525 |
+ #ifdef CONFIG_SMP |
526 |
+ if (p->nr_cpus_allowed > 1 && rq->rt.overloaded) |
527 |
+ queue_push_tasks(rq); |
528 |
+-#else |
529 |
++#endif /* CONFIG_SMP */ |
530 |
+ if (p->prio < rq->curr->prio) |
531 |
+ resched_curr(rq); |
532 |
+-#endif /* CONFIG_SMP */ |
533 |
+ } |
534 |
+ } |
535 |
+ |
536 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
537 |
+index b5e665b3cfb0..36a50ef9295d 100644 |
538 |
+--- a/net/xfrm/xfrm_policy.c |
539 |
++++ b/net/xfrm/xfrm_policy.c |
540 |
+@@ -3030,6 +3030,11 @@ static int __net_init xfrm_net_init(struct net *net) |
541 |
+ { |
542 |
+ int rv; |
543 |
+ |
544 |
++ /* Initialize the per-net locks here */ |
545 |
++ spin_lock_init(&net->xfrm.xfrm_state_lock); |
546 |
++ rwlock_init(&net->xfrm.xfrm_policy_lock); |
547 |
++ mutex_init(&net->xfrm.xfrm_cfg_mutex); |
548 |
++ |
549 |
+ rv = xfrm_statistics_init(net); |
550 |
+ if (rv < 0) |
551 |
+ goto out_statistics; |
552 |
+@@ -3046,11 +3051,6 @@ static int __net_init xfrm_net_init(struct net *net) |
553 |
+ if (rv < 0) |
554 |
+ goto out; |
555 |
+ |
556 |
+- /* Initialize the per-net locks here */ |
557 |
+- spin_lock_init(&net->xfrm.xfrm_state_lock); |
558 |
+- rwlock_init(&net->xfrm.xfrm_policy_lock); |
559 |
+- mutex_init(&net->xfrm.xfrm_cfg_mutex); |
560 |
+- |
561 |
+ return 0; |
562 |
+ |
563 |
+ out: |
564 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
565 |
+index 805681a7d356..7a5a64e70b4d 100644 |
566 |
+--- a/net/xfrm/xfrm_user.c |
567 |
++++ b/net/xfrm/xfrm_user.c |
568 |
+@@ -412,7 +412,14 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es |
569 |
+ up = nla_data(rp); |
570 |
+ ulen = xfrm_replay_state_esn_len(up); |
571 |
+ |
572 |
+- if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen) |
573 |
++ /* Check the overall length and the internal bitmap length to avoid |
574 |
++ * potential overflow. */ |
575 |
++ if (nla_len(rp) < ulen || |
576 |
++ xfrm_replay_state_esn_len(replay_esn) != ulen || |
577 |
++ replay_esn->bmp_len != up->bmp_len) |
578 |
++ return -EINVAL; |
579 |
++ |
580 |
++ if (up->replay_window > up->bmp_len * sizeof(__u32) * 8) |
581 |
+ return -EINVAL; |
582 |
+ |
583 |
+ return 0; |