Contents of /trunk/kernel-alx/patches-4.19/0107-4.19.8-all-fixes.patch
Parent Directory | Revision Log
Revision 3386 -
(show annotations)
(download)
Fri Aug 2 11:47:07 2019 UTC (5 years, 1 month ago) by niro
File size: 48929 byte(s)
Fri Aug 2 11:47:07 2019 UTC (5 years, 1 month ago) by niro
File size: 48929 byte(s)
-linux-4.19.8
1 | diff --git a/Makefile b/Makefile |
2 | index d2b4efcfb388..34bc4c752c49 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 4 |
8 | PATCHLEVEL = 19 |
9 | -SUBLEVEL = 7 |
10 | +SUBLEVEL = 8 |
11 | EXTRAVERSION = |
12 | NAME = "People's Front" |
13 | |
14 | diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig |
15 | index a045f3086047..a90c4f126050 100644 |
16 | --- a/arch/arc/Kconfig |
17 | +++ b/arch/arc/Kconfig |
18 | @@ -111,7 +111,7 @@ endmenu |
19 | |
20 | choice |
21 | prompt "ARC Instruction Set" |
22 | - default ISA_ARCOMPACT |
23 | + default ISA_ARCV2 |
24 | |
25 | config ISA_ARCOMPACT |
26 | bool "ARCompact ISA" |
27 | diff --git a/arch/arc/Makefile b/arch/arc/Makefile |
28 | index 644815c0516e..16e6cc22e25c 100644 |
29 | --- a/arch/arc/Makefile |
30 | +++ b/arch/arc/Makefile |
31 | @@ -6,7 +6,7 @@ |
32 | # published by the Free Software Foundation. |
33 | # |
34 | |
35 | -KBUILD_DEFCONFIG := nsim_700_defconfig |
36 | +KBUILD_DEFCONFIG := nsim_hs_defconfig |
37 | |
38 | cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ |
39 | cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 |
40 | diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig |
41 | index 41bc08be6a3b..020d4493edfd 100644 |
42 | --- a/arch/arc/configs/axs101_defconfig |
43 | +++ b/arch/arc/configs/axs101_defconfig |
44 | @@ -14,6 +14,7 @@ CONFIG_PERF_EVENTS=y |
45 | # CONFIG_VM_EVENT_COUNTERS is not set |
46 | # CONFIG_SLUB_DEBUG is not set |
47 | # CONFIG_COMPAT_BRK is not set |
48 | +CONFIG_ISA_ARCOMPACT=y |
49 | CONFIG_MODULES=y |
50 | CONFIG_MODULE_FORCE_LOAD=y |
51 | CONFIG_MODULE_UNLOAD=y |
52 | @@ -95,6 +96,7 @@ CONFIG_VFAT_FS=y |
53 | CONFIG_NTFS_FS=y |
54 | CONFIG_TMPFS=y |
55 | CONFIG_NFS_FS=y |
56 | +CONFIG_NFS_V3_ACL=y |
57 | CONFIG_NLS_CODEPAGE_437=y |
58 | CONFIG_NLS_ISO8859_1=y |
59 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
60 | diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig |
61 | index 1e1c4a8011b5..666314fffc60 100644 |
62 | --- a/arch/arc/configs/axs103_defconfig |
63 | +++ b/arch/arc/configs/axs103_defconfig |
64 | @@ -94,6 +94,7 @@ CONFIG_VFAT_FS=y |
65 | CONFIG_NTFS_FS=y |
66 | CONFIG_TMPFS=y |
67 | CONFIG_NFS_FS=y |
68 | +CONFIG_NFS_V3_ACL=y |
69 | CONFIG_NLS_CODEPAGE_437=y |
70 | CONFIG_NLS_ISO8859_1=y |
71 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
72 | diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig |
73 | index 6b0c0cfd5c30..429832b8560b 100644 |
74 | --- a/arch/arc/configs/axs103_smp_defconfig |
75 | +++ b/arch/arc/configs/axs103_smp_defconfig |
76 | @@ -97,6 +97,7 @@ CONFIG_VFAT_FS=y |
77 | CONFIG_NTFS_FS=y |
78 | CONFIG_TMPFS=y |
79 | CONFIG_NFS_FS=y |
80 | +CONFIG_NFS_V3_ACL=y |
81 | CONFIG_NLS_CODEPAGE_437=y |
82 | CONFIG_NLS_ISO8859_1=y |
83 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
84 | diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig |
85 | index 1dec2b4bc5e6..2a1d2cbfee1a 100644 |
86 | --- a/arch/arc/configs/hsdk_defconfig |
87 | +++ b/arch/arc/configs/hsdk_defconfig |
88 | @@ -65,6 +65,7 @@ CONFIG_EXT3_FS=y |
89 | CONFIG_VFAT_FS=y |
90 | CONFIG_TMPFS=y |
91 | CONFIG_NFS_FS=y |
92 | +CONFIG_NFS_V3_ACL=y |
93 | CONFIG_NLS_CODEPAGE_437=y |
94 | CONFIG_NLS_ISO8859_1=y |
95 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
96 | diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig |
97 | index 31ba224bbfb4..6e84060e7c90 100644 |
98 | --- a/arch/arc/configs/nps_defconfig |
99 | +++ b/arch/arc/configs/nps_defconfig |
100 | @@ -15,6 +15,7 @@ CONFIG_SYSCTL_SYSCALL=y |
101 | CONFIG_EMBEDDED=y |
102 | CONFIG_PERF_EVENTS=y |
103 | # CONFIG_COMPAT_BRK is not set |
104 | +CONFIG_ISA_ARCOMPACT=y |
105 | CONFIG_KPROBES=y |
106 | CONFIG_MODULES=y |
107 | CONFIG_MODULE_FORCE_LOAD=y |
108 | @@ -73,6 +74,7 @@ CONFIG_PROC_KCORE=y |
109 | CONFIG_TMPFS=y |
110 | # CONFIG_MISC_FILESYSTEMS is not set |
111 | CONFIG_NFS_FS=y |
112 | +CONFIG_NFS_V3_ACL=y |
113 | CONFIG_ROOT_NFS=y |
114 | CONFIG_DEBUG_INFO=y |
115 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
116 | diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig |
117 | index 8e0b8b134cd9..219c2a65294b 100644 |
118 | --- a/arch/arc/configs/nsim_700_defconfig |
119 | +++ b/arch/arc/configs/nsim_700_defconfig |
120 | @@ -15,6 +15,7 @@ CONFIG_EMBEDDED=y |
121 | CONFIG_PERF_EVENTS=y |
122 | # CONFIG_SLUB_DEBUG is not set |
123 | # CONFIG_COMPAT_BRK is not set |
124 | +CONFIG_ISA_ARCOMPACT=y |
125 | CONFIG_KPROBES=y |
126 | CONFIG_MODULES=y |
127 | # CONFIG_LBDAF is not set |
128 | diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig |
129 | index f14eeff7d308..35dfc6491a09 100644 |
130 | --- a/arch/arc/configs/nsimosci_defconfig |
131 | +++ b/arch/arc/configs/nsimosci_defconfig |
132 | @@ -15,6 +15,7 @@ CONFIG_EMBEDDED=y |
133 | CONFIG_PERF_EVENTS=y |
134 | # CONFIG_SLUB_DEBUG is not set |
135 | # CONFIG_COMPAT_BRK is not set |
136 | +CONFIG_ISA_ARCOMPACT=y |
137 | CONFIG_KPROBES=y |
138 | CONFIG_MODULES=y |
139 | # CONFIG_LBDAF is not set |
140 | @@ -66,5 +67,6 @@ CONFIG_EXT2_FS_XATTR=y |
141 | CONFIG_TMPFS=y |
142 | # CONFIG_MISC_FILESYSTEMS is not set |
143 | CONFIG_NFS_FS=y |
144 | +CONFIG_NFS_V3_ACL=y |
145 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
146 | # CONFIG_ENABLE_MUST_CHECK is not set |
147 | diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig |
148 | index 025298a48305..1638e5bc9672 100644 |
149 | --- a/arch/arc/configs/nsimosci_hs_defconfig |
150 | +++ b/arch/arc/configs/nsimosci_hs_defconfig |
151 | @@ -65,5 +65,6 @@ CONFIG_EXT2_FS_XATTR=y |
152 | CONFIG_TMPFS=y |
153 | # CONFIG_MISC_FILESYSTEMS is not set |
154 | CONFIG_NFS_FS=y |
155 | +CONFIG_NFS_V3_ACL=y |
156 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
157 | # CONFIG_ENABLE_MUST_CHECK is not set |
158 | diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig |
159 | index df7b77b13b82..11cfbdb0f441 100644 |
160 | --- a/arch/arc/configs/nsimosci_hs_smp_defconfig |
161 | +++ b/arch/arc/configs/nsimosci_hs_smp_defconfig |
162 | @@ -76,6 +76,7 @@ CONFIG_EXT2_FS_XATTR=y |
163 | CONFIG_TMPFS=y |
164 | # CONFIG_MISC_FILESYSTEMS is not set |
165 | CONFIG_NFS_FS=y |
166 | +CONFIG_NFS_V3_ACL=y |
167 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
168 | # CONFIG_ENABLE_MUST_CHECK is not set |
169 | CONFIG_FTRACE=y |
170 | diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig |
171 | index a7f65313f84a..e71ade3cf9c8 100644 |
172 | --- a/arch/arc/configs/tb10x_defconfig |
173 | +++ b/arch/arc/configs/tb10x_defconfig |
174 | @@ -19,6 +19,7 @@ CONFIG_KALLSYMS_ALL=y |
175 | # CONFIG_AIO is not set |
176 | CONFIG_EMBEDDED=y |
177 | # CONFIG_COMPAT_BRK is not set |
178 | +CONFIG_ISA_ARCOMPACT=y |
179 | CONFIG_SLAB=y |
180 | CONFIG_MODULES=y |
181 | CONFIG_MODULE_FORCE_LOAD=y |
182 | diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig |
183 | index db47c3541f15..1e59a2e9c602 100644 |
184 | --- a/arch/arc/configs/vdk_hs38_defconfig |
185 | +++ b/arch/arc/configs/vdk_hs38_defconfig |
186 | @@ -85,6 +85,7 @@ CONFIG_NTFS_FS=y |
187 | CONFIG_TMPFS=y |
188 | CONFIG_JFFS2_FS=y |
189 | CONFIG_NFS_FS=y |
190 | +CONFIG_NFS_V3_ACL=y |
191 | CONFIG_NLS_CODEPAGE_437=y |
192 | CONFIG_NLS_ISO8859_1=y |
193 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
194 | diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig |
195 | index a8ac5e917d9a..b5c3f6c54b03 100644 |
196 | --- a/arch/arc/configs/vdk_hs38_smp_defconfig |
197 | +++ b/arch/arc/configs/vdk_hs38_smp_defconfig |
198 | @@ -90,6 +90,7 @@ CONFIG_NTFS_FS=y |
199 | CONFIG_TMPFS=y |
200 | CONFIG_JFFS2_FS=y |
201 | CONFIG_NFS_FS=y |
202 | +CONFIG_NFS_V3_ACL=y |
203 | CONFIG_NLS_CODEPAGE_437=y |
204 | CONFIG_NLS_ISO8859_1=y |
205 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
206 | diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h |
207 | index caa955f10e19..fac54fb050d0 100644 |
208 | --- a/arch/arm64/include/asm/ftrace.h |
209 | +++ b/arch/arm64/include/asm/ftrace.h |
210 | @@ -56,6 +56,19 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) |
211 | { |
212 | return is_compat_task(); |
213 | } |
214 | + |
215 | +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME |
216 | + |
217 | +static inline bool arch_syscall_match_sym_name(const char *sym, |
218 | + const char *name) |
219 | +{ |
220 | + /* |
221 | + * Since all syscall functions have __arm64_ prefix, we must skip it. |
222 | + * However, as we described above, we decided to ignore compat |
223 | + * syscalls, so we don't care about __arm64_compat_ prefix here. |
224 | + */ |
225 | + return !strcmp(sym + 8, name); |
226 | +} |
227 | #endif /* ifndef __ASSEMBLY__ */ |
228 | |
229 | #endif /* __ASM_FTRACE_H */ |
230 | diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h |
231 | index 0170602a1e4e..6cf8ffb5367e 100644 |
232 | --- a/arch/mips/include/asm/syscall.h |
233 | +++ b/arch/mips/include/asm/syscall.h |
234 | @@ -73,7 +73,7 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, |
235 | #ifdef CONFIG_64BIT |
236 | case 4: case 5: case 6: case 7: |
237 | #ifdef CONFIG_MIPS32_O32 |
238 | - if (test_thread_flag(TIF_32BIT_REGS)) |
239 | + if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) |
240 | return get_user(*arg, (int *)usp + n); |
241 | else |
242 | #endif |
243 | diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c |
244 | index 41b71c4352c2..c1ce6f43642b 100644 |
245 | --- a/arch/mips/ralink/mt7620.c |
246 | +++ b/arch/mips/ralink/mt7620.c |
247 | @@ -84,7 +84,7 @@ static struct rt2880_pmx_func pcie_rst_grp[] = { |
248 | }; |
249 | static struct rt2880_pmx_func nd_sd_grp[] = { |
250 | FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15), |
251 | - FUNC("sd", MT7620_GPIO_MODE_SD, 45, 15) |
252 | + FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13) |
253 | }; |
254 | |
255 | static struct rt2880_pmx_group mt7620a_pinmux_data[] = { |
256 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
257 | index 4397fa0c448f..f1d3fe5a0c65 100644 |
258 | --- a/arch/x86/kvm/svm.c |
259 | +++ b/arch/x86/kvm/svm.c |
260 | @@ -1663,20 +1663,23 @@ static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, |
261 | static int avic_init_access_page(struct kvm_vcpu *vcpu) |
262 | { |
263 | struct kvm *kvm = vcpu->kvm; |
264 | - int ret; |
265 | + int ret = 0; |
266 | |
267 | + mutex_lock(&kvm->slots_lock); |
268 | if (kvm->arch.apic_access_page_done) |
269 | - return 0; |
270 | + goto out; |
271 | |
272 | - ret = x86_set_memory_region(kvm, |
273 | - APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, |
274 | - APIC_DEFAULT_PHYS_BASE, |
275 | - PAGE_SIZE); |
276 | + ret = __x86_set_memory_region(kvm, |
277 | + APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, |
278 | + APIC_DEFAULT_PHYS_BASE, |
279 | + PAGE_SIZE); |
280 | if (ret) |
281 | - return ret; |
282 | + goto out; |
283 | |
284 | kvm->arch.apic_access_page_done = true; |
285 | - return 0; |
286 | +out: |
287 | + mutex_unlock(&kvm->slots_lock); |
288 | + return ret; |
289 | } |
290 | |
291 | static int avic_init_backing_page(struct kvm_vcpu *vcpu) |
292 | diff --git a/block/blk-mq.c b/block/blk-mq.c |
293 | index e3c39ea8e17b..23a53b67cf0d 100644 |
294 | --- a/block/blk-mq.c |
295 | +++ b/block/blk-mq.c |
296 | @@ -1747,7 +1747,7 @@ insert: |
297 | if (bypass_insert) |
298 | return BLK_STS_RESOURCE; |
299 | |
300 | - blk_mq_sched_insert_request(rq, false, run_queue, false); |
301 | + blk_mq_request_bypass_insert(rq, run_queue); |
302 | return BLK_STS_OK; |
303 | } |
304 | |
305 | @@ -1763,7 +1763,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, |
306 | |
307 | ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false); |
308 | if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) |
309 | - blk_mq_sched_insert_request(rq, false, true, false); |
310 | + blk_mq_request_bypass_insert(rq, true); |
311 | else if (ret != BLK_STS_OK) |
312 | blk_mq_end_request(rq, ret); |
313 | |
314 | @@ -1798,7 +1798,8 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, |
315 | if (ret != BLK_STS_OK) { |
316 | if (ret == BLK_STS_RESOURCE || |
317 | ret == BLK_STS_DEV_RESOURCE) { |
318 | - list_add(&rq->queuelist, list); |
319 | + blk_mq_request_bypass_insert(rq, |
320 | + list_empty(list)); |
321 | break; |
322 | } |
323 | blk_mq_end_request(rq, ret); |
324 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
325 | index 4cc45a1d21db..59445c83f023 100644 |
326 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
327 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |
328 | @@ -374,6 +374,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
329 | master->connector_id); |
330 | |
331 | aconnector->mst_encoder = dm_dp_create_fake_mst_encoder(master); |
332 | + drm_connector_attach_encoder(&aconnector->base, |
333 | + &aconnector->mst_encoder->base); |
334 | |
335 | /* |
336 | * TODO: understand why this one is needed |
337 | diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c |
338 | index dac355812adc..373700c05a00 100644 |
339 | --- a/drivers/gpu/drm/ast/ast_main.c |
340 | +++ b/drivers/gpu/drm/ast/ast_main.c |
341 | @@ -583,7 +583,8 @@ void ast_driver_unload(struct drm_device *dev) |
342 | drm_mode_config_cleanup(dev); |
343 | |
344 | ast_mm_fini(ast); |
345 | - pci_iounmap(dev->pdev, ast->ioregs); |
346 | + if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) |
347 | + pci_iounmap(dev->pdev, ast->ioregs); |
348 | pci_iounmap(dev->pdev, ast->regs); |
349 | kfree(ast); |
350 | } |
351 | diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c |
352 | index d9c0f7573905..1669c42c40ed 100644 |
353 | --- a/drivers/gpu/drm/drm_auth.c |
354 | +++ b/drivers/gpu/drm/drm_auth.c |
355 | @@ -142,6 +142,7 @@ static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv) |
356 | |
357 | lockdep_assert_held_once(&dev->master_mutex); |
358 | |
359 | + WARN_ON(fpriv->is_master); |
360 | old_master = fpriv->master; |
361 | fpriv->master = drm_master_create(dev); |
362 | if (!fpriv->master) { |
363 | @@ -170,6 +171,7 @@ out_err: |
364 | /* drop references and restore old master on failure */ |
365 | drm_master_put(&fpriv->master); |
366 | fpriv->master = old_master; |
367 | + fpriv->is_master = 0; |
368 | |
369 | return ret; |
370 | } |
371 | diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c |
372 | index 05520202c967..191b314f9e9e 100644 |
373 | --- a/drivers/gpu/drm/meson/meson_crtc.c |
374 | +++ b/drivers/gpu/drm/meson/meson_crtc.c |
375 | @@ -45,6 +45,7 @@ struct meson_crtc { |
376 | struct drm_crtc base; |
377 | struct drm_pending_vblank_event *event; |
378 | struct meson_drm *priv; |
379 | + bool enabled; |
380 | }; |
381 | #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) |
382 | |
383 | @@ -80,8 +81,7 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { |
384 | |
385 | }; |
386 | |
387 | -static void meson_crtc_atomic_enable(struct drm_crtc *crtc, |
388 | - struct drm_crtc_state *old_state) |
389 | +static void meson_crtc_enable(struct drm_crtc *crtc) |
390 | { |
391 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
392 | struct drm_crtc_state *crtc_state = crtc->state; |
393 | @@ -101,6 +101,22 @@ static void meson_crtc_atomic_enable(struct drm_crtc *crtc, |
394 | writel_bits_relaxed(VPP_POSTBLEND_ENABLE, VPP_POSTBLEND_ENABLE, |
395 | priv->io_base + _REG(VPP_MISC)); |
396 | |
397 | + drm_crtc_vblank_on(crtc); |
398 | + |
399 | + meson_crtc->enabled = true; |
400 | +} |
401 | + |
402 | +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, |
403 | + struct drm_crtc_state *old_state) |
404 | +{ |
405 | + struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
406 | + struct meson_drm *priv = meson_crtc->priv; |
407 | + |
408 | + DRM_DEBUG_DRIVER("\n"); |
409 | + |
410 | + if (!meson_crtc->enabled) |
411 | + meson_crtc_enable(crtc); |
412 | + |
413 | priv->viu.osd1_enabled = true; |
414 | } |
415 | |
416 | @@ -110,6 +126,8 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, |
417 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
418 | struct meson_drm *priv = meson_crtc->priv; |
419 | |
420 | + drm_crtc_vblank_off(crtc); |
421 | + |
422 | priv->viu.osd1_enabled = false; |
423 | priv->viu.osd1_commit = false; |
424 | |
425 | @@ -124,6 +142,8 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, |
426 | |
427 | crtc->state->event = NULL; |
428 | } |
429 | + |
430 | + meson_crtc->enabled = false; |
431 | } |
432 | |
433 | static void meson_crtc_atomic_begin(struct drm_crtc *crtc, |
434 | @@ -132,6 +152,9 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, |
435 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
436 | unsigned long flags; |
437 | |
438 | + if (crtc->state->enable && !meson_crtc->enabled) |
439 | + meson_crtc_enable(crtc); |
440 | + |
441 | if (crtc->state->event) { |
442 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); |
443 | |
444 | diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c |
445 | index df7247cd93f9..2cb2ad26d716 100644 |
446 | --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c |
447 | +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c |
448 | @@ -706,6 +706,7 @@ static const struct regmap_config meson_dw_hdmi_regmap_config = { |
449 | .reg_read = meson_dw_hdmi_reg_read, |
450 | .reg_write = meson_dw_hdmi_reg_write, |
451 | .max_register = 0x10000, |
452 | + .fast_io = true, |
453 | }; |
454 | |
455 | static bool meson_hdmi_connector_is_available(struct device *dev) |
456 | diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c |
457 | index 514245e69b38..14aac661f38b 100644 |
458 | --- a/drivers/gpu/drm/meson/meson_venc.c |
459 | +++ b/drivers/gpu/drm/meson/meson_venc.c |
460 | @@ -71,6 +71,7 @@ |
461 | */ |
462 | |
463 | /* HHI Registers */ |
464 | +#define HHI_GCLK_MPEG2 0x148 /* 0x52 offset in data sheet */ |
465 | #define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */ |
466 | #define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ |
467 | #define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 offset in data sheet */ |
468 | @@ -1529,10 +1530,12 @@ unsigned int meson_venci_get_field(struct meson_drm *priv) |
469 | void meson_venc_enable_vsync(struct meson_drm *priv) |
470 | { |
471 | writel_relaxed(2, priv->io_base + _REG(VENC_INTCTRL)); |
472 | + regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); |
473 | } |
474 | |
475 | void meson_venc_disable_vsync(struct meson_drm *priv) |
476 | { |
477 | + regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), 0); |
478 | writel_relaxed(0, priv->io_base + _REG(VENC_INTCTRL)); |
479 | } |
480 | |
481 | diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c |
482 | index 6bcfa527c180..26a0857878bf 100644 |
483 | --- a/drivers/gpu/drm/meson/meson_viu.c |
484 | +++ b/drivers/gpu/drm/meson/meson_viu.c |
485 | @@ -184,18 +184,18 @@ void meson_viu_set_osd_lut(struct meson_drm *priv, enum viu_lut_sel_e lut_sel, |
486 | if (lut_sel == VIU_LUT_OSD_OETF) { |
487 | writel(0, priv->io_base + _REG(addr_port)); |
488 | |
489 | - for (i = 0; i < 20; i++) |
490 | + for (i = 0; i < (OSD_OETF_LUT_SIZE / 2); i++) |
491 | writel(r_map[i * 2] | (r_map[i * 2 + 1] << 16), |
492 | priv->io_base + _REG(data_port)); |
493 | |
494 | writel(r_map[OSD_OETF_LUT_SIZE - 1] | (g_map[0] << 16), |
495 | priv->io_base + _REG(data_port)); |
496 | |
497 | - for (i = 0; i < 20; i++) |
498 | + for (i = 0; i < (OSD_OETF_LUT_SIZE / 2); i++) |
499 | writel(g_map[i * 2 + 1] | (g_map[i * 2 + 2] << 16), |
500 | priv->io_base + _REG(data_port)); |
501 | |
502 | - for (i = 0; i < 20; i++) |
503 | + for (i = 0; i < (OSD_OETF_LUT_SIZE / 2); i++) |
504 | writel(b_map[i * 2] | (b_map[i * 2 + 1] << 16), |
505 | priv->io_base + _REG(data_port)); |
506 | |
507 | @@ -211,18 +211,18 @@ void meson_viu_set_osd_lut(struct meson_drm *priv, enum viu_lut_sel_e lut_sel, |
508 | } else if (lut_sel == VIU_LUT_OSD_EOTF) { |
509 | writel(0, priv->io_base + _REG(addr_port)); |
510 | |
511 | - for (i = 0; i < 20; i++) |
512 | + for (i = 0; i < (OSD_EOTF_LUT_SIZE / 2); i++) |
513 | writel(r_map[i * 2] | (r_map[i * 2 + 1] << 16), |
514 | priv->io_base + _REG(data_port)); |
515 | |
516 | writel(r_map[OSD_EOTF_LUT_SIZE - 1] | (g_map[0] << 16), |
517 | priv->io_base + _REG(data_port)); |
518 | |
519 | - for (i = 0; i < 20; i++) |
520 | + for (i = 0; i < (OSD_EOTF_LUT_SIZE / 2); i++) |
521 | writel(g_map[i * 2 + 1] | (g_map[i * 2 + 2] << 16), |
522 | priv->io_base + _REG(data_port)); |
523 | |
524 | - for (i = 0; i < 20; i++) |
525 | + for (i = 0; i < (OSD_EOTF_LUT_SIZE / 2); i++) |
526 | writel(b_map[i * 2] | (b_map[i * 2 + 1] << 16), |
527 | priv->io_base + _REG(data_port)); |
528 | |
529 | diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
530 | index c414f3809e5c..50be240df331 100644 |
531 | --- a/drivers/infiniband/hw/mlx5/main.c |
532 | +++ b/drivers/infiniband/hw/mlx5/main.c |
533 | @@ -1094,31 +1094,26 @@ enum mlx5_ib_width { |
534 | MLX5_IB_WIDTH_12X = 1 << 4 |
535 | }; |
536 | |
537 | -static int translate_active_width(struct ib_device *ibdev, u8 active_width, |
538 | +static void translate_active_width(struct ib_device *ibdev, u8 active_width, |
539 | u8 *ib_width) |
540 | { |
541 | struct mlx5_ib_dev *dev = to_mdev(ibdev); |
542 | - int err = 0; |
543 | |
544 | - if (active_width & MLX5_IB_WIDTH_1X) { |
545 | + if (active_width & MLX5_IB_WIDTH_1X) |
546 | *ib_width = IB_WIDTH_1X; |
547 | - } else if (active_width & MLX5_IB_WIDTH_2X) { |
548 | - mlx5_ib_dbg(dev, "active_width %d is not supported by IB spec\n", |
549 | - (int)active_width); |
550 | - err = -EINVAL; |
551 | - } else if (active_width & MLX5_IB_WIDTH_4X) { |
552 | + else if (active_width & MLX5_IB_WIDTH_4X) |
553 | *ib_width = IB_WIDTH_4X; |
554 | - } else if (active_width & MLX5_IB_WIDTH_8X) { |
555 | + else if (active_width & MLX5_IB_WIDTH_8X) |
556 | *ib_width = IB_WIDTH_8X; |
557 | - } else if (active_width & MLX5_IB_WIDTH_12X) { |
558 | + else if (active_width & MLX5_IB_WIDTH_12X) |
559 | *ib_width = IB_WIDTH_12X; |
560 | - } else { |
561 | - mlx5_ib_dbg(dev, "Invalid active_width %d\n", |
562 | + else { |
563 | + mlx5_ib_dbg(dev, "Invalid active_width %d, setting width to default value: 4x\n", |
564 | (int)active_width); |
565 | - err = -EINVAL; |
566 | + *ib_width = IB_WIDTH_4X; |
567 | } |
568 | |
569 | - return err; |
570 | + return; |
571 | } |
572 | |
573 | static int mlx5_mtu_to_ib_mtu(int mtu) |
574 | @@ -1225,10 +1220,8 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port, |
575 | if (err) |
576 | goto out; |
577 | |
578 | - err = translate_active_width(ibdev, ib_link_width_oper, |
579 | - &props->active_width); |
580 | - if (err) |
581 | - goto out; |
582 | + translate_active_width(ibdev, ib_link_width_oper, &props->active_width); |
583 | + |
584 | err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port); |
585 | if (err) |
586 | goto out; |
587 | diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c |
588 | index b686a4aaffe8..bee8c0b1d6a5 100644 |
589 | --- a/drivers/infiniband/ulp/iser/iser_verbs.c |
590 | +++ b/drivers/infiniband/ulp/iser/iser_verbs.c |
591 | @@ -1123,7 +1123,9 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, |
592 | IB_MR_CHECK_SIG_STATUS, &mr_status); |
593 | if (ret) { |
594 | pr_err("ib_check_mr_status failed, ret %d\n", ret); |
595 | - goto err; |
596 | + /* Not a lot we can do, return ambiguous guard error */ |
597 | + *sector = 0; |
598 | + return 0x1; |
599 | } |
600 | |
601 | if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { |
602 | @@ -1151,9 +1153,6 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, |
603 | } |
604 | |
605 | return 0; |
606 | -err: |
607 | - /* Not alot we can do here, return ambiguous guard error */ |
608 | - return 0x1; |
609 | } |
610 | |
611 | void iser_err_comp(struct ib_wc *wc, const char *type) |
612 | diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c |
613 | index d4b9db487b16..cfc8b94527b9 100644 |
614 | --- a/drivers/input/joystick/xpad.c |
615 | +++ b/drivers/input/joystick/xpad.c |
616 | @@ -480,18 +480,18 @@ static const u8 xboxone_hori_init[] = { |
617 | }; |
618 | |
619 | /* |
620 | - * This packet is required for some of the PDP pads to start |
621 | + * This packet is required for most (all?) of the PDP pads to start |
622 | * sending input reports. These pads include: (0x0e6f:0x02ab), |
623 | - * (0x0e6f:0x02a4). |
624 | + * (0x0e6f:0x02a4), (0x0e6f:0x02a6). |
625 | */ |
626 | static const u8 xboxone_pdp_init1[] = { |
627 | 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 |
628 | }; |
629 | |
630 | /* |
631 | - * This packet is required for some of the PDP pads to start |
632 | + * This packet is required for most (all?) of the PDP pads to start |
633 | * sending input reports. These pads include: (0x0e6f:0x02ab), |
634 | - * (0x0e6f:0x02a4). |
635 | + * (0x0e6f:0x02a4), (0x0e6f:0x02a6). |
636 | */ |
637 | static const u8 xboxone_pdp_init2[] = { |
638 | 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 |
639 | @@ -527,12 +527,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { |
640 | XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), |
641 | XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), |
642 | XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), |
643 | - XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), |
644 | - XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), |
645 | - XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), |
646 | - XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), |
647 | - XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), |
648 | - XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), |
649 | + XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1), |
650 | + XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2), |
651 | XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), |
652 | XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), |
653 | XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), |
654 | diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c |
655 | index 81be6f781f0b..d56001181598 100644 |
656 | --- a/drivers/input/keyboard/cros_ec_keyb.c |
657 | +++ b/drivers/input/keyboard/cros_ec_keyb.c |
658 | @@ -493,7 +493,8 @@ static int cros_ec_keyb_register_bs(struct cros_ec_keyb *ckdev) |
659 | for (i = 0; i < ARRAY_SIZE(cros_ec_keyb_bs); i++) { |
660 | const struct cros_ec_bs_map *map = &cros_ec_keyb_bs[i]; |
661 | |
662 | - if (buttons & BIT(map->bit)) |
663 | + if ((map->ev_type == EV_KEY && (buttons & BIT(map->bit))) || |
664 | + (map->ev_type == EV_SW && (switches & BIT(map->bit)))) |
665 | input_set_capability(idev, map->ev_type, map->code); |
666 | } |
667 | |
668 | diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c |
669 | index f51ae09596ef..403452ef00e6 100644 |
670 | --- a/drivers/input/keyboard/matrix_keypad.c |
671 | +++ b/drivers/input/keyboard/matrix_keypad.c |
672 | @@ -407,7 +407,7 @@ matrix_keypad_parse_dt(struct device *dev) |
673 | struct matrix_keypad_platform_data *pdata; |
674 | struct device_node *np = dev->of_node; |
675 | unsigned int *gpios; |
676 | - int i, nrow, ncol; |
677 | + int ret, i, nrow, ncol; |
678 | |
679 | if (!np) { |
680 | dev_err(dev, "device lacks DT data\n"); |
681 | @@ -452,12 +452,19 @@ matrix_keypad_parse_dt(struct device *dev) |
682 | return ERR_PTR(-ENOMEM); |
683 | } |
684 | |
685 | - for (i = 0; i < pdata->num_row_gpios; i++) |
686 | - gpios[i] = of_get_named_gpio(np, "row-gpios", i); |
687 | + for (i = 0; i < nrow; i++) { |
688 | + ret = of_get_named_gpio(np, "row-gpios", i); |
689 | + if (ret < 0) |
690 | + return ERR_PTR(ret); |
691 | + gpios[i] = ret; |
692 | + } |
693 | |
694 | - for (i = 0; i < pdata->num_col_gpios; i++) |
695 | - gpios[pdata->num_row_gpios + i] = |
696 | - of_get_named_gpio(np, "col-gpios", i); |
697 | + for (i = 0; i < ncol; i++) { |
698 | + ret = of_get_named_gpio(np, "col-gpios", i); |
699 | + if (ret < 0) |
700 | + return ERR_PTR(ret); |
701 | + gpios[nrow + i] = ret; |
702 | + } |
703 | |
704 | pdata->row_gpios = gpios; |
705 | pdata->col_gpios = &gpios[pdata->num_row_gpios]; |
706 | @@ -484,10 +491,8 @@ static int matrix_keypad_probe(struct platform_device *pdev) |
707 | pdata = dev_get_platdata(&pdev->dev); |
708 | if (!pdata) { |
709 | pdata = matrix_keypad_parse_dt(&pdev->dev); |
710 | - if (IS_ERR(pdata)) { |
711 | - dev_err(&pdev->dev, "no platform data defined\n"); |
712 | + if (IS_ERR(pdata)) |
713 | return PTR_ERR(pdata); |
714 | - } |
715 | } else if (!pdata->keymap_data) { |
716 | dev_err(&pdev->dev, "no keymap data defined\n"); |
717 | return -EINVAL; |
718 | diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
719 | index b0f9d19b3410..a94b6494e71a 100644 |
720 | --- a/drivers/input/mouse/elan_i2c_core.c |
721 | +++ b/drivers/input/mouse/elan_i2c_core.c |
722 | @@ -1348,6 +1348,9 @@ static const struct acpi_device_id elan_acpi_id[] = { |
723 | { "ELAN0618", 0 }, |
724 | { "ELAN061C", 0 }, |
725 | { "ELAN061D", 0 }, |
726 | + { "ELAN061E", 0 }, |
727 | + { "ELAN0620", 0 }, |
728 | + { "ELAN0621", 0 }, |
729 | { "ELAN0622", 0 }, |
730 | { "ELAN1000", 0 }, |
731 | { } |
732 | diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c |
733 | index 5e85f3cca867..c42813d50591 100644 |
734 | --- a/drivers/input/mouse/synaptics.c |
735 | +++ b/drivers/input/mouse/synaptics.c |
736 | @@ -170,6 +170,7 @@ static const char * const smbus_pnp_ids[] = { |
737 | "LEN0048", /* X1 Carbon 3 */ |
738 | "LEN0046", /* X250 */ |
739 | "LEN004a", /* W541 */ |
740 | + "LEN005b", /* P50 */ |
741 | "LEN0071", /* T480 */ |
742 | "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ |
743 | "LEN0073", /* X1 Carbon G5 (Elantech) */ |
744 | diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c |
745 | index 56cde38b92c0..044adf913854 100644 |
746 | --- a/drivers/mtd/nand/bbt.c |
747 | +++ b/drivers/mtd/nand/bbt.c |
748 | @@ -27,7 +27,8 @@ int nanddev_bbt_init(struct nand_device *nand) |
749 | unsigned int nwords = DIV_ROUND_UP(nblocks * bits_per_block, |
750 | BITS_PER_LONG); |
751 | |
752 | - nand->bbt.cache = kzalloc(nwords, GFP_KERNEL); |
753 | + nand->bbt.cache = kcalloc(nwords, sizeof(*nand->bbt.cache), |
754 | + GFP_KERNEL); |
755 | if (!nand->bbt.cache) |
756 | return -ENOMEM; |
757 | |
758 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
759 | index 6eccfa82ca94..3c342700bf5f 100644 |
760 | --- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
761 | +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
762 | @@ -1409,7 +1409,7 @@ void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f) |
763 | } |
764 | |
765 | vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED; |
766 | - set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->state); |
767 | + set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state); |
768 | } |
769 | |
770 | /** |
771 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
772 | index f3cae733ae2d..9acb5b44ce4c 100644 |
773 | --- a/drivers/scsi/lpfc/lpfc_init.c |
774 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
775 | @@ -167,7 +167,11 @@ lpfc_config_port_prep(struct lpfc_hba *phba) |
776 | sizeof(phba->wwpn)); |
777 | } |
778 | |
779 | - phba->sli3_options = 0x0; |
780 | + /* |
781 | + * Clear all option bits except LPFC_SLI3_BG_ENABLED, |
782 | + * which was already set in lpfc_get_cfgparam() |
783 | + */ |
784 | + phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; |
785 | |
786 | /* Setup and issue mailbox READ REV command */ |
787 | lpfc_read_rev(phba, pmb); |
788 | diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
789 | index a95c823cd1a4..be2bac9355cd 100644 |
790 | --- a/drivers/scsi/lpfc/lpfc_sli.c |
791 | +++ b/drivers/scsi/lpfc/lpfc_sli.c |
792 | @@ -4969,7 +4969,6 @@ lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode) |
793 | phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | |
794 | LPFC_SLI3_HBQ_ENABLED | |
795 | LPFC_SLI3_CRP_ENABLED | |
796 | - LPFC_SLI3_BG_ENABLED | |
797 | LPFC_SLI3_DSS_ENABLED); |
798 | if (rc != MBX_SUCCESS) { |
799 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
800 | diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c |
801 | index f4d0ef695225..8a111ab33b50 100644 |
802 | --- a/drivers/tty/serial/kgdboc.c |
803 | +++ b/drivers/tty/serial/kgdboc.c |
804 | @@ -128,24 +128,6 @@ static void kgdboc_unregister_kbd(void) |
805 | #define kgdboc_restore_input() |
806 | #endif /* ! CONFIG_KDB_KEYBOARD */ |
807 | |
808 | -static int kgdboc_option_setup(char *opt) |
809 | -{ |
810 | - if (!opt) { |
811 | - pr_err("kgdboc: config string not provided\n"); |
812 | - return -EINVAL; |
813 | - } |
814 | - |
815 | - if (strlen(opt) >= MAX_CONFIG_LEN) { |
816 | - printk(KERN_ERR "kgdboc: config string too long\n"); |
817 | - return -ENOSPC; |
818 | - } |
819 | - strcpy(config, opt); |
820 | - |
821 | - return 0; |
822 | -} |
823 | - |
824 | -__setup("kgdboc=", kgdboc_option_setup); |
825 | - |
826 | static void cleanup_kgdboc(void) |
827 | { |
828 | if (kgdb_unregister_nmi_console()) |
829 | @@ -159,15 +141,13 @@ static int configure_kgdboc(void) |
830 | { |
831 | struct tty_driver *p; |
832 | int tty_line = 0; |
833 | - int err; |
834 | + int err = -ENODEV; |
835 | char *cptr = config; |
836 | struct console *cons; |
837 | |
838 | - err = kgdboc_option_setup(config); |
839 | - if (err || !strlen(config) || isspace(config[0])) |
840 | + if (!strlen(config) || isspace(config[0])) |
841 | goto noconfig; |
842 | |
843 | - err = -ENODEV; |
844 | kgdboc_io_ops.is_console = 0; |
845 | kgdb_tty_driver = NULL; |
846 | |
847 | @@ -316,6 +296,25 @@ static struct kgdb_io kgdboc_io_ops = { |
848 | }; |
849 | |
850 | #ifdef CONFIG_KGDB_SERIAL_CONSOLE |
851 | +static int kgdboc_option_setup(char *opt) |
852 | +{ |
853 | + if (!opt) { |
854 | + pr_err("config string not provided\n"); |
855 | + return -EINVAL; |
856 | + } |
857 | + |
858 | + if (strlen(opt) >= MAX_CONFIG_LEN) { |
859 | + pr_err("config string too long\n"); |
860 | + return -ENOSPC; |
861 | + } |
862 | + strcpy(config, opt); |
863 | + |
864 | + return 0; |
865 | +} |
866 | + |
867 | +__setup("kgdboc=", kgdboc_option_setup); |
868 | + |
869 | + |
870 | /* This is only available if kgdboc is a built in for early debugging */ |
871 | static int __init kgdboc_early_init(char *opt) |
872 | { |
873 | diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c |
874 | index d385778b628c..3ec712cba58e 100644 |
875 | --- a/fs/btrfs/tree-checker.c |
876 | +++ b/fs/btrfs/tree-checker.c |
877 | @@ -389,13 +389,11 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info, |
878 | |
879 | /* |
880 | * Here we don't really care about alignment since extent allocator can |
881 | - * handle it. We care more about the size, as if one block group is |
882 | - * larger than maximum size, it's must be some obvious corruption. |
883 | + * handle it. We care more about the size. |
884 | */ |
885 | - if (key->offset > BTRFS_MAX_DATA_CHUNK_SIZE || key->offset == 0) { |
886 | + if (key->offset == 0) { |
887 | block_group_err(fs_info, leaf, slot, |
888 | - "invalid block group size, have %llu expect (0, %llu]", |
889 | - key->offset, BTRFS_MAX_DATA_CHUNK_SIZE); |
890 | + "invalid block group size 0"); |
891 | return -EUCLEAN; |
892 | } |
893 | |
894 | diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h |
895 | index 538ba1a58f5b..e9de8ad0bad7 100644 |
896 | --- a/include/linux/tracepoint.h |
897 | +++ b/include/linux/tracepoint.h |
898 | @@ -166,7 +166,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) |
899 | struct tracepoint_func *it_func_ptr; \ |
900 | void *it_func; \ |
901 | void *__data; \ |
902 | - int __maybe_unused idx = 0; \ |
903 | + int __maybe_unused __idx = 0; \ |
904 | \ |
905 | if (!(cond)) \ |
906 | return; \ |
907 | @@ -182,7 +182,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) |
908 | * doesn't work from the idle path. \ |
909 | */ \ |
910 | if (rcuidle) { \ |
911 | - idx = srcu_read_lock_notrace(&tracepoint_srcu); \ |
912 | + __idx = srcu_read_lock_notrace(&tracepoint_srcu);\ |
913 | rcu_irq_enter_irqson(); \ |
914 | } \ |
915 | \ |
916 | @@ -198,7 +198,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) |
917 | \ |
918 | if (rcuidle) { \ |
919 | rcu_irq_exit_irqson(); \ |
920 | - srcu_read_unlock_notrace(&tracepoint_srcu, idx);\ |
921 | + srcu_read_unlock_notrace(&tracepoint_srcu, __idx);\ |
922 | } \ |
923 | \ |
924 | preempt_enable_notrace(); \ |
925 | diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h |
926 | index 0be866c91f62..5e1a7578c9ed 100644 |
927 | --- a/include/trace/events/sched.h |
928 | +++ b/include/trace/events/sched.h |
929 | @@ -107,6 +107,8 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
930 | #ifdef CREATE_TRACE_POINTS |
931 | static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p) |
932 | { |
933 | + unsigned int state; |
934 | + |
935 | #ifdef CONFIG_SCHED_DEBUG |
936 | BUG_ON(p != current); |
937 | #endif /* CONFIG_SCHED_DEBUG */ |
938 | @@ -118,7 +120,15 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * |
939 | if (preempt) |
940 | return TASK_REPORT_MAX; |
941 | |
942 | - return 1 << task_state_index(p); |
943 | + /* |
944 | + * task_state_index() uses fls() and returns a value from 0-8 range. |
945 | + * Decrement it by 1 (except TASK_RUNNING state i.e 0) before using |
946 | + * it for left shift operation to get the correct task->state |
947 | + * mapping. |
948 | + */ |
949 | + state = task_state_index(p); |
950 | + |
951 | + return state ? (1 << (state - 1)) : state; |
952 | } |
953 | #endif /* CREATE_TRACE_POINTS */ |
954 | |
955 | diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c |
956 | index 3207a4d26849..578d4ac54484 100644 |
957 | --- a/kernel/events/uprobes.c |
958 | +++ b/kernel/events/uprobes.c |
959 | @@ -616,7 +616,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, |
960 | BUG_ON((uprobe->offset & ~PAGE_MASK) + |
961 | UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); |
962 | |
963 | - smp_wmb(); /* pairs with rmb() in find_active_uprobe() */ |
964 | + smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */ |
965 | set_bit(UPROBE_COPY_INSN, &uprobe->flags); |
966 | |
967 | out: |
968 | @@ -1914,10 +1914,18 @@ static void handle_swbp(struct pt_regs *regs) |
969 | * After we hit the bp, _unregister + _register can install the |
970 | * new and not-yet-analyzed uprobe at the same address, restart. |
971 | */ |
972 | - smp_rmb(); /* pairs with wmb() in install_breakpoint() */ |
973 | if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags))) |
974 | goto out; |
975 | |
976 | + /* |
977 | + * Pairs with the smp_wmb() in prepare_uprobe(). |
978 | + * |
979 | + * Guarantees that if we see the UPROBE_COPY_INSN bit set, then |
980 | + * we must also see the stores to &uprobe->arch performed by the |
981 | + * prepare_uprobe() call. |
982 | + */ |
983 | + smp_rmb(); |
984 | + |
985 | /* Tracing handlers use ->utask to communicate with fetch methods */ |
986 | if (!get_utask()) |
987 | goto out; |
988 | diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
989 | index 3b8c0e24ab30..447bd96ee658 100644 |
990 | --- a/kernel/trace/trace.h |
991 | +++ b/kernel/trace/trace.h |
992 | @@ -512,12 +512,44 @@ enum { |
993 | * can only be modified by current, we can reuse trace_recursion. |
994 | */ |
995 | TRACE_IRQ_BIT, |
996 | + |
997 | + /* Set if the function is in the set_graph_function file */ |
998 | + TRACE_GRAPH_BIT, |
999 | + |
1000 | + /* |
1001 | + * In the very unlikely case that an interrupt came in |
1002 | + * at a start of graph tracing, and we want to trace |
1003 | + * the function in that interrupt, the depth can be greater |
1004 | + * than zero, because of the preempted start of a previous |
1005 | + * trace. In an even more unlikely case, depth could be 2 |
1006 | + * if a softirq interrupted the start of graph tracing, |
1007 | + * followed by an interrupt preempting a start of graph |
1008 | + * tracing in the softirq, and depth can even be 3 |
1009 | + * if an NMI came in at the start of an interrupt function |
1010 | + * that preempted a softirq start of a function that |
1011 | + * preempted normal context!!!! Luckily, it can't be |
1012 | + * greater than 3, so the next two bits are a mask |
1013 | + * of what the depth is when we set TRACE_GRAPH_BIT |
1014 | + */ |
1015 | + |
1016 | + TRACE_GRAPH_DEPTH_START_BIT, |
1017 | + TRACE_GRAPH_DEPTH_END_BIT, |
1018 | }; |
1019 | |
1020 | #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0) |
1021 | #define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(1<<(bit)); } while (0) |
1022 | #define trace_recursion_test(bit) ((current)->trace_recursion & (1<<(bit))) |
1023 | |
1024 | +#define trace_recursion_depth() \ |
1025 | + (((current)->trace_recursion >> TRACE_GRAPH_DEPTH_START_BIT) & 3) |
1026 | +#define trace_recursion_set_depth(depth) \ |
1027 | + do { \ |
1028 | + current->trace_recursion &= \ |
1029 | + ~(3 << TRACE_GRAPH_DEPTH_START_BIT); \ |
1030 | + current->trace_recursion |= \ |
1031 | + ((depth) & 3) << TRACE_GRAPH_DEPTH_START_BIT; \ |
1032 | + } while (0) |
1033 | + |
1034 | #define TRACE_CONTEXT_BITS 4 |
1035 | |
1036 | #define TRACE_FTRACE_START TRACE_FTRACE_BIT |
1037 | @@ -843,8 +875,9 @@ extern void __trace_graph_return(struct trace_array *tr, |
1038 | extern struct ftrace_hash *ftrace_graph_hash; |
1039 | extern struct ftrace_hash *ftrace_graph_notrace_hash; |
1040 | |
1041 | -static inline int ftrace_graph_addr(unsigned long addr) |
1042 | +static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) |
1043 | { |
1044 | + unsigned long addr = trace->func; |
1045 | int ret = 0; |
1046 | |
1047 | preempt_disable_notrace(); |
1048 | @@ -855,6 +888,14 @@ static inline int ftrace_graph_addr(unsigned long addr) |
1049 | } |
1050 | |
1051 | if (ftrace_lookup_ip(ftrace_graph_hash, addr)) { |
1052 | + |
1053 | + /* |
1054 | + * This needs to be cleared on the return functions |
1055 | + * when the depth is zero. |
1056 | + */ |
1057 | + trace_recursion_set(TRACE_GRAPH_BIT); |
1058 | + trace_recursion_set_depth(trace->depth); |
1059 | + |
1060 | /* |
1061 | * If no irqs are to be traced, but a set_graph_function |
1062 | * is set, and called by an interrupt handler, we still |
1063 | @@ -872,6 +913,13 @@ out: |
1064 | return ret; |
1065 | } |
1066 | |
1067 | +static inline void ftrace_graph_addr_finish(struct ftrace_graph_ret *trace) |
1068 | +{ |
1069 | + if (trace_recursion_test(TRACE_GRAPH_BIT) && |
1070 | + trace->depth == trace_recursion_depth()) |
1071 | + trace_recursion_clear(TRACE_GRAPH_BIT); |
1072 | +} |
1073 | + |
1074 | static inline int ftrace_graph_notrace_addr(unsigned long addr) |
1075 | { |
1076 | int ret = 0; |
1077 | @@ -885,7 +933,7 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr) |
1078 | return ret; |
1079 | } |
1080 | #else |
1081 | -static inline int ftrace_graph_addr(unsigned long addr) |
1082 | +static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) |
1083 | { |
1084 | return 1; |
1085 | } |
1086 | @@ -894,6 +942,8 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr) |
1087 | { |
1088 | return 0; |
1089 | } |
1090 | +static inline void ftrace_graph_addr_finish(struct ftrace_graph_ret *trace) |
1091 | +{ } |
1092 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
1093 | |
1094 | extern unsigned int fgraph_max_depth; |
1095 | @@ -901,7 +951,8 @@ extern unsigned int fgraph_max_depth; |
1096 | static inline bool ftrace_graph_ignore_func(struct ftrace_graph_ent *trace) |
1097 | { |
1098 | /* trace it when it is-nested-in or is a function enabled. */ |
1099 | - return !(trace->depth || ftrace_graph_addr(trace->func)) || |
1100 | + return !(trace_recursion_test(TRACE_GRAPH_BIT) || |
1101 | + ftrace_graph_addr(trace)) || |
1102 | (trace->depth < 0) || |
1103 | (fgraph_max_depth && trace->depth >= fgraph_max_depth); |
1104 | } |
1105 | diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c |
1106 | index 2561460d7baf..086af4f5c3e8 100644 |
1107 | --- a/kernel/trace/trace_functions_graph.c |
1108 | +++ b/kernel/trace/trace_functions_graph.c |
1109 | @@ -509,6 +509,8 @@ void trace_graph_return(struct ftrace_graph_ret *trace) |
1110 | int cpu; |
1111 | int pc; |
1112 | |
1113 | + ftrace_graph_addr_finish(trace); |
1114 | + |
1115 | local_irq_save(flags); |
1116 | cpu = raw_smp_processor_id(); |
1117 | data = per_cpu_ptr(tr->trace_buffer.data, cpu); |
1118 | @@ -532,6 +534,8 @@ void set_graph_array(struct trace_array *tr) |
1119 | |
1120 | static void trace_graph_thresh_return(struct ftrace_graph_ret *trace) |
1121 | { |
1122 | + ftrace_graph_addr_finish(trace); |
1123 | + |
1124 | if (tracing_thresh && |
1125 | (trace->rettime - trace->calltime < tracing_thresh)) |
1126 | return; |
1127 | diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c |
1128 | index b7357f9f82a3..98ea6d28df15 100644 |
1129 | --- a/kernel/trace/trace_irqsoff.c |
1130 | +++ b/kernel/trace/trace_irqsoff.c |
1131 | @@ -208,6 +208,8 @@ static void irqsoff_graph_return(struct ftrace_graph_ret *trace) |
1132 | unsigned long flags; |
1133 | int pc; |
1134 | |
1135 | + ftrace_graph_addr_finish(trace); |
1136 | + |
1137 | if (!func_prolog_dec(tr, &data, &flags)) |
1138 | return; |
1139 | |
1140 | diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c |
1141 | index a86b303e6c67..7d04b9890755 100644 |
1142 | --- a/kernel/trace/trace_sched_wakeup.c |
1143 | +++ b/kernel/trace/trace_sched_wakeup.c |
1144 | @@ -270,6 +270,8 @@ static void wakeup_graph_return(struct ftrace_graph_ret *trace) |
1145 | unsigned long flags; |
1146 | int pc; |
1147 | |
1148 | + ftrace_graph_addr_finish(trace); |
1149 | + |
1150 | if (!func_prolog_preempt_disable(tr, &data, &pc)) |
1151 | return; |
1152 | |
1153 | diff --git a/lib/test_hexdump.c b/lib/test_hexdump.c |
1154 | index 626f580b4ff7..5144899d3c6b 100644 |
1155 | --- a/lib/test_hexdump.c |
1156 | +++ b/lib/test_hexdump.c |
1157 | @@ -99,7 +99,7 @@ static void __init test_hexdump_prepare_test(size_t len, int rowsize, |
1158 | const char *q = *result++; |
1159 | size_t amount = strlen(q); |
1160 | |
1161 | - strncpy(p, q, amount); |
1162 | + memcpy(p, q, amount); |
1163 | p += amount; |
1164 | |
1165 | *p++ = ' '; |
1166 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
1167 | index 1931a3d9b282..309fb8c969af 100644 |
1168 | --- a/mm/hugetlb.c |
1169 | +++ b/mm/hugetlb.c |
1170 | @@ -4080,7 +4080,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, |
1171 | |
1172 | /* fallback to copy_from_user outside mmap_sem */ |
1173 | if (unlikely(ret)) { |
1174 | - ret = -EFAULT; |
1175 | + ret = -ENOENT; |
1176 | *pagep = page; |
1177 | /* don't free the page */ |
1178 | goto out; |
1179 | diff --git a/mm/shmem.c b/mm/shmem.c |
1180 | index 0b02b539072e..b6cf0e8e685b 100644 |
1181 | --- a/mm/shmem.c |
1182 | +++ b/mm/shmem.c |
1183 | @@ -2264,6 +2264,7 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
1184 | struct page *page; |
1185 | pte_t _dst_pte, *dst_pte; |
1186 | int ret; |
1187 | + pgoff_t offset, max_off; |
1188 | |
1189 | ret = -ENOMEM; |
1190 | if (!shmem_inode_acct_block(inode, 1)) |
1191 | @@ -2286,7 +2287,7 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
1192 | *pagep = page; |
1193 | shmem_inode_unacct_blocks(inode, 1); |
1194 | /* don't free the page */ |
1195 | - return -EFAULT; |
1196 | + return -ENOENT; |
1197 | } |
1198 | } else { /* mfill_zeropage_atomic */ |
1199 | clear_highpage(page); |
1200 | @@ -2301,6 +2302,12 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
1201 | __SetPageSwapBacked(page); |
1202 | __SetPageUptodate(page); |
1203 | |
1204 | + ret = -EFAULT; |
1205 | + offset = linear_page_index(dst_vma, dst_addr); |
1206 | + max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); |
1207 | + if (unlikely(offset >= max_off)) |
1208 | + goto out_release; |
1209 | + |
1210 | ret = mem_cgroup_try_charge_delay(page, dst_mm, gfp, &memcg, false); |
1211 | if (ret) |
1212 | goto out_release; |
1213 | @@ -2318,9 +2325,25 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
1214 | _dst_pte = mk_pte(page, dst_vma->vm_page_prot); |
1215 | if (dst_vma->vm_flags & VM_WRITE) |
1216 | _dst_pte = pte_mkwrite(pte_mkdirty(_dst_pte)); |
1217 | + else { |
1218 | + /* |
1219 | + * We don't set the pte dirty if the vma has no |
1220 | + * VM_WRITE permission, so mark the page dirty or it |
1221 | + * could be freed from under us. We could do it |
1222 | + * unconditionally before unlock_page(), but doing it |
1223 | + * only if VM_WRITE is not set is faster. |
1224 | + */ |
1225 | + set_page_dirty(page); |
1226 | + } |
1227 | |
1228 | - ret = -EEXIST; |
1229 | dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl); |
1230 | + |
1231 | + ret = -EFAULT; |
1232 | + max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); |
1233 | + if (unlikely(offset >= max_off)) |
1234 | + goto out_release_uncharge_unlock; |
1235 | + |
1236 | + ret = -EEXIST; |
1237 | if (!pte_none(*dst_pte)) |
1238 | goto out_release_uncharge_unlock; |
1239 | |
1240 | @@ -2338,13 +2361,15 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, |
1241 | |
1242 | /* No need to invalidate - it was non-present before */ |
1243 | update_mmu_cache(dst_vma, dst_addr, dst_pte); |
1244 | - unlock_page(page); |
1245 | pte_unmap_unlock(dst_pte, ptl); |
1246 | + unlock_page(page); |
1247 | ret = 0; |
1248 | out: |
1249 | return ret; |
1250 | out_release_uncharge_unlock: |
1251 | pte_unmap_unlock(dst_pte, ptl); |
1252 | + ClearPageDirty(page); |
1253 | + delete_from_page_cache(page); |
1254 | out_release_uncharge: |
1255 | mem_cgroup_cancel_charge(page, memcg, false); |
1256 | out_release: |
1257 | diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c |
1258 | index f0af11b1cdf3..458acda96f20 100644 |
1259 | --- a/mm/userfaultfd.c |
1260 | +++ b/mm/userfaultfd.c |
1261 | @@ -33,6 +33,8 @@ static int mcopy_atomic_pte(struct mm_struct *dst_mm, |
1262 | void *page_kaddr; |
1263 | int ret; |
1264 | struct page *page; |
1265 | + pgoff_t offset, max_off; |
1266 | + struct inode *inode; |
1267 | |
1268 | if (!*pagep) { |
1269 | ret = -ENOMEM; |
1270 | @@ -48,7 +50,7 @@ static int mcopy_atomic_pte(struct mm_struct *dst_mm, |
1271 | |
1272 | /* fallback to copy_from_user outside mmap_sem */ |
1273 | if (unlikely(ret)) { |
1274 | - ret = -EFAULT; |
1275 | + ret = -ENOENT; |
1276 | *pagep = page; |
1277 | /* don't free the page */ |
1278 | goto out; |
1279 | @@ -73,8 +75,17 @@ static int mcopy_atomic_pte(struct mm_struct *dst_mm, |
1280 | if (dst_vma->vm_flags & VM_WRITE) |
1281 | _dst_pte = pte_mkwrite(pte_mkdirty(_dst_pte)); |
1282 | |
1283 | - ret = -EEXIST; |
1284 | dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl); |
1285 | + if (dst_vma->vm_file) { |
1286 | + /* the shmem MAP_PRIVATE case requires checking the i_size */ |
1287 | + inode = dst_vma->vm_file->f_inode; |
1288 | + offset = linear_page_index(dst_vma, dst_addr); |
1289 | + max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); |
1290 | + ret = -EFAULT; |
1291 | + if (unlikely(offset >= max_off)) |
1292 | + goto out_release_uncharge_unlock; |
1293 | + } |
1294 | + ret = -EEXIST; |
1295 | if (!pte_none(*dst_pte)) |
1296 | goto out_release_uncharge_unlock; |
1297 | |
1298 | @@ -108,11 +119,22 @@ static int mfill_zeropage_pte(struct mm_struct *dst_mm, |
1299 | pte_t _dst_pte, *dst_pte; |
1300 | spinlock_t *ptl; |
1301 | int ret; |
1302 | + pgoff_t offset, max_off; |
1303 | + struct inode *inode; |
1304 | |
1305 | _dst_pte = pte_mkspecial(pfn_pte(my_zero_pfn(dst_addr), |
1306 | dst_vma->vm_page_prot)); |
1307 | - ret = -EEXIST; |
1308 | dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl); |
1309 | + if (dst_vma->vm_file) { |
1310 | + /* the shmem MAP_PRIVATE case requires checking the i_size */ |
1311 | + inode = dst_vma->vm_file->f_inode; |
1312 | + offset = linear_page_index(dst_vma, dst_addr); |
1313 | + max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); |
1314 | + ret = -EFAULT; |
1315 | + if (unlikely(offset >= max_off)) |
1316 | + goto out_unlock; |
1317 | + } |
1318 | + ret = -EEXIST; |
1319 | if (!pte_none(*dst_pte)) |
1320 | goto out_unlock; |
1321 | set_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte); |
1322 | @@ -275,7 +297,7 @@ retry: |
1323 | |
1324 | cond_resched(); |
1325 | |
1326 | - if (unlikely(err == -EFAULT)) { |
1327 | + if (unlikely(err == -ENOENT)) { |
1328 | up_read(&dst_mm->mmap_sem); |
1329 | BUG_ON(!page); |
1330 | |
1331 | @@ -381,7 +403,17 @@ static __always_inline ssize_t mfill_atomic_pte(struct mm_struct *dst_mm, |
1332 | { |
1333 | ssize_t err; |
1334 | |
1335 | - if (vma_is_anonymous(dst_vma)) { |
1336 | + /* |
1337 | + * The normal page fault path for a shmem will invoke the |
1338 | + * fault, fill the hole in the file and COW it right away. The |
1339 | + * result generates plain anonymous memory. So when we are |
1340 | + * asked to fill an hole in a MAP_PRIVATE shmem mapping, we'll |
1341 | + * generate anonymous memory directly without actually filling |
1342 | + * the hole. For the MAP_PRIVATE case the robustness check |
1343 | + * only happens in the pagetable (to verify it's still none) |
1344 | + * and not in the radix tree. |
1345 | + */ |
1346 | + if (!(dst_vma->vm_flags & VM_SHARED)) { |
1347 | if (!zeropage) |
1348 | err = mcopy_atomic_pte(dst_mm, dst_pmd, dst_vma, |
1349 | dst_addr, src_addr, page); |
1350 | @@ -486,7 +518,8 @@ retry: |
1351 | * dst_vma. |
1352 | */ |
1353 | err = -ENOMEM; |
1354 | - if (vma_is_anonymous(dst_vma) && unlikely(anon_vma_prepare(dst_vma))) |
1355 | + if (!(dst_vma->vm_flags & VM_SHARED) && |
1356 | + unlikely(anon_vma_prepare(dst_vma))) |
1357 | goto out_unlock; |
1358 | |
1359 | while (src_addr < src_start + len) { |
1360 | @@ -527,7 +560,7 @@ retry: |
1361 | src_addr, &page, zeropage); |
1362 | cond_resched(); |
1363 | |
1364 | - if (unlikely(err == -EFAULT)) { |
1365 | + if (unlikely(err == -ENOENT)) { |
1366 | void *page_kaddr; |
1367 | |
1368 | up_read(&dst_mm->mmap_sem); |
1369 | diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c |
1370 | index 2627b5d812e9..b84c0059214f 100644 |
1371 | --- a/net/tipc/topsrv.c |
1372 | +++ b/net/tipc/topsrv.c |
1373 | @@ -657,7 +657,7 @@ int tipc_topsrv_start(struct net *net) |
1374 | srv->max_rcvbuf_size = sizeof(struct tipc_subscr); |
1375 | INIT_WORK(&srv->awork, tipc_topsrv_accept); |
1376 | |
1377 | - strncpy(srv->name, name, strlen(name) + 1); |
1378 | + strscpy(srv->name, name, sizeof(srv->name)); |
1379 | tn->topsrv = srv; |
1380 | atomic_set(&tn->subscription_count, 0); |
1381 | |
1382 | diff --git a/scripts/unifdef.c b/scripts/unifdef.c |
1383 | index 7493c0ee51cc..db00e3e30a59 100644 |
1384 | --- a/scripts/unifdef.c |
1385 | +++ b/scripts/unifdef.c |
1386 | @@ -395,7 +395,7 @@ usage(void) |
1387 | * When we have processed a group that starts off with a known-false |
1388 | * #if/#elif sequence (which has therefore been deleted) followed by a |
1389 | * #elif that we don't understand and therefore must keep, we edit the |
1390 | - * latter into a #if to keep the nesting correct. We use strncpy() to |
1391 | + * latter into a #if to keep the nesting correct. We use memcpy() to |
1392 | * overwrite the 4 byte token "elif" with "if " without a '\0' byte. |
1393 | * |
1394 | * When we find a true #elif in a group, the following block will |
1395 | @@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop(); ignoreon(); } |
1396 | static void Itrue (void) { Ftrue(); ignoreon(); } |
1397 | static void Ifalse(void) { Ffalse(); ignoreon(); } |
1398 | /* modify this line */ |
1399 | -static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } |
1400 | +static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); } |
1401 | static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); } |
1402 | static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); } |
1403 | static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); } |
1404 | diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c |
1405 | index 74b951f55608..9cec81209617 100644 |
1406 | --- a/security/selinux/nlmsgtab.c |
1407 | +++ b/security/selinux/nlmsgtab.c |
1408 | @@ -80,6 +80,9 @@ static const struct nlmsg_perm nlmsg_route_perms[] = |
1409 | { RTM_NEWSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
1410 | { RTM_GETSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
1411 | { RTM_NEWCACHEREPORT, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
1412 | + { RTM_NEWCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
1413 | + { RTM_DELCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
1414 | + { RTM_GETCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
1415 | }; |
1416 | |
1417 | static const struct nlmsg_perm nlmsg_tcpdiag_perms[] = |
1418 | @@ -158,7 +161,11 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm) |
1419 | |
1420 | switch (sclass) { |
1421 | case SECCLASS_NETLINK_ROUTE_SOCKET: |
1422 | - /* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */ |
1423 | + /* RTM_MAX always points to RTM_SETxxxx, ie RTM_NEWxxx + 3. |
1424 | + * If the BUILD_BUG_ON() below fails you must update the |
1425 | + * structures at the top of this file with the new mappings |
1426 | + * before updating the BUILD_BUG_ON() macro! |
1427 | + */ |
1428 | BUILD_BUG_ON(RTM_MAX != (RTM_NEWCHAIN + 3)); |
1429 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms, |
1430 | sizeof(nlmsg_route_perms)); |
1431 | @@ -170,6 +177,10 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm) |
1432 | break; |
1433 | |
1434 | case SECCLASS_NETLINK_XFRM_SOCKET: |
1435 | + /* If the BUILD_BUG_ON() below fails you must update the |
1436 | + * structures at the top of this file with the new mappings |
1437 | + * before updating the BUILD_BUG_ON() macro! |
1438 | + */ |
1439 | BUILD_BUG_ON(XFRM_MSG_MAX != XFRM_MSG_MAPPING); |
1440 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms, |
1441 | sizeof(nlmsg_xfrm_perms)); |