Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sat, 29 Sep 2018 13:35:46
Message-Id: 1538228119.7ecc929baefbf40295eeec0c6de3dda1343a74df.mpagano@gentoo
1 commit: 7ecc929baefbf40295eeec0c6de3dda1343a74df
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 29 13:35:19 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 29 13:35:19 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7ecc929b
7
8 Linux patch 4.14.73
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1072_linux-4.14.73.patch | 1830 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1834 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index ce833af..08015af 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -331,6 +331,10 @@ Patch: 1071_linux-4.14.72.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.14.72
23
24 +Patch: 1072_linux-4.14.73.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.14.73
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1072_linux-4.14.73.patch b/1072_linux-4.14.73.patch
33 new file mode 100644
34 index 0000000..9020dd3
35 --- /dev/null
36 +++ b/1072_linux-4.14.73.patch
37 @@ -0,0 +1,1830 @@
38 +diff --git a/Makefile b/Makefile
39 +index 734722bda173..89f30ca964b6 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 72
47 ++SUBLEVEL = 73
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c
52 +index 7d00d4ad44d4..95997e6c0696 100644
53 +--- a/arch/x86/xen/pmu.c
54 ++++ b/arch/x86/xen/pmu.c
55 +@@ -478,7 +478,7 @@ static void xen_convert_regs(const struct xen_pmu_regs *xen_regs,
56 + irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)
57 + {
58 + int err, ret = IRQ_NONE;
59 +- struct pt_regs regs;
60 ++ struct pt_regs regs = {0};
61 + const struct xen_pmu_data *xenpmu_data = get_xenpmu_data();
62 + uint8_t xenpmu_flags = get_xenpmu_flags();
63 +
64 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
65 +index fd435a96481c..e8d9479615c9 100644
66 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
67 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
68 +@@ -715,12 +715,14 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
69 + break;
70 + case CHIP_POLARIS10:
71 + if (type == CGS_UCODE_ID_SMU) {
72 +- if ((adev->pdev->device == 0x67df) &&
73 +- ((adev->pdev->revision == 0xe0) ||
74 +- (adev->pdev->revision == 0xe3) ||
75 +- (adev->pdev->revision == 0xe4) ||
76 +- (adev->pdev->revision == 0xe5) ||
77 +- (adev->pdev->revision == 0xe7) ||
78 ++ if (((adev->pdev->device == 0x67df) &&
79 ++ ((adev->pdev->revision == 0xe0) ||
80 ++ (adev->pdev->revision == 0xe3) ||
81 ++ (adev->pdev->revision == 0xe4) ||
82 ++ (adev->pdev->revision == 0xe5) ||
83 ++ (adev->pdev->revision == 0xe7) ||
84 ++ (adev->pdev->revision == 0xef))) ||
85 ++ ((adev->pdev->device == 0x6fdf) &&
86 + (adev->pdev->revision == 0xef))) {
87 + info->is_kicker = true;
88 + strcpy(fw_name, "amdgpu/polaris10_k_smc.bin");
89 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
90 +index 0f16986ec5bc..4dd68d821353 100644
91 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
92 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
93 +@@ -500,6 +500,7 @@ static const struct pci_device_id pciidlist[] = {
94 + {0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
95 + {0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
96 + {0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
97 ++ {0x1002, 0x6FDF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
98 + /* Polaris12 */
99 + {0x1002, 0x6980, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
100 + {0x1002, 0x6981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
101 +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
102 +index 430830d63a33..2c6d19683688 100644
103 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
104 ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
105 +@@ -570,12 +570,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
106 + nv_connector->edid = NULL;
107 + }
108 +
109 +- /* Outputs are only polled while runtime active, so acquiring a
110 +- * runtime PM ref here is unnecessary (and would deadlock upon
111 +- * runtime suspend because it waits for polling to finish).
112 ++ /* Outputs are only polled while runtime active, so resuming the
113 ++ * device here is unnecessary (and would deadlock upon runtime suspend
114 ++ * because it waits for polling to finish). We do however, want to
115 ++ * prevent the autosuspend timer from elapsing during this operation
116 ++ * if possible.
117 + */
118 +- if (!drm_kms_helper_is_poll_worker()) {
119 +- ret = pm_runtime_get_sync(connector->dev->dev);
120 ++ if (drm_kms_helper_is_poll_worker()) {
121 ++ pm_runtime_get_noresume(dev->dev);
122 ++ } else {
123 ++ ret = pm_runtime_get_sync(dev->dev);
124 + if (ret < 0 && ret != -EACCES)
125 + return conn_status;
126 + }
127 +@@ -653,10 +657,8 @@ detect_analog:
128 +
129 + out:
130 +
131 +- if (!drm_kms_helper_is_poll_worker()) {
132 +- pm_runtime_mark_last_busy(connector->dev->dev);
133 +- pm_runtime_put_autosuspend(connector->dev->dev);
134 +- }
135 ++ pm_runtime_mark_last_busy(dev->dev);
136 ++ pm_runtime_put_autosuspend(dev->dev);
137 +
138 + return conn_status;
139 + }
140 +@@ -1120,6 +1122,26 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
141 + const struct nvif_notify_conn_rep_v0 *rep = notify->data;
142 + const char *name = connector->name;
143 + struct nouveau_encoder *nv_encoder;
144 ++ int ret;
145 ++
146 ++ ret = pm_runtime_get(drm->dev->dev);
147 ++ if (ret == 0) {
148 ++ /* We can't block here if there's a pending PM request
149 ++ * running, as we'll deadlock nouveau_display_fini() when it
150 ++ * calls nvif_put() on our nvif_notify struct. So, simply
151 ++ * defer the hotplug event until the device finishes resuming
152 ++ */
153 ++ NV_DEBUG(drm, "Deferring HPD on %s until runtime resume\n",
154 ++ name);
155 ++ schedule_work(&drm->hpd_work);
156 ++
157 ++ pm_runtime_put_noidle(drm->dev->dev);
158 ++ return NVIF_NOTIFY_KEEP;
159 ++ } else if (ret != 1 && ret != -EACCES) {
160 ++ NV_WARN(drm, "HPD on %s dropped due to RPM failure: %d\n",
161 ++ name, ret);
162 ++ return NVIF_NOTIFY_DROP;
163 ++ }
164 +
165 + if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) {
166 + NV_DEBUG(drm, "service %s\n", name);
167 +@@ -1137,6 +1159,8 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
168 + drm_helper_hpd_irq_event(connector->dev);
169 + }
170 +
171 ++ pm_runtime_mark_last_busy(drm->dev->dev);
172 ++ pm_runtime_put_autosuspend(drm->dev->dev);
173 + return NVIF_NOTIFY_KEEP;
174 + }
175 +
176 +diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
177 +index caf53503c0f7..2612702c3a3f 100644
178 +--- a/drivers/gpu/drm/nouveau/nouveau_display.c
179 ++++ b/drivers/gpu/drm/nouveau/nouveau_display.c
180 +@@ -356,8 +356,6 @@ nouveau_display_hpd_work(struct work_struct *work)
181 + pm_runtime_get_sync(drm->dev->dev);
182 +
183 + drm_helper_hpd_irq_event(drm->dev);
184 +- /* enable polling for external displays */
185 +- drm_kms_helper_poll_enable(drm->dev);
186 +
187 + pm_runtime_mark_last_busy(drm->dev->dev);
188 + pm_runtime_put_sync(drm->dev->dev);
189 +@@ -380,15 +378,29 @@ nouveau_display_acpi_ntfy(struct notifier_block *nb, unsigned long val,
190 + {
191 + struct nouveau_drm *drm = container_of(nb, typeof(*drm), acpi_nb);
192 + struct acpi_bus_event *info = data;
193 ++ int ret;
194 +
195 + if (!strcmp(info->device_class, ACPI_VIDEO_CLASS)) {
196 + if (info->type == ACPI_VIDEO_NOTIFY_PROBE) {
197 +- /*
198 +- * This may be the only indication we receive of a
199 +- * connector hotplug on a runtime suspended GPU,
200 +- * schedule hpd_work to check.
201 +- */
202 +- schedule_work(&drm->hpd_work);
203 ++ ret = pm_runtime_get(drm->dev->dev);
204 ++ if (ret == 1 || ret == -EACCES) {
205 ++ /* If the GPU is already awake, or in a state
206 ++ * where we can't wake it up, it can handle
207 ++ * it's own hotplug events.
208 ++ */
209 ++ pm_runtime_put_autosuspend(drm->dev->dev);
210 ++ } else if (ret == 0) {
211 ++ /* This may be the only indication we receive
212 ++ * of a connector hotplug on a runtime
213 ++ * suspended GPU, schedule hpd_work to check.
214 ++ */
215 ++ NV_DEBUG(drm, "ACPI requested connector reprobe\n");
216 ++ schedule_work(&drm->hpd_work);
217 ++ pm_runtime_put_noidle(drm->dev->dev);
218 ++ } else {
219 ++ NV_WARN(drm, "Dropped ACPI reprobe event due to RPM error: %d\n",
220 ++ ret);
221 ++ }
222 +
223 + /* acpi-video should not generate keypresses for this */
224 + return NOTIFY_BAD;
225 +@@ -412,6 +424,11 @@ nouveau_display_init(struct drm_device *dev)
226 + if (ret)
227 + return ret;
228 +
229 ++ /* enable connector detection and polling for connectors without HPD
230 ++ * support
231 ++ */
232 ++ drm_kms_helper_poll_enable(dev);
233 ++
234 + /* enable hotplug interrupts */
235 + drm_connector_list_iter_begin(dev, &conn_iter);
236 + nouveau_for_each_non_mst_connector_iter(connector, &conn_iter) {
237 +@@ -426,7 +443,7 @@ nouveau_display_init(struct drm_device *dev)
238 + }
239 +
240 + void
241 +-nouveau_display_fini(struct drm_device *dev, bool suspend)
242 ++nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
243 + {
244 + struct nouveau_display *disp = nouveau_display(dev);
245 + struct nouveau_drm *drm = nouveau_drm(dev);
246 +@@ -451,6 +468,9 @@ nouveau_display_fini(struct drm_device *dev, bool suspend)
247 + }
248 + drm_connector_list_iter_end(&conn_iter);
249 +
250 ++ if (!runtime)
251 ++ cancel_work_sync(&drm->hpd_work);
252 ++
253 + drm_kms_helper_poll_disable(dev);
254 + disp->fini(dev);
255 + }
256 +@@ -640,11 +660,11 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)
257 + }
258 + }
259 +
260 +- nouveau_display_fini(dev, true);
261 ++ nouveau_display_fini(dev, true, runtime);
262 + return 0;
263 + }
264 +
265 +- nouveau_display_fini(dev, true);
266 ++ nouveau_display_fini(dev, true, runtime);
267 +
268 + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
269 + struct nouveau_framebuffer *nouveau_fb;
270 +diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
271 +index 34cd144681b9..5e7dae79c2ee 100644
272 +--- a/drivers/gpu/drm/nouveau/nouveau_display.h
273 ++++ b/drivers/gpu/drm/nouveau/nouveau_display.h
274 +@@ -64,7 +64,7 @@ nouveau_display(struct drm_device *dev)
275 + int nouveau_display_create(struct drm_device *dev);
276 + void nouveau_display_destroy(struct drm_device *dev);
277 + int nouveau_display_init(struct drm_device *dev);
278 +-void nouveau_display_fini(struct drm_device *dev, bool suspend);
279 ++void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
280 + int nouveau_display_suspend(struct drm_device *dev, bool runtime);
281 + void nouveau_display_resume(struct drm_device *dev, bool runtime);
282 + int nouveau_display_vblank_enable(struct drm_device *, unsigned int);
283 +diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
284 +index d6f13d7254de..7d3c7bb0ebfa 100644
285 +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
286 ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
287 +@@ -546,7 +546,7 @@ nouveau_drm_unload(struct drm_device *dev)
288 + nouveau_debugfs_fini(drm);
289 +
290 + if (dev->mode_config.num_crtc)
291 +- nouveau_display_fini(dev, false);
292 ++ nouveau_display_fini(dev, false, false);
293 + nouveau_display_destroy(dev);
294 +
295 + nouveau_bios_takedown(dev);
296 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
297 +index 8746eeeec44d..491f1892b50e 100644
298 +--- a/drivers/gpu/drm/udl/udl_fb.c
299 ++++ b/drivers/gpu/drm/udl/udl_fb.c
300 +@@ -432,9 +432,11 @@ static void udl_fbdev_destroy(struct drm_device *dev,
301 + {
302 + drm_fb_helper_unregister_fbi(&ufbdev->helper);
303 + drm_fb_helper_fini(&ufbdev->helper);
304 +- drm_framebuffer_unregister_private(&ufbdev->ufb.base);
305 +- drm_framebuffer_cleanup(&ufbdev->ufb.base);
306 +- drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
307 ++ if (ufbdev->ufb.obj) {
308 ++ drm_framebuffer_unregister_private(&ufbdev->ufb.base);
309 ++ drm_framebuffer_cleanup(&ufbdev->ufb.base);
310 ++ drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
311 ++ }
312 + }
313 +
314 + int udl_fbdev_init(struct drm_device *dev)
315 +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
316 +index 17590cb2b80d..502c7eb708c2 100644
317 +--- a/drivers/gpu/drm/vc4/vc4_plane.c
318 ++++ b/drivers/gpu/drm/vc4/vc4_plane.c
319 +@@ -329,6 +329,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
320 + vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
321 + vc4_state->crtc_h);
322 +
323 ++ vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
324 ++ vc4_state->y_scaling[0] == VC4_SCALING_NONE);
325 ++
326 + if (num_planes > 1) {
327 + vc4_state->is_yuv = true;
328 +
329 +@@ -344,24 +347,17 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
330 + vc4_get_scaling_mode(vc4_state->src_h[1],
331 + vc4_state->crtc_h);
332 +
333 +- /* YUV conversion requires that scaling be enabled,
334 +- * even on a plane that's otherwise 1:1. Choose TPZ
335 +- * for simplicity.
336 ++ /* YUV conversion requires that horizontal scaling be enabled,
337 ++ * even on a plane that's otherwise 1:1. Looks like only PPF
338 ++ * works in that case, so let's pick that one.
339 + */
340 +- if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
341 +- vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
342 +- if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
343 +- vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
344 ++ if (vc4_state->is_unity)
345 ++ vc4_state->x_scaling[0] = VC4_SCALING_PPF;
346 + } else {
347 + vc4_state->x_scaling[1] = VC4_SCALING_NONE;
348 + vc4_state->y_scaling[1] = VC4_SCALING_NONE;
349 + }
350 +
351 +- vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
352 +- vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
353 +- vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
354 +- vc4_state->y_scaling[1] == VC4_SCALING_NONE);
355 +-
356 + /* No configuring scaling on the cursor plane, since it gets
357 + non-vblank-synced updates, and scaling requires requires
358 + LBM changes which have to be vblank-synced.
359 +@@ -639,7 +635,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
360 + vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
361 + }
362 +
363 +- if (!vc4_state->is_unity) {
364 ++ if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
365 ++ vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
366 ++ vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
367 ++ vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
368 + /* LBM Base Address. */
369 + if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
370 + vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
371 +diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
372 +index a8a8f65a1e51..24952af51a54 100644
373 +--- a/drivers/infiniband/hw/cxgb4/qp.c
374 ++++ b/drivers/infiniband/hw/cxgb4/qp.c
375 +@@ -1395,6 +1395,12 @@ static void flush_qp(struct c4iw_qp *qhp)
376 + schp = to_c4iw_cq(qhp->ibqp.send_cq);
377 +
378 + if (qhp->ibqp.uobject) {
379 ++
380 ++ /* for user qps, qhp->wq.flushed is protected by qhp->mutex */
381 ++ if (qhp->wq.flushed)
382 ++ return;
383 ++
384 ++ qhp->wq.flushed = 1;
385 + t4_set_wq_in_error(&qhp->wq);
386 + t4_set_cq_in_error(&rchp->cq);
387 + spin_lock_irqsave(&rchp->comp_handler_lock, flag);
388 +diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
389 +index 5f8b583c6e41..f74166aa9a0d 100644
390 +--- a/drivers/misc/vmw_balloon.c
391 ++++ b/drivers/misc/vmw_balloon.c
392 +@@ -45,6 +45,7 @@
393 + #include <linux/seq_file.h>
394 + #include <linux/vmw_vmci_defs.h>
395 + #include <linux/vmw_vmci_api.h>
396 ++#include <linux/io.h>
397 + #include <asm/hypervisor.h>
398 +
399 + MODULE_AUTHOR("VMware, Inc.");
400 +diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
401 +index 9375cef22420..3d27616d9c85 100644
402 +--- a/drivers/net/appletalk/ipddp.c
403 ++++ b/drivers/net/appletalk/ipddp.c
404 +@@ -283,8 +283,12 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
405 + case SIOCFINDIPDDPRT:
406 + spin_lock_bh(&ipddp_route_lock);
407 + rp = __ipddp_find_route(&rcp);
408 +- if (rp)
409 +- memcpy(&rcp2, rp, sizeof(rcp2));
410 ++ if (rp) {
411 ++ memset(&rcp2, 0, sizeof(rcp2));
412 ++ rcp2.ip = rp->ip;
413 ++ rcp2.at = rp->at;
414 ++ rcp2.flags = rp->flags;
415 ++ }
416 + spin_unlock_bh(&ipddp_route_lock);
417 +
418 + if (rp) {
419 +diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
420 +index c8c7ad2eff77..9b5a68b65432 100644
421 +--- a/drivers/net/ethernet/hp/hp100.c
422 ++++ b/drivers/net/ethernet/hp/hp100.c
423 +@@ -2634,7 +2634,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
424 + /* Wait for link to drop */
425 + time = jiffies + (HZ / 10);
426 + do {
427 +- if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
428 ++ if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
429 + break;
430 + if (!in_interrupt())
431 + schedule_timeout_interruptible(1);
432 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
433 +index 71e2aef6b7a1..951892da3352 100644
434 +--- a/drivers/net/ppp/pppoe.c
435 ++++ b/drivers/net/ppp/pppoe.c
436 +@@ -429,6 +429,9 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
437 + if (!skb)
438 + goto out;
439 +
440 ++ if (skb_mac_header_len(skb) < ETH_HLEN)
441 ++ goto drop;
442 ++
443 + if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
444 + goto drop;
445 +
446 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
447 +index 31684f3382f6..c5d4b35bb72a 100644
448 +--- a/drivers/net/usb/qmi_wwan.c
449 ++++ b/drivers/net/usb/qmi_wwan.c
450 +@@ -1205,13 +1205,13 @@ static const struct usb_device_id products[] = {
451 + {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
452 + {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */
453 + {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */
454 +- {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
455 +- {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
456 +- {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
457 +- {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */
458 +- {QMI_FIXED_INTF(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */
459 +- {QMI_FIXED_INTF(0x1199, 0x907b, 10)}, /* Sierra Wireless EM74xx */
460 +- {QMI_FIXED_INTF(0x1199, 0x9091, 8)}, /* Sierra Wireless EM7565 */
461 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
462 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x9071, 10)},/* Sierra Wireless MC74xx */
463 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
464 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x9079, 10)},/* Sierra Wireless EM74xx */
465 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x907b, 8)}, /* Sierra Wireless EM74xx */
466 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x907b, 10)},/* Sierra Wireless EM74xx */
467 ++ {QMI_QUIRK_SET_DTR(0x1199, 0x9091, 8)}, /* Sierra Wireless EM7565 */
468 + {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
469 + {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
470 + {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
471 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
472 +index d80343429de5..1a40fc3517a8 100644
473 +--- a/drivers/net/xen-netfront.c
474 ++++ b/drivers/net/xen-netfront.c
475 +@@ -907,7 +907,11 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
476 + BUG_ON(pull_to <= skb_headlen(skb));
477 + __pskb_pull_tail(skb, pull_to - skb_headlen(skb));
478 + }
479 +- BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
480 ++ if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
481 ++ queue->rx.rsp_cons = ++cons;
482 ++ kfree_skb(nskb);
483 ++ return ~0U;
484 ++ }
485 +
486 + skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
487 + skb_frag_page(nfrag),
488 +@@ -1044,6 +1048,8 @@ err:
489 + skb->len += rx->status;
490 +
491 + i = xennet_fill_frags(queue, skb, &tmpq);
492 ++ if (unlikely(i == ~0U))
493 ++ goto err;
494 +
495 + if (rx->flags & XEN_NETRXF_csum_blank)
496 + skb->ip_summed = CHECKSUM_PARTIAL;
497 +diff --git a/drivers/pci/host/pci-aardvark.c b/drivers/pci/host/pci-aardvark.c
498 +index 9bfc22b5da4b..5f3048e75bec 100644
499 +--- a/drivers/pci/host/pci-aardvark.c
500 ++++ b/drivers/pci/host/pci-aardvark.c
501 +@@ -954,6 +954,7 @@ static int advk_pcie_probe(struct platform_device *pdev)
502 +
503 + bus = bridge->bus;
504 +
505 ++ pci_bus_size_bridges(bus);
506 + pci_bus_assign_resources(bus);
507 +
508 + list_for_each_entry(child, &bus->children, node)
509 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
510 +index ec2911c4ee42..35c9b2f4b293 100644
511 +--- a/drivers/pci/quirks.c
512 ++++ b/drivers/pci/quirks.c
513 +@@ -4388,11 +4388,6 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags)
514 + *
515 + * 0x9d10-0x9d1b PCI Express Root port #{1-12}
516 + *
517 +- * The 300 series chipset suffers from the same bug so include those root
518 +- * ports here as well.
519 +- *
520 +- * 0xa32c-0xa343 PCI Express Root port #{0-24}
521 +- *
522 + * [1] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html
523 + * [2] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html
524 + * [3] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html
525 +@@ -4410,7 +4405,6 @@ static bool pci_quirk_intel_spt_pch_acs_match(struct pci_dev *dev)
526 + case 0xa110 ... 0xa11f: case 0xa167 ... 0xa16a: /* Sunrise Point */
527 + case 0xa290 ... 0xa29f: case 0xa2e7 ... 0xa2ee: /* Union Point */
528 + case 0x9d10 ... 0x9d1b: /* 7th & 8th Gen Mobile */
529 +- case 0xa32c ... 0xa343: /* 300 series */
530 + return true;
531 + }
532 +
533 +diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
534 +index 4eb8e1a472b2..e335b18da20f 100644
535 +--- a/drivers/platform/x86/alienware-wmi.c
536 ++++ b/drivers/platform/x86/alienware-wmi.c
537 +@@ -519,6 +519,7 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args,
538 + if (obj && obj->type == ACPI_TYPE_INTEGER)
539 + *out_data = (u32) obj->integer.value;
540 + }
541 ++ kfree(output.pointer);
542 + return status;
543 +
544 + }
545 +diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
546 +index cec4c3223044..dffa3aab7178 100644
547 +--- a/drivers/rpmsg/rpmsg_core.c
548 ++++ b/drivers/rpmsg/rpmsg_core.c
549 +@@ -23,7 +23,6 @@
550 + #include <linux/module.h>
551 + #include <linux/rpmsg.h>
552 + #include <linux/of_device.h>
553 +-#include <linux/pm_domain.h>
554 + #include <linux/slab.h>
555 +
556 + #include "rpmsg_internal.h"
557 +@@ -419,10 +418,6 @@ static int rpmsg_dev_probe(struct device *dev)
558 + struct rpmsg_endpoint *ept = NULL;
559 + int err;
560 +
561 +- err = dev_pm_domain_attach(dev, true);
562 +- if (err)
563 +- goto out;
564 +-
565 + if (rpdrv->callback) {
566 + strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
567 + chinfo.src = rpdev->src;
568 +@@ -464,8 +459,6 @@ static int rpmsg_dev_remove(struct device *dev)
569 +
570 + rpdrv->remove(rpdev);
571 +
572 +- dev_pm_domain_detach(dev, true);
573 +-
574 + if (rpdev->ept)
575 + rpmsg_destroy_ept(rpdev->ept);
576 +
577 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
578 +index f85d30dc9187..670dbb7a8500 100644
579 +--- a/drivers/spi/spi.c
580 ++++ b/drivers/spi/spi.c
581 +@@ -2108,8 +2108,17 @@ int spi_register_controller(struct spi_controller *ctlr)
582 + */
583 + if (ctlr->num_chipselect == 0)
584 + return -EINVAL;
585 +- /* allocate dynamic bus number using Linux idr */
586 +- if ((ctlr->bus_num < 0) && ctlr->dev.of_node) {
587 ++ if (ctlr->bus_num >= 0) {
588 ++ /* devices with a fixed bus num must check-in with the num */
589 ++ mutex_lock(&board_lock);
590 ++ id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num,
591 ++ ctlr->bus_num + 1, GFP_KERNEL);
592 ++ mutex_unlock(&board_lock);
593 ++ if (WARN(id < 0, "couldn't get idr"))
594 ++ return id == -ENOSPC ? -EBUSY : id;
595 ++ ctlr->bus_num = id;
596 ++ } else if (ctlr->dev.of_node) {
597 ++ /* allocate dynamic bus number using Linux idr */
598 + id = of_alias_get_id(ctlr->dev.of_node, "spi");
599 + if (id >= 0) {
600 + ctlr->bus_num = id;
601 +diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
602 +index 9518ffd8b8ba..4e680d753941 100644
603 +--- a/drivers/target/iscsi/iscsi_target_auth.c
604 ++++ b/drivers/target/iscsi/iscsi_target_auth.c
605 +@@ -26,27 +26,6 @@
606 + #include "iscsi_target_nego.h"
607 + #include "iscsi_target_auth.h"
608 +
609 +-static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len)
610 +-{
611 +- int j = DIV_ROUND_UP(len, 2), rc;
612 +-
613 +- rc = hex2bin(dst, src, j);
614 +- if (rc < 0)
615 +- pr_debug("CHAP string contains non hex digit symbols\n");
616 +-
617 +- dst[j] = '\0';
618 +- return j;
619 +-}
620 +-
621 +-static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len)
622 +-{
623 +- int i;
624 +-
625 +- for (i = 0; i < src_len; i++) {
626 +- sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff);
627 +- }
628 +-}
629 +-
630 + static int chap_gen_challenge(
631 + struct iscsi_conn *conn,
632 + int caller,
633 +@@ -62,7 +41,7 @@ static int chap_gen_challenge(
634 + ret = get_random_bytes_wait(chap->challenge, CHAP_CHALLENGE_LENGTH);
635 + if (unlikely(ret))
636 + return ret;
637 +- chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge,
638 ++ bin2hex(challenge_asciihex, chap->challenge,
639 + CHAP_CHALLENGE_LENGTH);
640 + /*
641 + * Set CHAP_C, and copy the generated challenge into c_str.
642 +@@ -248,9 +227,16 @@ static int chap_server_compute_md5(
643 + pr_err("Could not find CHAP_R.\n");
644 + goto out;
645 + }
646 ++ if (strlen(chap_r) != MD5_SIGNATURE_SIZE * 2) {
647 ++ pr_err("Malformed CHAP_R\n");
648 ++ goto out;
649 ++ }
650 ++ if (hex2bin(client_digest, chap_r, MD5_SIGNATURE_SIZE) < 0) {
651 ++ pr_err("Malformed CHAP_R\n");
652 ++ goto out;
653 ++ }
654 +
655 + pr_debug("[server] Got CHAP_R=%s\n", chap_r);
656 +- chap_string_to_hex(client_digest, chap_r, strlen(chap_r));
657 +
658 + tfm = crypto_alloc_shash("md5", 0, 0);
659 + if (IS_ERR(tfm)) {
660 +@@ -294,7 +280,7 @@ static int chap_server_compute_md5(
661 + goto out;
662 + }
663 +
664 +- chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE);
665 ++ bin2hex(response, server_digest, MD5_SIGNATURE_SIZE);
666 + pr_debug("[server] MD5 Server Digest: %s\n", response);
667 +
668 + if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) {
669 +@@ -349,9 +335,7 @@ static int chap_server_compute_md5(
670 + pr_err("Could not find CHAP_C.\n");
671 + goto out;
672 + }
673 +- pr_debug("[server] Got CHAP_C=%s\n", challenge);
674 +- challenge_len = chap_string_to_hex(challenge_binhex, challenge,
675 +- strlen(challenge));
676 ++ challenge_len = DIV_ROUND_UP(strlen(challenge), 2);
677 + if (!challenge_len) {
678 + pr_err("Unable to convert incoming challenge\n");
679 + goto out;
680 +@@ -360,6 +344,11 @@ static int chap_server_compute_md5(
681 + pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n");
682 + goto out;
683 + }
684 ++ if (hex2bin(challenge_binhex, challenge, challenge_len) < 0) {
685 ++ pr_err("Malformed CHAP_C\n");
686 ++ goto out;
687 ++ }
688 ++ pr_debug("[server] Got CHAP_C=%s\n", challenge);
689 + /*
690 + * During mutual authentication, the CHAP_C generated by the
691 + * initiator must not match the original CHAP_C generated by
692 +@@ -413,7 +402,7 @@ static int chap_server_compute_md5(
693 + /*
694 + * Convert response from binary hex to ascii hext.
695 + */
696 +- chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE);
697 ++ bin2hex(response, digest, MD5_SIGNATURE_SIZE);
698 + *nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s",
699 + response);
700 + *nr_out_len += 1;
701 +diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
702 +index 2d2b420598b2..7b34b0ddbf0e 100644
703 +--- a/drivers/tty/vt/vt_ioctl.c
704 ++++ b/drivers/tty/vt/vt_ioctl.c
705 +@@ -32,6 +32,8 @@
706 + #include <asm/io.h>
707 + #include <linux/uaccess.h>
708 +
709 ++#include <linux/nospec.h>
710 ++
711 + #include <linux/kbd_kern.h>
712 + #include <linux/vt_kern.h>
713 + #include <linux/kbd_diacr.h>
714 +@@ -700,6 +702,8 @@ int vt_ioctl(struct tty_struct *tty,
715 + if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
716 + ret = -ENXIO;
717 + else {
718 ++ vsa.console = array_index_nospec(vsa.console,
719 ++ MAX_NR_CONSOLES + 1);
720 + vsa.console--;
721 + console_lock();
722 + ret = vc_allocate(vsa.console);
723 +diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
724 +index d5babc9f222b..dc676714454a 100644
725 +--- a/fs/ext4/dir.c
726 ++++ b/fs/ext4/dir.c
727 +@@ -75,7 +75,7 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
728 + else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
729 + error_msg = "rec_len is too small for name_len";
730 + else if (unlikely(((char *) de - buf) + rlen > size))
731 +- error_msg = "directory entry across range";
732 ++ error_msg = "directory entry overrun";
733 + else if (unlikely(le32_to_cpu(de->inode) >
734 + le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count)))
735 + error_msg = "inode out of bounds";
736 +@@ -84,18 +84,16 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
737 +
738 + if (filp)
739 + ext4_error_file(filp, function, line, bh->b_blocknr,
740 +- "bad entry in directory: %s - offset=%u(%u), "
741 +- "inode=%u, rec_len=%d, name_len=%d",
742 +- error_msg, (unsigned) (offset % size),
743 +- offset, le32_to_cpu(de->inode),
744 +- rlen, de->name_len);
745 ++ "bad entry in directory: %s - offset=%u, "
746 ++ "inode=%u, rec_len=%d, name_len=%d, size=%d",
747 ++ error_msg, offset, le32_to_cpu(de->inode),
748 ++ rlen, de->name_len, size);
749 + else
750 + ext4_error_inode(dir, function, line, bh->b_blocknr,
751 +- "bad entry in directory: %s - offset=%u(%u), "
752 +- "inode=%u, rec_len=%d, name_len=%d",
753 +- error_msg, (unsigned) (offset % size),
754 +- offset, le32_to_cpu(de->inode),
755 +- rlen, de->name_len);
756 ++ "bad entry in directory: %s - offset=%u, "
757 ++ "inode=%u, rec_len=%d, name_len=%d, size=%d",
758 ++ error_msg, offset, le32_to_cpu(de->inode),
759 ++ rlen, de->name_len, size);
760 +
761 + return 1;
762 + }
763 +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
764 +index 0abb30d19fa1..c96778c39885 100644
765 +--- a/fs/ext4/ext4.h
766 ++++ b/fs/ext4/ext4.h
767 +@@ -714,6 +714,9 @@ struct fsxattr {
768 + /* Max physical block we can address w/o extents */
769 + #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
770 +
771 ++/* Max logical block we can support */
772 ++#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF
773 ++
774 + /*
775 + * Structure of an inode on the disk
776 + */
777 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
778 +index b549cfd2d7d3..4e1d62ba0703 100644
779 +--- a/fs/ext4/inline.c
780 ++++ b/fs/ext4/inline.c
781 +@@ -1759,6 +1759,7 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data)
782 + {
783 + int err, inline_size;
784 + struct ext4_iloc iloc;
785 ++ size_t inline_len;
786 + void *inline_pos;
787 + unsigned int offset;
788 + struct ext4_dir_entry_2 *de;
789 +@@ -1786,8 +1787,9 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data)
790 + goto out;
791 + }
792 +
793 ++ inline_len = ext4_get_inline_size(dir);
794 + offset = EXT4_INLINE_DOTDOT_SIZE;
795 +- while (offset < dir->i_size) {
796 ++ while (offset < inline_len) {
797 + de = ext4_get_inline_entry(dir, &iloc, offset,
798 + &inline_pos, &inline_size);
799 + if (ext4_check_dir_entry(dir, NULL, de,
800 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
801 +index f9baa59de0e2..9808df52ceca 100644
802 +--- a/fs/ext4/inode.c
803 ++++ b/fs/ext4/inode.c
804 +@@ -3407,11 +3407,16 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
805 + {
806 + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
807 + unsigned int blkbits = inode->i_blkbits;
808 +- unsigned long first_block = offset >> blkbits;
809 +- unsigned long last_block = (offset + length - 1) >> blkbits;
810 ++ unsigned long first_block, last_block;
811 + struct ext4_map_blocks map;
812 + int ret;
813 +
814 ++ if ((offset >> blkbits) > EXT4_MAX_LOGICAL_BLOCK)
815 ++ return -EINVAL;
816 ++ first_block = offset >> blkbits;
817 ++ last_block = min_t(loff_t, (offset + length - 1) >> blkbits,
818 ++ EXT4_MAX_LOGICAL_BLOCK);
819 ++
820 + if (WARN_ON_ONCE(ext4_has_inline_data(inode)))
821 + return -ERANGE;
822 +
823 +diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
824 +index 638ad4743477..38e6a846aac1 100644
825 +--- a/fs/ext4/mmp.c
826 ++++ b/fs/ext4/mmp.c
827 +@@ -49,7 +49,6 @@ static int write_mmp_block(struct super_block *sb, struct buffer_head *bh)
828 + */
829 + sb_start_write(sb);
830 + ext4_mmp_csum_set(sb, mmp);
831 +- mark_buffer_dirty(bh);
832 + lock_buffer(bh);
833 + bh->b_end_io = end_buffer_write_sync;
834 + get_bh(bh);
835 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
836 +index 1db39e12e02b..eb0d8ee39827 100644
837 +--- a/fs/ext4/namei.c
838 ++++ b/fs/ext4/namei.c
839 +@@ -3514,6 +3514,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
840 + int credits;
841 + u8 old_file_type;
842 +
843 ++ if (new.inode && new.inode->i_nlink == 0) {
844 ++ EXT4_ERROR_INODE(new.inode,
845 ++ "target of rename is already freed");
846 ++ return -EFSCORRUPTED;
847 ++ }
848 ++
849 + if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT)) &&
850 + (!projid_eq(EXT4_I(new_dir)->i_projid,
851 + EXT4_I(old_dentry->d_inode)->i_projid)))
852 +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
853 +index 823c0b82dfeb..e344e606c054 100644
854 +--- a/fs/ext4/resize.c
855 ++++ b/fs/ext4/resize.c
856 +@@ -19,6 +19,7 @@
857 +
858 + int ext4_resize_begin(struct super_block *sb)
859 + {
860 ++ struct ext4_sb_info *sbi = EXT4_SB(sb);
861 + int ret = 0;
862 +
863 + if (!capable(CAP_SYS_RESOURCE))
864 +@@ -29,7 +30,7 @@ int ext4_resize_begin(struct super_block *sb)
865 + * because the user tools have no way of handling this. Probably a
866 + * bad time to do it anyways.
867 + */
868 +- if (EXT4_SB(sb)->s_sbh->b_blocknr !=
869 ++ if (EXT4_B2C(sbi, sbi->s_sbh->b_blocknr) !=
870 + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
871 + ext4_warning(sb, "won't resize using backup superblock at %llu",
872 + (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);
873 +@@ -1956,6 +1957,26 @@ retry:
874 + }
875 + }
876 +
877 ++ /*
878 ++ * Make sure the last group has enough space so that it's
879 ++ * guaranteed to have enough space for all metadata blocks
880 ++ * that it might need to hold. (We might not need to store
881 ++ * the inode table blocks in the last block group, but there
882 ++ * will be cases where this might be needed.)
883 ++ */
884 ++ if ((ext4_group_first_block_no(sb, n_group) +
885 ++ ext4_group_overhead_blocks(sb, n_group) + 2 +
886 ++ sbi->s_itb_per_group + sbi->s_cluster_ratio) >= n_blocks_count) {
887 ++ n_blocks_count = ext4_group_first_block_no(sb, n_group);
888 ++ n_group--;
889 ++ n_blocks_count_retry = 0;
890 ++ if (resize_inode) {
891 ++ iput(resize_inode);
892 ++ resize_inode = NULL;
893 ++ }
894 ++ goto retry;
895 ++ }
896 ++
897 + /* extend the last group */
898 + if (n_group == o_group)
899 + add = n_blocks_count - o_blocks_count;
900 +diff --git a/fs/ext4/super.c b/fs/ext4/super.c
901 +index b4fb085261fd..9dbd27f7b778 100644
902 +--- a/fs/ext4/super.c
903 ++++ b/fs/ext4/super.c
904 +@@ -2085,6 +2085,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
905 + SEQ_OPTS_PRINT("max_dir_size_kb=%u", sbi->s_max_dir_size_kb);
906 + if (test_opt(sb, DATA_ERR_ABORT))
907 + SEQ_OPTS_PUTS("data_err=abort");
908 ++ if (DUMMY_ENCRYPTION_ENABLED(sbi))
909 ++ SEQ_OPTS_PUTS("test_dummy_encryption");
910 +
911 + ext4_show_quota_options(seq, sb);
912 + return 0;
913 +@@ -4311,11 +4313,13 @@ no_journal:
914 + block = ext4_count_free_clusters(sb);
915 + ext4_free_blocks_count_set(sbi->s_es,
916 + EXT4_C2B(sbi, block));
917 ++ ext4_superblock_csum_set(sb);
918 + err = percpu_counter_init(&sbi->s_freeclusters_counter, block,
919 + GFP_KERNEL);
920 + if (!err) {
921 + unsigned long freei = ext4_count_free_inodes(sb);
922 + sbi->s_es->s_free_inodes_count = cpu_to_le32(freei);
923 ++ ext4_superblock_csum_set(sb);
924 + err = percpu_counter_init(&sbi->s_freeinodes_counter, freei,
925 + GFP_KERNEL);
926 + }
927 +diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
928 +index d9ebe11c8990..1d098c3c00e0 100644
929 +--- a/fs/ocfs2/buffer_head_io.c
930 ++++ b/fs/ocfs2/buffer_head_io.c
931 +@@ -342,6 +342,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
932 + * for this bh as it's not marked locally
933 + * uptodate. */
934 + status = -EIO;
935 ++ clear_buffer_needs_validate(bh);
936 + put_bh(bh);
937 + bhs[i] = NULL;
938 + continue;
939 +diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
940 +index d47f16c0d582..c13eae819cbc 100644
941 +--- a/fs/ubifs/xattr.c
942 ++++ b/fs/ubifs/xattr.c
943 +@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
944 + ui->data_len = size;
945 +
946 + mutex_lock(&host_ui->ui_mutex);
947 +-
948 +- if (!host->i_nlink) {
949 +- err = -ENOENT;
950 +- goto out_noent;
951 +- }
952 +-
953 + host->i_ctime = current_time(host);
954 + host_ui->xattr_cnt += 1;
955 + host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
956 +@@ -189,7 +183,6 @@ out_cancel:
957 + host_ui->xattr_size -= CALC_XATTR_BYTES(size);
958 + host_ui->xattr_names -= fname_len(nm);
959 + host_ui->flags &= ~UBIFS_CRYPT_FL;
960 +-out_noent:
961 + mutex_unlock(&host_ui->ui_mutex);
962 + out_free:
963 + make_bad_inode(inode);
964 +@@ -241,12 +234,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
965 + mutex_unlock(&ui->ui_mutex);
966 +
967 + mutex_lock(&host_ui->ui_mutex);
968 +-
969 +- if (!host->i_nlink) {
970 +- err = -ENOENT;
971 +- goto out_noent;
972 +- }
973 +-
974 + host->i_ctime = current_time(host);
975 + host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
976 + host_ui->xattr_size += CALC_XATTR_BYTES(size);
977 +@@ -268,7 +255,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
978 + out_cancel:
979 + host_ui->xattr_size -= CALC_XATTR_BYTES(size);
980 + host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
981 +-out_noent:
982 + mutex_unlock(&host_ui->ui_mutex);
983 + make_bad_inode(inode);
984 + out_free:
985 +@@ -497,12 +483,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
986 + return err;
987 +
988 + mutex_lock(&host_ui->ui_mutex);
989 +-
990 +- if (!host->i_nlink) {
991 +- err = -ENOENT;
992 +- goto out_noent;
993 +- }
994 +-
995 + host->i_ctime = current_time(host);
996 + host_ui->xattr_cnt -= 1;
997 + host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
998 +@@ -522,7 +502,6 @@ out_cancel:
999 + host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
1000 + host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
1001 + host_ui->xattr_names += fname_len(nm);
1002 +-out_noent:
1003 + mutex_unlock(&host_ui->ui_mutex);
1004 + ubifs_release_budget(c, &req);
1005 + make_bad_inode(inode);
1006 +@@ -562,9 +541,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
1007 +
1008 + ubifs_assert(inode_is_locked(host));
1009 +
1010 +- if (!host->i_nlink)
1011 +- return -ENOENT;
1012 +-
1013 + if (fname_len(&nm) > UBIFS_MAX_NLEN)
1014 + return -ENAMETOOLONG;
1015 +
1016 +diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
1017 +index 316694dafa5b..008f466d1da7 100644
1018 +--- a/include/net/nfc/hci.h
1019 ++++ b/include/net/nfc/hci.h
1020 +@@ -87,7 +87,7 @@ struct nfc_hci_pipe {
1021 + * According to specification 102 622 chapter 4.4 Pipes,
1022 + * the pipe identifier is 7 bits long.
1023 + */
1024 +-#define NFC_HCI_MAX_PIPES 127
1025 ++#define NFC_HCI_MAX_PIPES 128
1026 + struct nfc_hci_init_data {
1027 + u8 gate_count;
1028 + struct nfc_hci_gate gates[NFC_HCI_MAX_CUSTOM_GATES];
1029 +diff --git a/include/net/tls.h b/include/net/tls.h
1030 +index 48940a883d9a..86ed3dd80fe7 100644
1031 +--- a/include/net/tls.h
1032 ++++ b/include/net/tls.h
1033 +@@ -79,11 +79,13 @@ enum {
1034 + TLS_PENDING_CLOSED_RECORD
1035 + };
1036 +
1037 ++union tls_crypto_context {
1038 ++ struct tls_crypto_info info;
1039 ++ struct tls12_crypto_info_aes_gcm_128 aes_gcm_128;
1040 ++};
1041 ++
1042 + struct tls_context {
1043 +- union {
1044 +- struct tls_crypto_info crypto_send;
1045 +- struct tls12_crypto_info_aes_gcm_128 crypto_send_aes_gcm_128;
1046 +- };
1047 ++ union tls_crypto_context crypto_send;
1048 +
1049 + void *priv_ctx;
1050 +
1051 +@@ -208,8 +210,8 @@ static inline void tls_fill_prepend(struct tls_context *ctx,
1052 + * size KTLS_DTLS_HEADER_SIZE + KTLS_DTLS_NONCE_EXPLICIT_SIZE
1053 + */
1054 + buf[0] = record_type;
1055 +- buf[1] = TLS_VERSION_MINOR(ctx->crypto_send.version);
1056 +- buf[2] = TLS_VERSION_MAJOR(ctx->crypto_send.version);
1057 ++ buf[1] = TLS_VERSION_MINOR(ctx->crypto_send.info.version);
1058 ++ buf[2] = TLS_VERSION_MAJOR(ctx->crypto_send.info.version);
1059 + /* we can use IV for nonce explicit according to spec */
1060 + buf[3] = pkt_len >> 8;
1061 + buf[4] = pkt_len & 0xFF;
1062 +diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
1063 +index 910cc4334b21..7b8c9e19bad1 100644
1064 +--- a/include/uapi/linux/keyctl.h
1065 ++++ b/include/uapi/linux/keyctl.h
1066 +@@ -65,7 +65,7 @@
1067 +
1068 + /* keyctl structures */
1069 + struct keyctl_dh_params {
1070 +- __s32 dh_private;
1071 ++ __s32 private;
1072 + __s32 prime;
1073 + __s32 base;
1074 + };
1075 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
1076 +index a5e20ceb0b5a..b2d699f28304 100644
1077 +--- a/kernel/sched/fair.c
1078 ++++ b/kernel/sched/fair.c
1079 +@@ -9137,7 +9137,8 @@ static inline bool vruntime_normalized(struct task_struct *p)
1080 + * - A task which has been woken up by try_to_wake_up() and
1081 + * waiting for actually being woken up by sched_ttwu_pending().
1082 + */
1083 +- if (!se->sum_exec_runtime || p->state == TASK_WAKING)
1084 ++ if (!se->sum_exec_runtime ||
1085 ++ (p->state == TASK_WAKING && p->sched_remote_wakeup))
1086 + return true;
1087 +
1088 + return false;
1089 +diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
1090 +index ea3c062e7e1c..a8fa0a896b78 100644
1091 +--- a/kernel/time/tick-sched.c
1092 ++++ b/kernel/time/tick-sched.c
1093 +@@ -908,7 +908,7 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts)
1094 + if (unlikely(local_softirq_pending() && cpu_online(cpu))) {
1095 + static int ratelimit;
1096 +
1097 +- if (ratelimit < 10 &&
1098 ++ if (ratelimit < 10 && !in_softirq() &&
1099 + (local_softirq_pending() & SOFTIRQ_STOP_IDLE_MASK)) {
1100 + pr_warn("NOHZ: local_softirq_pending %02x\n",
1101 + (unsigned int) local_softirq_pending());
1102 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
1103 +index fd7809004297..a1d5e0949dcf 100644
1104 +--- a/kernel/trace/ring_buffer.c
1105 ++++ b/kernel/trace/ring_buffer.c
1106 +@@ -1479,6 +1479,8 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
1107 + tmp_iter_page = first_page;
1108 +
1109 + do {
1110 ++ cond_resched();
1111 ++
1112 + to_remove_page = tmp_iter_page;
1113 + rb_inc_page(cpu_buffer, &tmp_iter_page);
1114 +
1115 +diff --git a/mm/shmem.c b/mm/shmem.c
1116 +index f383298b7280..ea786a504e1b 100644
1117 +--- a/mm/shmem.c
1118 ++++ b/mm/shmem.c
1119 +@@ -2207,6 +2207,8 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
1120 + mpol_shared_policy_init(&info->policy, NULL);
1121 + break;
1122 + }
1123 ++
1124 ++ lockdep_annotate_inode_mutex_key(inode);
1125 + } else
1126 + shmem_free_inode(sb);
1127 + return inode;
1128 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
1129 +index 514d697d4691..dcb89cbc2730 100644
1130 +--- a/net/core/neighbour.c
1131 ++++ b/net/core/neighbour.c
1132 +@@ -1174,6 +1174,12 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1133 + lladdr = neigh->ha;
1134 + }
1135 +
1136 ++ /* Update confirmed timestamp for neighbour entry after we
1137 ++ * received ARP packet even if it doesn't change IP to MAC binding.
1138 ++ */
1139 ++ if (new & NUD_CONNECTED)
1140 ++ neigh->confirmed = jiffies;
1141 ++
1142 + /* If entry was valid and address is not changed,
1143 + do not change entry state, if new one is STALE.
1144 + */
1145 +@@ -1195,15 +1201,12 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1146 + }
1147 + }
1148 +
1149 +- /* Update timestamps only once we know we will make a change to the
1150 ++ /* Update timestamp only once we know we will make a change to the
1151 + * neighbour entry. Otherwise we risk to move the locktime window with
1152 + * noop updates and ignore relevant ARP updates.
1153 + */
1154 +- if (new != old || lladdr != neigh->ha) {
1155 +- if (new & NUD_CONNECTED)
1156 +- neigh->confirmed = jiffies;
1157 ++ if (new != old || lladdr != neigh->ha)
1158 + neigh->updated = jiffies;
1159 +- }
1160 +
1161 + if (new != old) {
1162 + neigh_del_timer(neigh);
1163 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
1164 +index b9d9a2b8792c..f31c09873d0f 100644
1165 +--- a/net/ipv4/af_inet.c
1166 ++++ b/net/ipv4/af_inet.c
1167 +@@ -1307,6 +1307,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
1168 + if (encap)
1169 + skb_reset_inner_headers(skb);
1170 + skb->network_header = (u8 *)iph - skb->head;
1171 ++ skb_reset_mac_len(skb);
1172 + } while ((skb = skb->next));
1173 +
1174 + out:
1175 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
1176 +index 5752bf7593dc..3de413867991 100644
1177 +--- a/net/ipv4/udp.c
1178 ++++ b/net/ipv4/udp.c
1179 +@@ -2049,6 +2049,28 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh,
1180 + inet_compute_pseudo);
1181 + }
1182 +
1183 ++/* wrapper for udp_queue_rcv_skb tacking care of csum conversion and
1184 ++ * return code conversion for ip layer consumption
1185 ++ */
1186 ++static int udp_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
1187 ++ struct udphdr *uh)
1188 ++{
1189 ++ int ret;
1190 ++
1191 ++ if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
1192 ++ skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
1193 ++ inet_compute_pseudo);
1194 ++
1195 ++ ret = udp_queue_rcv_skb(sk, skb);
1196 ++
1197 ++ /* a return value > 0 means to resubmit the input, but
1198 ++ * it wants the return to be -protocol, or 0
1199 ++ */
1200 ++ if (ret > 0)
1201 ++ return -ret;
1202 ++ return 0;
1203 ++}
1204 ++
1205 + /*
1206 + * All we need to do is get the socket, and then do a checksum.
1207 + */
1208 +@@ -2095,14 +2117,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1209 + if (unlikely(sk->sk_rx_dst != dst))
1210 + udp_sk_rx_dst_set(sk, dst);
1211 +
1212 +- ret = udp_queue_rcv_skb(sk, skb);
1213 ++ ret = udp_unicast_rcv_skb(sk, skb, uh);
1214 + sock_put(sk);
1215 +- /* a return value > 0 means to resubmit the input, but
1216 +- * it wants the return to be -protocol, or 0
1217 +- */
1218 +- if (ret > 0)
1219 +- return -ret;
1220 +- return 0;
1221 ++ return ret;
1222 + }
1223 +
1224 + if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1225 +@@ -2110,22 +2127,8 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1226 + saddr, daddr, udptable, proto);
1227 +
1228 + sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
1229 +- if (sk) {
1230 +- int ret;
1231 +-
1232 +- if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
1233 +- skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
1234 +- inet_compute_pseudo);
1235 +-
1236 +- ret = udp_queue_rcv_skb(sk, skb);
1237 +-
1238 +- /* a return value > 0 means to resubmit the input, but
1239 +- * it wants the return to be -protocol, or 0
1240 +- */
1241 +- if (ret > 0)
1242 +- return -ret;
1243 +- return 0;
1244 +- }
1245 ++ if (sk)
1246 ++ return udp_unicast_rcv_skb(sk, skb, uh);
1247 +
1248 + if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1249 + goto drop;
1250 +diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
1251 +index 4a87f9428ca5..e3698b6d8231 100644
1252 +--- a/net/ipv6/ip6_offload.c
1253 ++++ b/net/ipv6/ip6_offload.c
1254 +@@ -113,6 +113,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
1255 + payload_len = skb->len - nhoff - sizeof(*ipv6h);
1256 + ipv6h->payload_len = htons(payload_len);
1257 + skb->network_header = (u8 *)ipv6h - skb->head;
1258 ++ skb_reset_mac_len(skb);
1259 +
1260 + if (udpfrag) {
1261 + int err = ip6_find_1stfragopt(skb, &prevhdr);
1262 +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
1263 +index 1da021527fcd..9ab1e0fcbc13 100644
1264 +--- a/net/ipv6/ip6_output.c
1265 ++++ b/net/ipv6/ip6_output.c
1266 +@@ -219,12 +219,10 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
1267 + kfree_skb(skb);
1268 + return -ENOBUFS;
1269 + }
1270 ++ if (skb->sk)
1271 ++ skb_set_owner_w(skb2, skb->sk);
1272 + consume_skb(skb);
1273 + skb = skb2;
1274 +- /* skb_set_owner_w() changes sk->sk_wmem_alloc atomically,
1275 +- * it is safe to call in our context (socket lock not held)
1276 +- */
1277 +- skb_set_owner_w(skb, (struct sock *)sk);
1278 + }
1279 + if (opt->opt_flen)
1280 + ipv6_push_frag_opts(skb, opt, &proto);
1281 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
1282 +index 330d5ea8451b..5cee941ab0a9 100644
1283 +--- a/net/ipv6/udp.c
1284 ++++ b/net/ipv6/udp.c
1285 +@@ -780,6 +780,28 @@ static void udp6_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
1286 + }
1287 + }
1288 +
1289 ++/* wrapper for udp_queue_rcv_skb tacking care of csum conversion and
1290 ++ * return code conversion for ip layer consumption
1291 ++ */
1292 ++static int udp6_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
1293 ++ struct udphdr *uh)
1294 ++{
1295 ++ int ret;
1296 ++
1297 ++ if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
1298 ++ skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
1299 ++ ip6_compute_pseudo);
1300 ++
1301 ++ ret = udpv6_queue_rcv_skb(sk, skb);
1302 ++
1303 ++ /* a return value > 0 means to resubmit the input, but
1304 ++ * it wants the return to be -protocol, or 0
1305 ++ */
1306 ++ if (ret > 0)
1307 ++ return -ret;
1308 ++ return 0;
1309 ++}
1310 ++
1311 + int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1312 + int proto)
1313 + {
1314 +@@ -831,13 +853,14 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1315 + if (unlikely(sk->sk_rx_dst != dst))
1316 + udp6_sk_rx_dst_set(sk, dst);
1317 +
1318 +- ret = udpv6_queue_rcv_skb(sk, skb);
1319 +- sock_put(sk);
1320 ++ if (!uh->check && !udp_sk(sk)->no_check6_rx) {
1321 ++ sock_put(sk);
1322 ++ goto report_csum_error;
1323 ++ }
1324 +
1325 +- /* a return value > 0 means to resubmit the input */
1326 +- if (ret > 0)
1327 +- return ret;
1328 +- return 0;
1329 ++ ret = udp6_unicast_rcv_skb(sk, skb, uh);
1330 ++ sock_put(sk);
1331 ++ return ret;
1332 + }
1333 +
1334 + /*
1335 +@@ -850,30 +873,13 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1336 + /* Unicast */
1337 + sk = __udp6_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
1338 + if (sk) {
1339 +- int ret;
1340 +-
1341 +- if (!uh->check && !udp_sk(sk)->no_check6_rx) {
1342 +- udp6_csum_zero_error(skb);
1343 +- goto csum_error;
1344 +- }
1345 +-
1346 +- if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
1347 +- skb_checksum_try_convert(skb, IPPROTO_UDP, uh->check,
1348 +- ip6_compute_pseudo);
1349 +-
1350 +- ret = udpv6_queue_rcv_skb(sk, skb);
1351 +-
1352 +- /* a return value > 0 means to resubmit the input */
1353 +- if (ret > 0)
1354 +- return ret;
1355 +-
1356 +- return 0;
1357 ++ if (!uh->check && !udp_sk(sk)->no_check6_rx)
1358 ++ goto report_csum_error;
1359 ++ return udp6_unicast_rcv_skb(sk, skb, uh);
1360 + }
1361 +
1362 +- if (!uh->check) {
1363 +- udp6_csum_zero_error(skb);
1364 +- goto csum_error;
1365 +- }
1366 ++ if (!uh->check)
1367 ++ goto report_csum_error;
1368 +
1369 + if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
1370 + goto discard;
1371 +@@ -894,6 +900,9 @@ short_packet:
1372 + ulen, skb->len,
1373 + daddr, ntohs(uh->dest));
1374 + goto discard;
1375 ++
1376 ++report_csum_error:
1377 ++ udp6_csum_zero_error(skb);
1378 + csum_error:
1379 + __UDP6_INC_STATS(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
1380 + discard:
1381 +diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
1382 +index b740fef0acc5..6bf14f4f4b42 100644
1383 +--- a/net/nfc/hci/core.c
1384 ++++ b/net/nfc/hci/core.c
1385 +@@ -209,6 +209,11 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
1386 + }
1387 + create_info = (struct hci_create_pipe_resp *)skb->data;
1388 +
1389 ++ if (create_info->pipe >= NFC_HCI_MAX_PIPES) {
1390 ++ status = NFC_HCI_ANY_E_NOK;
1391 ++ goto exit;
1392 ++ }
1393 ++
1394 + /* Save the new created pipe and bind with local gate,
1395 + * the description for skb->data[3] is destination gate id
1396 + * but since we received this cmd from host controller, we
1397 +@@ -232,6 +237,11 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
1398 + }
1399 + delete_info = (struct hci_delete_pipe_noti *)skb->data;
1400 +
1401 ++ if (delete_info->pipe >= NFC_HCI_MAX_PIPES) {
1402 ++ status = NFC_HCI_ANY_E_NOK;
1403 ++ goto exit;
1404 ++ }
1405 ++
1406 + hdev->pipes[delete_info->pipe].gate = NFC_HCI_INVALID_GATE;
1407 + hdev->pipes[delete_info->pipe].dest_host = NFC_HCI_INVALID_HOST;
1408 + break;
1409 +diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
1410 +index 53752b9327d0..a859b55d7899 100644
1411 +--- a/net/sched/act_sample.c
1412 ++++ b/net/sched/act_sample.c
1413 +@@ -64,7 +64,7 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
1414 +
1415 + if (!exists) {
1416 + ret = tcf_idr_create(tn, parm->index, est, a,
1417 +- &act_sample_ops, bind, false);
1418 ++ &act_sample_ops, bind, true);
1419 + if (ret)
1420 + return ret;
1421 + ret = ACT_P_CREATED;
1422 +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
1423 +index 055b9992d8c7..efa2cdba99d3 100644
1424 +--- a/net/tls/tls_main.c
1425 ++++ b/net/tls/tls_main.c
1426 +@@ -218,6 +218,15 @@ static void tls_write_space(struct sock *sk)
1427 + ctx->sk_write_space(sk);
1428 + }
1429 +
1430 ++static void tls_ctx_free(struct tls_context *ctx)
1431 ++{
1432 ++ if (!ctx)
1433 ++ return;
1434 ++
1435 ++ memzero_explicit(&ctx->crypto_send, sizeof(ctx->crypto_send));
1436 ++ kfree(ctx);
1437 ++}
1438 ++
1439 + static void tls_sk_proto_close(struct sock *sk, long timeout)
1440 + {
1441 + struct tls_context *ctx = tls_get_ctx(sk);
1442 +@@ -246,7 +255,7 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
1443 + kfree(ctx->iv);
1444 +
1445 + sk_proto_close = ctx->sk_proto_close;
1446 +- kfree(ctx);
1447 ++ tls_ctx_free(ctx);
1448 +
1449 + release_sock(sk);
1450 + sk_proto_close(sk, timeout);
1451 +@@ -274,7 +283,7 @@ static int do_tls_getsockopt_tx(struct sock *sk, char __user *optval,
1452 + }
1453 +
1454 + /* get user crypto info */
1455 +- crypto_info = &ctx->crypto_send;
1456 ++ crypto_info = &ctx->crypto_send.info;
1457 +
1458 + if (!TLS_CRYPTO_INFO_READY(crypto_info)) {
1459 + rc = -EBUSY;
1460 +@@ -371,7 +380,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
1461 + }
1462 +
1463 + /* get user crypto info */
1464 +- crypto_info = &ctx->crypto_send;
1465 ++ crypto_info = &ctx->crypto_send.info;
1466 +
1467 + /* Currently we don't support set crypto info more than one time */
1468 + if (TLS_CRYPTO_INFO_READY(crypto_info)) {
1469 +@@ -416,7 +425,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
1470 + goto out;
1471 +
1472 + err_crypto_info:
1473 +- memset(crypto_info, 0, sizeof(*crypto_info));
1474 ++ memzero_explicit(crypto_info, sizeof(union tls_crypto_context));
1475 + out:
1476 + return rc;
1477 + }
1478 +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
1479 +index b81aa6d7dc45..6ae9ca567d6c 100644
1480 +--- a/net/tls/tls_sw.c
1481 ++++ b/net/tls/tls_sw.c
1482 +@@ -661,7 +661,6 @@ static void tls_sw_free_resources(struct sock *sk)
1483 +
1484 + int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx)
1485 + {
1486 +- char keyval[TLS_CIPHER_AES_GCM_128_KEY_SIZE];
1487 + struct tls_crypto_info *crypto_info;
1488 + struct tls12_crypto_info_aes_gcm_128 *gcm_128_info;
1489 + struct tls_sw_context *sw_ctx;
1490 +@@ -688,7 +687,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx)
1491 + ctx->priv_ctx = (struct tls_offload_context *)sw_ctx;
1492 + ctx->free_resources = tls_sw_free_resources;
1493 +
1494 +- crypto_info = &ctx->crypto_send;
1495 ++ crypto_info = &ctx->crypto_send.info;
1496 + switch (crypto_info->cipher_type) {
1497 + case TLS_CIPHER_AES_GCM_128: {
1498 + nonce_size = TLS_CIPHER_AES_GCM_128_IV_SIZE;
1499 +@@ -753,9 +752,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx)
1500 +
1501 + ctx->push_pending_record = tls_sw_push_pending_record;
1502 +
1503 +- memcpy(keyval, gcm_128_info->key, TLS_CIPHER_AES_GCM_128_KEY_SIZE);
1504 +-
1505 +- rc = crypto_aead_setkey(sw_ctx->aead_send, keyval,
1506 ++ rc = crypto_aead_setkey(sw_ctx->aead_send, gcm_128_info->key,
1507 + TLS_CIPHER_AES_GCM_128_KEY_SIZE);
1508 + if (rc)
1509 + goto free_aead;
1510 +diff --git a/security/keys/dh.c b/security/keys/dh.c
1511 +index 35543f04e759..d1ea9f325f94 100644
1512 +--- a/security/keys/dh.c
1513 ++++ b/security/keys/dh.c
1514 +@@ -307,7 +307,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params,
1515 + }
1516 + dh_inputs.g_size = dlen;
1517 +
1518 +- dlen = dh_data_from_key(pcopy.dh_private, &dh_inputs.key);
1519 ++ dlen = dh_data_from_key(pcopy.private, &dh_inputs.key);
1520 + if (dlen < 0) {
1521 + ret = dlen;
1522 + goto out2;
1523 +diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
1524 +index 730ea91d9be8..93676354f87f 100644
1525 +--- a/sound/firewire/bebob/bebob.c
1526 ++++ b/sound/firewire/bebob/bebob.c
1527 +@@ -263,6 +263,8 @@ do_registration(struct work_struct *work)
1528 + error:
1529 + mutex_unlock(&devices_mutex);
1530 + snd_bebob_stream_destroy_duplex(bebob);
1531 ++ kfree(bebob->maudio_special_quirk);
1532 ++ bebob->maudio_special_quirk = NULL;
1533 + snd_card_free(bebob->card);
1534 + dev_info(&bebob->unit->device,
1535 + "Sound card registration failed: %d\n", err);
1536 +diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
1537 +index bd55620c6a47..c266997ad299 100644
1538 +--- a/sound/firewire/bebob/bebob_maudio.c
1539 ++++ b/sound/firewire/bebob/bebob_maudio.c
1540 +@@ -96,17 +96,13 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit)
1541 + struct fw_device *device = fw_parent_device(unit);
1542 + int err, rcode;
1543 + u64 date;
1544 +- __le32 cues[3] = {
1545 +- cpu_to_le32(MAUDIO_BOOTLOADER_CUE1),
1546 +- cpu_to_le32(MAUDIO_BOOTLOADER_CUE2),
1547 +- cpu_to_le32(MAUDIO_BOOTLOADER_CUE3)
1548 +- };
1549 ++ __le32 *cues;
1550 +
1551 + /* check date of software used to build */
1552 + err = snd_bebob_read_block(unit, INFO_OFFSET_SW_DATE,
1553 + &date, sizeof(u64));
1554 + if (err < 0)
1555 +- goto end;
1556 ++ return err;
1557 + /*
1558 + * firmware version 5058 or later has date later than "20070401", but
1559 + * 'date' is not null-terminated.
1560 +@@ -114,20 +110,28 @@ int snd_bebob_maudio_load_firmware(struct fw_unit *unit)
1561 + if (date < 0x3230303730343031LL) {
1562 + dev_err(&unit->device,
1563 + "Use firmware version 5058 or later\n");
1564 +- err = -ENOSYS;
1565 +- goto end;
1566 ++ return -ENXIO;
1567 + }
1568 +
1569 ++ cues = kmalloc_array(3, sizeof(*cues), GFP_KERNEL);
1570 ++ if (!cues)
1571 ++ return -ENOMEM;
1572 ++
1573 ++ cues[0] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE1);
1574 ++ cues[1] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE2);
1575 ++ cues[2] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE3);
1576 ++
1577 + rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST,
1578 + device->node_id, device->generation,
1579 + device->max_speed, BEBOB_ADDR_REG_REQ,
1580 +- cues, sizeof(cues));
1581 ++ cues, 3 * sizeof(*cues));
1582 ++ kfree(cues);
1583 + if (rcode != RCODE_COMPLETE) {
1584 + dev_err(&unit->device,
1585 + "Failed to send a cue to load firmware\n");
1586 + err = -EIO;
1587 + }
1588 +-end:
1589 ++
1590 + return err;
1591 + }
1592 +
1593 +@@ -290,10 +294,6 @@ snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814)
1594 + bebob->midi_output_ports = 2;
1595 + }
1596 + end:
1597 +- if (err < 0) {
1598 +- kfree(params);
1599 +- bebob->maudio_special_quirk = NULL;
1600 +- }
1601 + mutex_unlock(&bebob->mutex);
1602 + return err;
1603 + }
1604 +diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c
1605 +index 1f5e1d23f31a..ef689997d6a5 100644
1606 +--- a/sound/firewire/digi00x/digi00x.c
1607 ++++ b/sound/firewire/digi00x/digi00x.c
1608 +@@ -49,6 +49,7 @@ static void dg00x_free(struct snd_dg00x *dg00x)
1609 + fw_unit_put(dg00x->unit);
1610 +
1611 + mutex_destroy(&dg00x->mutex);
1612 ++ kfree(dg00x);
1613 + }
1614 +
1615 + static void dg00x_card_free(struct snd_card *card)
1616 +diff --git a/sound/firewire/fireface/ff-protocol-ff400.c b/sound/firewire/fireface/ff-protocol-ff400.c
1617 +index 12aa15df435d..9f5036442ab9 100644
1618 +--- a/sound/firewire/fireface/ff-protocol-ff400.c
1619 ++++ b/sound/firewire/fireface/ff-protocol-ff400.c
1620 +@@ -146,6 +146,7 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
1621 + {
1622 + __le32 *reg;
1623 + int i;
1624 ++ int err;
1625 +
1626 + reg = kzalloc(sizeof(__le32) * 18, GFP_KERNEL);
1627 + if (reg == NULL)
1628 +@@ -163,9 +164,11 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
1629 + reg[i] = cpu_to_le32(0x00000001);
1630 + }
1631 +
1632 +- return snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST,
1633 +- FF400_FETCH_PCM_FRAMES, reg,
1634 +- sizeof(__le32) * 18, 0);
1635 ++ err = snd_fw_transaction(ff->unit, TCODE_WRITE_BLOCK_REQUEST,
1636 ++ FF400_FETCH_PCM_FRAMES, reg,
1637 ++ sizeof(__le32) * 18, 0);
1638 ++ kfree(reg);
1639 ++ return err;
1640 + }
1641 +
1642 + static void ff400_dump_sync_status(struct snd_ff *ff,
1643 +diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
1644 +index 71a0613d3da0..f2d073365cf6 100644
1645 +--- a/sound/firewire/fireworks/fireworks.c
1646 ++++ b/sound/firewire/fireworks/fireworks.c
1647 +@@ -301,6 +301,8 @@ error:
1648 + snd_efw_transaction_remove_instance(efw);
1649 + snd_efw_stream_destroy_duplex(efw);
1650 + snd_card_free(efw->card);
1651 ++ kfree(efw->resp_buf);
1652 ++ efw->resp_buf = NULL;
1653 + dev_info(&efw->unit->device,
1654 + "Sound card registration failed: %d\n", err);
1655 + }
1656 +diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
1657 +index 413ab6313bb6..a315d5b6b86b 100644
1658 +--- a/sound/firewire/oxfw/oxfw.c
1659 ++++ b/sound/firewire/oxfw/oxfw.c
1660 +@@ -136,6 +136,7 @@ static void oxfw_free(struct snd_oxfw *oxfw)
1661 +
1662 + kfree(oxfw->spec);
1663 + mutex_destroy(&oxfw->mutex);
1664 ++ kfree(oxfw);
1665 + }
1666 +
1667 + /*
1668 +@@ -213,6 +214,7 @@ static int detect_quirks(struct snd_oxfw *oxfw)
1669 + static void do_registration(struct work_struct *work)
1670 + {
1671 + struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work);
1672 ++ int i;
1673 + int err;
1674 +
1675 + if (oxfw->registered)
1676 +@@ -275,7 +277,15 @@ error:
1677 + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
1678 + if (oxfw->has_output)
1679 + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
1680 ++ for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; ++i) {
1681 ++ kfree(oxfw->tx_stream_formats[i]);
1682 ++ oxfw->tx_stream_formats[i] = NULL;
1683 ++ kfree(oxfw->rx_stream_formats[i]);
1684 ++ oxfw->rx_stream_formats[i] = NULL;
1685 ++ }
1686 + snd_card_free(oxfw->card);
1687 ++ kfree(oxfw->spec);
1688 ++ oxfw->spec = NULL;
1689 + dev_info(&oxfw->unit->device,
1690 + "Sound card registration failed: %d\n", err);
1691 + }
1692 +diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
1693 +index 44ad41fb7374..d3fdc463a884 100644
1694 +--- a/sound/firewire/tascam/tascam.c
1695 ++++ b/sound/firewire/tascam/tascam.c
1696 +@@ -93,6 +93,7 @@ static void tscm_free(struct snd_tscm *tscm)
1697 + fw_unit_put(tscm->unit);
1698 +
1699 + mutex_destroy(&tscm->mutex);
1700 ++ kfree(tscm);
1701 + }
1702 +
1703 + static void tscm_card_free(struct snd_card *card)
1704 +diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
1705 +index a2b56b188be4..d68bb40d3676 100644
1706 +--- a/sound/pci/emu10k1/emufx.c
1707 ++++ b/sound/pci/emu10k1/emufx.c
1708 +@@ -2547,7 +2547,7 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un
1709 + emu->support_tlv = 1;
1710 + return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
1711 + case SNDRV_EMU10K1_IOCTL_INFO:
1712 +- info = kmalloc(sizeof(*info), GFP_KERNEL);
1713 ++ info = kzalloc(sizeof(*info), GFP_KERNEL);
1714 + if (!info)
1715 + return -ENOMEM;
1716 + snd_emu10k1_fx8010_info(emu, info);
1717 +diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
1718 +index fd966bb851cb..6e8eb1f5a041 100644
1719 +--- a/sound/soc/codecs/cs4265.c
1720 ++++ b/sound/soc/codecs/cs4265.c
1721 +@@ -157,8 +157,8 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
1722 + SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2,
1723 + 3, 1, 0),
1724 + SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum),
1725 +- SOC_SINGLE("MMTLR Data Switch", 0,
1726 +- 1, 1, 0),
1727 ++ SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2,
1728 ++ 0, 1, 0),
1729 + SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
1730 + SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
1731 + };
1732 +diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
1733 +index 107133297e8d..9896e736fa5c 100644
1734 +--- a/sound/soc/sh/rcar/core.c
1735 ++++ b/sound/soc/sh/rcar/core.c
1736 +@@ -925,12 +925,23 @@ static void rsnd_soc_dai_shutdown(struct snd_pcm_substream *substream,
1737 + rsnd_dai_call(nolock_stop, io, priv);
1738 + }
1739 +
1740 ++static int rsnd_soc_dai_prepare(struct snd_pcm_substream *substream,
1741 ++ struct snd_soc_dai *dai)
1742 ++{
1743 ++ struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
1744 ++ struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
1745 ++ struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
1746 ++
1747 ++ return rsnd_dai_call(prepare, io, priv);
1748 ++}
1749 ++
1750 + static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
1751 + .startup = rsnd_soc_dai_startup,
1752 + .shutdown = rsnd_soc_dai_shutdown,
1753 + .trigger = rsnd_soc_dai_trigger,
1754 + .set_fmt = rsnd_soc_dai_set_fmt,
1755 + .set_tdm_slot = rsnd_soc_set_dai_tdm_slot,
1756 ++ .prepare = rsnd_soc_dai_prepare,
1757 + };
1758 +
1759 + void rsnd_parse_connect_common(struct rsnd_dai *rdai,
1760 +diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
1761 +index c5de71f2dc8c..1768a0ae469d 100644
1762 +--- a/sound/soc/sh/rcar/rsnd.h
1763 ++++ b/sound/soc/sh/rcar/rsnd.h
1764 +@@ -283,6 +283,9 @@ struct rsnd_mod_ops {
1765 + int (*nolock_stop)(struct rsnd_mod *mod,
1766 + struct rsnd_dai_stream *io,
1767 + struct rsnd_priv *priv);
1768 ++ int (*prepare)(struct rsnd_mod *mod,
1769 ++ struct rsnd_dai_stream *io,
1770 ++ struct rsnd_priv *priv);
1771 + };
1772 +
1773 + struct rsnd_dai_stream;
1774 +@@ -312,6 +315,7 @@ struct rsnd_mod {
1775 + * H 0: fallback
1776 + * H 0: hw_params
1777 + * H 0: pointer
1778 ++ * H 0: prepare
1779 + */
1780 + #define __rsnd_mod_shift_nolock_start 0
1781 + #define __rsnd_mod_shift_nolock_stop 0
1782 +@@ -326,6 +330,7 @@ struct rsnd_mod {
1783 + #define __rsnd_mod_shift_fallback 28 /* always called */
1784 + #define __rsnd_mod_shift_hw_params 28 /* always called */
1785 + #define __rsnd_mod_shift_pointer 28 /* always called */
1786 ++#define __rsnd_mod_shift_prepare 28 /* always called */
1787 +
1788 + #define __rsnd_mod_add_probe 0
1789 + #define __rsnd_mod_add_remove 0
1790 +@@ -340,6 +345,7 @@ struct rsnd_mod {
1791 + #define __rsnd_mod_add_fallback 0
1792 + #define __rsnd_mod_add_hw_params 0
1793 + #define __rsnd_mod_add_pointer 0
1794 ++#define __rsnd_mod_add_prepare 0
1795 +
1796 + #define __rsnd_mod_call_probe 0
1797 + #define __rsnd_mod_call_remove 0
1798 +@@ -354,6 +360,7 @@ struct rsnd_mod {
1799 + #define __rsnd_mod_call_pointer 0
1800 + #define __rsnd_mod_call_nolock_start 0
1801 + #define __rsnd_mod_call_nolock_stop 1
1802 ++#define __rsnd_mod_call_prepare 0
1803 +
1804 + #define rsnd_mod_to_priv(mod) ((mod)->priv)
1805 + #define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1)
1806 +diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
1807 +index f0fb85fda42d..34223c8c28a8 100644
1808 +--- a/sound/soc/sh/rcar/ssi.c
1809 ++++ b/sound/soc/sh/rcar/ssi.c
1810 +@@ -280,7 +280,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
1811 + if (rsnd_ssi_is_multi_slave(mod, io))
1812 + return 0;
1813 +
1814 +- if (ssi->usrcnt > 1) {
1815 ++ if (ssi->rate) {
1816 + if (ssi->rate != rate) {
1817 + dev_err(dev, "SSI parent/child should use same rate\n");
1818 + return -EINVAL;
1819 +@@ -482,7 +482,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
1820 + struct rsnd_priv *priv)
1821 + {
1822 + struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
1823 +- int ret;
1824 +
1825 + if (!rsnd_ssi_is_run_mods(mod, io))
1826 + return 0;
1827 +@@ -493,10 +492,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
1828 +
1829 + rsnd_mod_power_on(mod);
1830 +
1831 +- ret = rsnd_ssi_master_clk_start(mod, io);
1832 +- if (ret < 0)
1833 +- return ret;
1834 +-
1835 + rsnd_ssi_config_init(mod, io);
1836 +
1837 + rsnd_ssi_register_setup(mod);
1838 +@@ -847,6 +842,13 @@ static int rsnd_ssi_pointer(struct rsnd_mod *mod,
1839 + return 0;
1840 + }
1841 +
1842 ++static int rsnd_ssi_prepare(struct rsnd_mod *mod,
1843 ++ struct rsnd_dai_stream *io,
1844 ++ struct rsnd_priv *priv)
1845 ++{
1846 ++ return rsnd_ssi_master_clk_start(mod, io);
1847 ++}
1848 ++
1849 + static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
1850 + .name = SSI_NAME,
1851 + .probe = rsnd_ssi_common_probe,
1852 +@@ -859,6 +861,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
1853 + .pointer= rsnd_ssi_pointer,
1854 + .pcm_new = rsnd_ssi_pcm_new,
1855 + .hw_params = rsnd_ssi_hw_params,
1856 ++ .prepare = rsnd_ssi_prepare,
1857 + };
1858 +
1859 + static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
1860 +@@ -935,6 +938,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
1861 + .pcm_new = rsnd_ssi_pcm_new,
1862 + .fallback = rsnd_ssi_fallback,
1863 + .hw_params = rsnd_ssi_hw_params,
1864 ++ .prepare = rsnd_ssi_prepare,
1865 + };
1866 +
1867 + int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)