Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Thu, 03 Sep 2020 11:32:58
Message-Id: 1599132742.a5c6a306c48fc9b2358ef101f66d34b78ced2328.mpagano@gentoo
1 commit: a5c6a306c48fc9b2358ef101f66d34b78ced2328
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 3 11:32:22 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 3 11:32:22 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a5c6a306
7
8 Linux patch 4.4.235
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1234_linux-4.4.235.patch | 2129 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2133 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 16dd710..d526939 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -979,6 +979,10 @@ Patch: 1233_linux-4.4.234.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.234
23
24 +Patch: 1234_linux-4.4.235.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.235
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/1234_linux-4.4.235.patch b/1234_linux-4.4.235.patch
33 new file mode 100644
34 index 0000000..87c263d
35 --- /dev/null
36 +++ b/1234_linux-4.4.235.patch
37 @@ -0,0 +1,2129 @@
38 +diff --git a/Makefile b/Makefile
39 +index 573b646a19936..a32490d4471f3 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 234
46 ++SUBLEVEL = 235
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/mips/vdso/genvdso.c b/arch/mips/vdso/genvdso.c
51 +index 530a36f465ced..afcc86726448e 100644
52 +--- a/arch/mips/vdso/genvdso.c
53 ++++ b/arch/mips/vdso/genvdso.c
54 +@@ -126,6 +126,7 @@ static void *map_vdso(const char *path, size_t *_size)
55 + if (fstat(fd, &stat) != 0) {
56 + fprintf(stderr, "%s: Failed to stat '%s': %s\n", program_name,
57 + path, strerror(errno));
58 ++ close(fd);
59 + return NULL;
60 + }
61 +
62 +@@ -134,6 +135,7 @@ static void *map_vdso(const char *path, size_t *_size)
63 + if (addr == MAP_FAILED) {
64 + fprintf(stderr, "%s: Failed to map '%s': %s\n", program_name,
65 + path, strerror(errno));
66 ++ close(fd);
67 + return NULL;
68 + }
69 +
70 +@@ -143,6 +145,7 @@ static void *map_vdso(const char *path, size_t *_size)
71 + if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) {
72 + fprintf(stderr, "%s: '%s' is not an ELF file\n", program_name,
73 + path);
74 ++ close(fd);
75 + return NULL;
76 + }
77 +
78 +@@ -154,6 +157,7 @@ static void *map_vdso(const char *path, size_t *_size)
79 + default:
80 + fprintf(stderr, "%s: '%s' has invalid ELF class\n",
81 + program_name, path);
82 ++ close(fd);
83 + return NULL;
84 + }
85 +
86 +@@ -165,6 +169,7 @@ static void *map_vdso(const char *path, size_t *_size)
87 + default:
88 + fprintf(stderr, "%s: '%s' has invalid ELF data order\n",
89 + program_name, path);
90 ++ close(fd);
91 + return NULL;
92 + }
93 +
94 +@@ -172,15 +177,18 @@ static void *map_vdso(const char *path, size_t *_size)
95 + fprintf(stderr,
96 + "%s: '%s' has invalid ELF machine (expected EM_MIPS)\n",
97 + program_name, path);
98 ++ close(fd);
99 + return NULL;
100 + } else if (swap_uint16(ehdr->e_type) != ET_DYN) {
101 + fprintf(stderr,
102 + "%s: '%s' has invalid ELF type (expected ET_DYN)\n",
103 + program_name, path);
104 ++ close(fd);
105 + return NULL;
106 + }
107 +
108 + *_size = stat.st_size;
109 ++ close(fd);
110 + return addr;
111 + }
112 +
113 +@@ -284,10 +292,12 @@ int main(int argc, char **argv)
114 + /* Calculate and write symbol offsets to <output file> */
115 + if (!get_symbols(dbg_vdso_path, dbg_vdso)) {
116 + unlink(out_path);
117 ++ fclose(out_file);
118 + return EXIT_FAILURE;
119 + }
120 +
121 + fprintf(out_file, "};\n");
122 ++ fclose(out_file);
123 +
124 + return EXIT_SUCCESS;
125 + }
126 +diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
127 +index 429fc59d2a476..9acca9c79ef62 100644
128 +--- a/arch/powerpc/platforms/cell/Kconfig
129 ++++ b/arch/powerpc/platforms/cell/Kconfig
130 +@@ -50,6 +50,7 @@ config SPU_FS
131 + tristate "SPU file system"
132 + default m
133 + depends on PPC_CELL
134 ++ depends on COREDUMP
135 + select SPU_BASE
136 + select MEMORY_HOTPLUG
137 + help
138 +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
139 +index 9e817c1b78087..1fa8e492ce27d 100644
140 +--- a/arch/powerpc/platforms/pseries/ras.c
141 ++++ b/arch/powerpc/platforms/pseries/ras.c
142 +@@ -90,7 +90,6 @@ static void handle_system_shutdown(char event_modifier)
143 + pr_emerg("Loss of power reported by firmware, system is "
144 + "running on UPS/battery");
145 + pr_emerg("Check RTAS error log for details");
146 +- orderly_poweroff(true);
147 + break;
148 +
149 + case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
150 +diff --git a/drivers/base/core.c b/drivers/base/core.c
151 +index 64b59552e7444..ddc9dd971674c 100644
152 +--- a/drivers/base/core.c
153 ++++ b/drivers/base/core.c
154 +@@ -2344,17 +2344,21 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
155 + */
156 + void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
157 + {
158 +- if (fwnode) {
159 +- struct fwnode_handle *fn = dev->fwnode;
160 ++ struct fwnode_handle *fn = dev->fwnode;
161 +
162 ++ if (fwnode) {
163 + if (fwnode_is_primary(fn))
164 + fn = fn->secondary;
165 +
166 + fwnode->secondary = fn;
167 + dev->fwnode = fwnode;
168 + } else {
169 +- dev->fwnode = fwnode_is_primary(dev->fwnode) ?
170 +- dev->fwnode->secondary : NULL;
171 ++ if (fwnode_is_primary(fn)) {
172 ++ dev->fwnode = fn->secondary;
173 ++ fn->secondary = NULL;
174 ++ } else {
175 ++ dev->fwnode = NULL;
176 ++ }
177 + }
178 + }
179 + EXPORT_SYMBOL_GPL(set_primary_fwnode);
180 +diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
181 +index 8efdb823826c8..79724fd0a8989 100644
182 +--- a/drivers/base/power/main.c
183 ++++ b/drivers/base/power/main.c
184 +@@ -1361,13 +1361,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
185 + }
186 +
187 + /*
188 +- * If a device configured to wake up the system from sleep states
189 +- * has been suspended at run time and there's a resume request pending
190 +- * for it, this is equivalent to the device signaling wakeup, so the
191 +- * system suspend operation should be aborted.
192 ++ * Wait for possible runtime PM transitions of the device in progress
193 ++ * to complete and if there's a runtime resume request pending for it,
194 ++ * resume it before proceeding with invoking the system-wide suspend
195 ++ * callbacks for it.
196 ++ *
197 ++ * If the system-wide suspend callbacks below change the configuration
198 ++ * of the device, they must disable runtime PM for it or otherwise
199 ++ * ensure that its runtime-resume callbacks will not be confused by that
200 ++ * change in case they are invoked going forward.
201 + */
202 +- if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
203 +- pm_wakeup_event(dev, 0);
204 ++ pm_runtime_barrier(dev);
205 +
206 + if (pm_wakeup_pending()) {
207 + dev->power.direct_complete = false;
208 +diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c
209 +index 18d77ace4813c..30f83fb6b145a 100644
210 +--- a/drivers/edac/ie31200_edac.c
211 ++++ b/drivers/edac/ie31200_edac.c
212 +@@ -131,6 +131,8 @@
213 + #define IE31200_PAGES(n) (n << (28 - PAGE_SHIFT))
214 +
215 + static int nr_channels;
216 ++static struct pci_dev *mci_pdev;
217 ++static int ie31200_registered = 1;
218 +
219 + struct ie31200_priv {
220 + void __iomem *window;
221 +@@ -456,12 +458,16 @@ fail_free:
222 + static int ie31200_init_one(struct pci_dev *pdev,
223 + const struct pci_device_id *ent)
224 + {
225 +- edac_dbg(0, "MC:\n");
226 ++ int rc;
227 +
228 ++ edac_dbg(0, "MC:\n");
229 + if (pci_enable_device(pdev) < 0)
230 + return -EIO;
231 ++ rc = ie31200_probe1(pdev, ent->driver_data);
232 ++ if (rc == 0 && !mci_pdev)
233 ++ mci_pdev = pci_dev_get(pdev);
234 +
235 +- return ie31200_probe1(pdev, ent->driver_data);
236 ++ return rc;
237 + }
238 +
239 + static void ie31200_remove_one(struct pci_dev *pdev)
240 +@@ -470,6 +476,8 @@ static void ie31200_remove_one(struct pci_dev *pdev)
241 + struct ie31200_priv *priv;
242 +
243 + edac_dbg(0, "\n");
244 ++ pci_dev_put(mci_pdev);
245 ++ mci_pdev = NULL;
246 + mci = edac_mc_del_mc(&pdev->dev);
247 + if (!mci)
248 + return;
249 +@@ -515,17 +523,53 @@ static struct pci_driver ie31200_driver = {
250 +
251 + static int __init ie31200_init(void)
252 + {
253 ++ int pci_rc, i;
254 ++
255 + edac_dbg(3, "MC:\n");
256 + /* Ensure that the OPSTATE is set correctly for POLL or NMI */
257 + opstate_init();
258 +
259 +- return pci_register_driver(&ie31200_driver);
260 ++ pci_rc = pci_register_driver(&ie31200_driver);
261 ++ if (pci_rc < 0)
262 ++ goto fail0;
263 ++
264 ++ if (!mci_pdev) {
265 ++ ie31200_registered = 0;
266 ++ for (i = 0; ie31200_pci_tbl[i].vendor != 0; i++) {
267 ++ mci_pdev = pci_get_device(ie31200_pci_tbl[i].vendor,
268 ++ ie31200_pci_tbl[i].device,
269 ++ NULL);
270 ++ if (mci_pdev)
271 ++ break;
272 ++ }
273 ++ if (!mci_pdev) {
274 ++ edac_dbg(0, "ie31200 pci_get_device fail\n");
275 ++ pci_rc = -ENODEV;
276 ++ goto fail1;
277 ++ }
278 ++ pci_rc = ie31200_init_one(mci_pdev, &ie31200_pci_tbl[i]);
279 ++ if (pci_rc < 0) {
280 ++ edac_dbg(0, "ie31200 init fail\n");
281 ++ pci_rc = -ENODEV;
282 ++ goto fail1;
283 ++ }
284 ++ }
285 ++ return 0;
286 ++
287 ++fail1:
288 ++ pci_unregister_driver(&ie31200_driver);
289 ++fail0:
290 ++ pci_dev_put(mci_pdev);
291 ++
292 ++ return pci_rc;
293 + }
294 +
295 + static void __exit ie31200_exit(void)
296 + {
297 + edac_dbg(3, "MC:\n");
298 + pci_unregister_driver(&ie31200_driver);
299 ++ if (!ie31200_registered)
300 ++ ie31200_remove_one(mci_pdev);
301 + }
302 +
303 + module_init(ie31200_init);
304 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
305 +index 1f0e6ede120c4..1b3fda2331bee 100644
306 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
307 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
308 +@@ -734,8 +734,10 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force)
309 +
310 + if (!drm_kms_helper_is_poll_worker()) {
311 + r = pm_runtime_get_sync(connector->dev->dev);
312 +- if (r < 0)
313 ++ if (r < 0) {
314 ++ pm_runtime_put_autosuspend(connector->dev->dev);
315 + return connector_status_disconnected;
316 ++ }
317 + }
318 +
319 + if (encoder) {
320 +@@ -863,8 +865,10 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force)
321 +
322 + if (!drm_kms_helper_is_poll_worker()) {
323 + r = pm_runtime_get_sync(connector->dev->dev);
324 +- if (r < 0)
325 ++ if (r < 0) {
326 ++ pm_runtime_put_autosuspend(connector->dev->dev);
327 + return connector_status_disconnected;
328 ++ }
329 + }
330 +
331 + encoder = amdgpu_connector_best_single_encoder(connector);
332 +@@ -986,8 +990,10 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
333 +
334 + if (!drm_kms_helper_is_poll_worker()) {
335 + r = pm_runtime_get_sync(connector->dev->dev);
336 +- if (r < 0)
337 ++ if (r < 0) {
338 ++ pm_runtime_put_autosuspend(connector->dev->dev);
339 + return connector_status_disconnected;
340 ++ }
341 + }
342 +
343 + if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {
344 +@@ -1360,8 +1366,10 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
345 +
346 + if (!drm_kms_helper_is_poll_worker()) {
347 + r = pm_runtime_get_sync(connector->dev->dev);
348 +- if (r < 0)
349 ++ if (r < 0) {
350 ++ pm_runtime_put_autosuspend(connector->dev->dev);
351 + return connector_status_disconnected;
352 ++ }
353 + }
354 +
355 + if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {
356 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
357 +index c555781685ea8..d3ee8f19f1ef9 100644
358 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
359 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
360 +@@ -296,7 +296,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set)
361 +
362 + ret = pm_runtime_get_sync(dev->dev);
363 + if (ret < 0)
364 +- return ret;
365 ++ goto out;
366 +
367 + ret = drm_crtc_helper_set_config(set);
368 +
369 +@@ -311,7 +311,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set)
370 + take the current one */
371 + if (active && !adev->have_disp_power_ref) {
372 + adev->have_disp_power_ref = true;
373 +- return ret;
374 ++ goto out;
375 + }
376 + /* if we have no active crtcs, then drop the power ref
377 + we got before */
378 +@@ -320,6 +320,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set)
379 + adev->have_disp_power_ref = false;
380 + }
381 +
382 ++out:
383 + /* drop the power reference we got coming in here */
384 + pm_runtime_put_autosuspend(dev->dev);
385 + return ret;
386 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
387 +index 8d6668cedf6db..eb3c54e1f1ca8 100644
388 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
389 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
390 +@@ -443,11 +443,12 @@ long amdgpu_drm_ioctl(struct file *filp,
391 + dev = file_priv->minor->dev;
392 + ret = pm_runtime_get_sync(dev->dev);
393 + if (ret < 0)
394 +- return ret;
395 ++ goto out;
396 +
397 + ret = drm_ioctl(filp, cmd, arg);
398 +
399 + pm_runtime_mark_last_busy(dev->dev);
400 ++out:
401 + pm_runtime_put_autosuspend(dev->dev);
402 + return ret;
403 + }
404 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
405 +index 5bf98f0195fbd..6025c69871a86 100644
406 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
407 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
408 +@@ -522,7 +522,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
409 +
410 + r = pm_runtime_get_sync(dev->dev);
411 + if (r < 0)
412 +- return r;
413 ++ goto pm_put;
414 +
415 + fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
416 + if (unlikely(!fpriv))
417 +@@ -540,6 +540,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
418 + file_priv->driver_priv = fpriv;
419 +
420 + pm_runtime_mark_last_busy(dev->dev);
421 ++pm_put:
422 + pm_runtime_put_autosuspend(dev->dev);
423 + return 0;
424 +
425 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
426 +index 2acbd43f9a531..965489b20429c 100644
427 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
428 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
429 +@@ -841,8 +841,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
430 +
431 + ret = kobject_init_and_add(dev->kobj_node, &node_type,
432 + sys_props.kobj_nodes, "%d", id);
433 +- if (ret < 0)
434 ++ if (ret < 0) {
435 ++ kobject_put(dev->kobj_node);
436 + return ret;
437 ++ }
438 +
439 + dev->kobj_mem = kobject_create_and_add("mem_banks", dev->kobj_node);
440 + if (!dev->kobj_mem)
441 +@@ -885,8 +887,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
442 + return -ENOMEM;
443 + ret = kobject_init_and_add(mem->kobj, &mem_type,
444 + dev->kobj_mem, "%d", i);
445 +- if (ret < 0)
446 ++ if (ret < 0) {
447 ++ kobject_put(mem->kobj);
448 + return ret;
449 ++ }
450 +
451 + mem->attr.name = "properties";
452 + mem->attr.mode = KFD_SYSFS_FILE_MODE;
453 +@@ -904,8 +908,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
454 + return -ENOMEM;
455 + ret = kobject_init_and_add(cache->kobj, &cache_type,
456 + dev->kobj_cache, "%d", i);
457 +- if (ret < 0)
458 ++ if (ret < 0) {
459 ++ kobject_put(cache->kobj);
460 + return ret;
461 ++ }
462 +
463 + cache->attr.name = "properties";
464 + cache->attr.mode = KFD_SYSFS_FILE_MODE;
465 +@@ -923,8 +929,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
466 + return -ENOMEM;
467 + ret = kobject_init_and_add(iolink->kobj, &iolink_type,
468 + dev->kobj_iolink, "%d", i);
469 +- if (ret < 0)
470 ++ if (ret < 0) {
471 ++ kobject_put(iolink->kobj);
472 + return ret;
473 ++ }
474 +
475 + iolink->attr.name = "properties";
476 + iolink->attr.mode = KFD_SYSFS_FILE_MODE;
477 +@@ -976,8 +984,10 @@ static int kfd_topology_update_sysfs(void)
478 + ret = kobject_init_and_add(sys_props.kobj_topology,
479 + &sysprops_type, &kfd_device->kobj,
480 + "topology");
481 +- if (ret < 0)
482 ++ if (ret < 0) {
483 ++ kobject_put(sys_props.kobj_topology);
484 + return ret;
485 ++ }
486 +
487 + sys_props.kobj_nodes = kobject_create_and_add("nodes",
488 + sys_props.kobj_topology);
489 +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
490 +index 1855b475cc0b2..42be04813b682 100644
491 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
492 ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
493 +@@ -263,8 +263,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
494 + pm_runtime_get_noresume(dev->dev);
495 + } else {
496 + ret = pm_runtime_get_sync(dev->dev);
497 +- if (ret < 0 && ret != -EACCES)
498 ++ if (ret < 0 && ret != -EACCES) {
499 ++ pm_runtime_put_autosuspend(dev->dev);
500 + return conn_status;
501 ++ }
502 + }
503 +
504 + nv_encoder = nouveau_connector_ddc_detect(connector);
505 +diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
506 +index edb3a23ded5d5..11183839f6fad 100644
507 +--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
508 ++++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
509 +@@ -184,8 +184,10 @@ nouveau_fbcon_open(struct fb_info *info, int user)
510 + struct nouveau_fbdev *fbcon = info->par;
511 + struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
512 + int ret = pm_runtime_get_sync(drm->dev->dev);
513 +- if (ret < 0 && ret != -EACCES)
514 ++ if (ret < 0 && ret != -EACCES) {
515 ++ pm_runtime_put(drm->dev->dev);
516 + return ret;
517 ++ }
518 + return 0;
519 + }
520 +
521 +diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
522 +index bebcef2ce6b88..a9f1d99bb6f99 100644
523 +--- a/drivers/gpu/drm/radeon/radeon_connectors.c
524 ++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
525 +@@ -886,8 +886,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
526 +
527 + if (!drm_kms_helper_is_poll_worker()) {
528 + r = pm_runtime_get_sync(connector->dev->dev);
529 +- if (r < 0)
530 ++ if (r < 0) {
531 ++ pm_runtime_put_autosuspend(connector->dev->dev);
532 + return connector_status_disconnected;
533 ++ }
534 + }
535 +
536 + if (encoder) {
537 +@@ -1021,8 +1023,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
538 +
539 + if (!drm_kms_helper_is_poll_worker()) {
540 + r = pm_runtime_get_sync(connector->dev->dev);
541 +- if (r < 0)
542 ++ if (r < 0) {
543 ++ pm_runtime_put_autosuspend(connector->dev->dev);
544 + return connector_status_disconnected;
545 ++ }
546 + }
547 +
548 + encoder = radeon_best_single_encoder(connector);
549 +@@ -1158,8 +1162,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force)
550 +
551 + if (!drm_kms_helper_is_poll_worker()) {
552 + r = pm_runtime_get_sync(connector->dev->dev);
553 +- if (r < 0)
554 ++ if (r < 0) {
555 ++ pm_runtime_put_autosuspend(connector->dev->dev);
556 + return connector_status_disconnected;
557 ++ }
558 + }
559 +
560 + encoder = radeon_best_single_encoder(connector);
561 +@@ -1241,8 +1247,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
562 +
563 + if (!drm_kms_helper_is_poll_worker()) {
564 + r = pm_runtime_get_sync(connector->dev->dev);
565 +- if (r < 0)
566 ++ if (r < 0) {
567 ++ pm_runtime_put_autosuspend(connector->dev->dev);
568 + return connector_status_disconnected;
569 ++ }
570 + }
571 +
572 + if (radeon_connector->detected_hpd_without_ddc) {
573 +@@ -1681,8 +1689,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
574 +
575 + if (!drm_kms_helper_is_poll_worker()) {
576 + r = pm_runtime_get_sync(connector->dev->dev);
577 +- if (r < 0)
578 ++ if (r < 0) {
579 ++ pm_runtime_put_autosuspend(connector->dev->dev);
580 + return connector_status_disconnected;
581 ++ }
582 + }
583 +
584 + if (!force && radeon_check_hpd_status_unchanged(connector)) {
585 +diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
586 +index dbdd265075daf..7bce23a43907e 100644
587 +--- a/drivers/hid/usbhid/hiddev.c
588 ++++ b/drivers/hid/usbhid/hiddev.c
589 +@@ -554,12 +554,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
590 +
591 + switch (cmd) {
592 + case HIDIOCGUSAGE:
593 ++ if (uref->usage_index >= field->report_count)
594 ++ goto inval;
595 + uref->value = field->value[uref->usage_index];
596 + if (copy_to_user(user_arg, uref, sizeof(*uref)))
597 + goto fault;
598 + goto goodreturn;
599 +
600 + case HIDIOCSUSAGE:
601 ++ if (uref->usage_index >= field->report_count)
602 ++ goto inval;
603 + field->value[uref->usage_index] = uref->value;
604 + goto goodreturn;
605 +
606 +diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
607 +index ddfb08a3e6c20..00b3178c36a7a 100644
608 +--- a/drivers/i2c/busses/i2c-rcar.c
609 ++++ b/drivers/i2c/busses/i2c-rcar.c
610 +@@ -393,6 +393,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
611 + /* master sent stop */
612 + if (ssr_filtered & SSR) {
613 + i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
614 ++ rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
615 + rcar_i2c_write(priv, ICSIER, SAR);
616 + rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
617 + }
618 +diff --git a/drivers/media/pci/ttpci/av7110.c b/drivers/media/pci/ttpci/av7110.c
619 +index f89364951ebdf..fb13cc3c591da 100644
620 +--- a/drivers/media/pci/ttpci/av7110.c
621 ++++ b/drivers/media/pci/ttpci/av7110.c
622 +@@ -426,14 +426,15 @@ static void debiirq(unsigned long cookie)
623 + case DATA_CI_GET:
624 + {
625 + u8 *data = av7110->debi_virt;
626 ++ u8 data_0 = data[0];
627 +
628 +- if ((data[0] < 2) && data[2] == 0xff) {
629 ++ if (data_0 < 2 && data[2] == 0xff) {
630 + int flags = 0;
631 + if (data[5] > 0)
632 + flags |= CA_CI_MODULE_PRESENT;
633 + if (data[5] > 5)
634 + flags |= CA_CI_MODULE_READY;
635 +- av7110->ci_slot[data[0]].flags = flags;
636 ++ av7110->ci_slot[data_0].flags = flags;
637 + } else
638 + ci_get_data(&av7110->ci_rbuffer,
639 + av7110->debi_virt,
640 +diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
641 +index c1e573b7cc6fb..50122ac2ac028 100644
642 +--- a/drivers/media/platform/davinci/vpif_capture.c
643 ++++ b/drivers/media/platform/davinci/vpif_capture.c
644 +@@ -1417,8 +1417,6 @@ probe_out:
645 + /* Unregister video device */
646 + video_unregister_device(&ch->video_dev);
647 + }
648 +- kfree(vpif_obj.sd);
649 +- v4l2_device_unregister(&vpif_obj.v4l2_dev);
650 +
651 + return err;
652 + }
653 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
654 +index e31b4c7d2522b..aaf75d5e6e480 100644
655 +--- a/drivers/net/bonding/bond_main.c
656 ++++ b/drivers/net/bonding/bond_main.c
657 +@@ -1940,7 +1940,8 @@ static int bond_release_and_destroy(struct net_device *bond_dev,
658 + int ret;
659 +
660 + ret = bond_release(bond_dev, slave_dev);
661 +- if (ret == 0 && !bond_has_slaves(bond)) {
662 ++ if (ret == 0 && !bond_has_slaves(bond) &&
663 ++ bond_dev->reg_state != NETREG_UNREGISTERING) {
664 + bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
665 + netdev_info(bond_dev, "Destroying bond %s\n",
666 + bond_dev->name);
667 +@@ -4057,13 +4058,23 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
668 + return ret;
669 + }
670 +
671 ++static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed)
672 ++{
673 ++ if (speed == 0 || speed == SPEED_UNKNOWN)
674 ++ speed = slave->speed;
675 ++ else
676 ++ speed = min(speed, slave->speed);
677 ++
678 ++ return speed;
679 ++}
680 ++
681 + static int bond_ethtool_get_settings(struct net_device *bond_dev,
682 + struct ethtool_cmd *ecmd)
683 + {
684 + struct bonding *bond = netdev_priv(bond_dev);
685 +- unsigned long speed = 0;
686 + struct list_head *iter;
687 + struct slave *slave;
688 ++ u32 speed = 0;
689 +
690 + ecmd->duplex = DUPLEX_UNKNOWN;
691 + ecmd->port = PORT_OTHER;
692 +@@ -4075,8 +4086,13 @@ static int bond_ethtool_get_settings(struct net_device *bond_dev,
693 + */
694 + bond_for_each_slave(bond, slave, iter) {
695 + if (bond_slave_can_tx(slave)) {
696 +- if (slave->speed != SPEED_UNKNOWN)
697 +- speed += slave->speed;
698 ++ if (slave->speed != SPEED_UNKNOWN) {
699 ++ if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
700 ++ speed = bond_mode_bcast_speed(slave,
701 ++ speed);
702 ++ else
703 ++ speed += slave->speed;
704 ++ }
705 + if (ecmd->duplex == DUPLEX_UNKNOWN &&
706 + slave->duplex != DUPLEX_UNKNOWN)
707 + ecmd->duplex = slave->duplex;
708 +diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
709 +index 37cc1f838dd8b..96310e2ee5458 100644
710 +--- a/drivers/net/ethernet/freescale/gianfar.c
711 ++++ b/drivers/net/ethernet/freescale/gianfar.c
712 +@@ -845,8 +845,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
713 + continue;
714 +
715 + err = gfar_parse_group(child, priv, model);
716 +- if (err)
717 ++ if (err) {
718 ++ of_node_put(child);
719 + goto err_grp_init;
720 ++ }
721 + }
722 + } else { /* SQ_SG_MODE */
723 + err = gfar_parse_group(np, priv, model);
724 +diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
725 +index b4d5f53c97d35..b7a122a1b89a1 100644
726 +--- a/drivers/net/ipvlan/ipvlan_main.c
727 ++++ b/drivers/net/ipvlan/ipvlan_main.c
728 +@@ -87,12 +87,21 @@ static void ipvlan_port_destroy(struct net_device *dev)
729 + static struct lock_class_key ipvlan_netdev_xmit_lock_key;
730 + static struct lock_class_key ipvlan_netdev_addr_lock_key;
731 +
732 ++#define IPVLAN_ALWAYS_ON_OFLOADS \
733 ++ (NETIF_F_SG | NETIF_F_HW_CSUM | \
734 ++ NETIF_F_GSO_ROBUST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL)
735 ++
736 ++#define IPVLAN_ALWAYS_ON \
737 ++ (IPVLAN_ALWAYS_ON_OFLOADS | NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED)
738 ++
739 + #define IPVLAN_FEATURES \
740 + (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
741 + NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
742 + NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
743 + NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
744 +
745 ++ /* NETIF_F_GSO_ENCAP_ALL NETIF_F_GSO_SOFTWARE Newly added */
746 ++
747 + #define IPVLAN_STATE_MASK \
748 + ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
749 +
750 +@@ -117,7 +126,9 @@ static int ipvlan_init(struct net_device *dev)
751 + dev->state = (dev->state & ~IPVLAN_STATE_MASK) |
752 + (phy_dev->state & IPVLAN_STATE_MASK);
753 + dev->features = phy_dev->features & IPVLAN_FEATURES;
754 +- dev->features |= NETIF_F_LLTX;
755 ++ dev->features |= IPVLAN_ALWAYS_ON;
756 ++ dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES;
757 ++ dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS;
758 + dev->gso_max_size = phy_dev->gso_max_size;
759 + dev->hard_header_len = phy_dev->hard_header_len;
760 +
761 +@@ -201,7 +212,14 @@ static netdev_features_t ipvlan_fix_features(struct net_device *dev,
762 + {
763 + struct ipvl_dev *ipvlan = netdev_priv(dev);
764 +
765 +- return features & (ipvlan->sfeatures | ~IPVLAN_FEATURES);
766 ++ features |= NETIF_F_ALL_FOR_ALL;
767 ++ features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
768 ++ features = netdev_increment_features(ipvlan->phy_dev->features,
769 ++ features, features);
770 ++ features |= IPVLAN_ALWAYS_ON;
771 ++ features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
772 ++
773 ++ return features;
774 + }
775 +
776 + static void ipvlan_change_rx_flags(struct net_device *dev, int change)
777 +@@ -590,9 +608,8 @@ static int ipvlan_device_event(struct notifier_block *unused,
778 +
779 + case NETDEV_FEAT_CHANGE:
780 + list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
781 +- ipvlan->dev->features = dev->features & IPVLAN_FEATURES;
782 + ipvlan->dev->gso_max_size = dev->gso_max_size;
783 +- netdev_features_change(ipvlan->dev);
784 ++ netdev_update_features(ipvlan->dev);
785 + }
786 + break;
787 +
788 +diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
789 +index 713c2bcea1782..8ec5c579d7fa8 100644
790 +--- a/drivers/net/wireless/ath/ath10k/hw.h
791 ++++ b/drivers/net/wireless/ath/ath10k/hw.h
792 +@@ -429,7 +429,7 @@ enum ath10k_hw_rate_cck {
793 +
794 + #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
795 + #define TARGET_10_4_NUM_WDS_ENTRIES 32
796 +-#define TARGET_10_4_DMA_BURST_SIZE 0
797 ++#define TARGET_10_4_DMA_BURST_SIZE 1
798 + #define TARGET_10_4_MAC_AGGR_DELIM 0
799 + #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
800 + #define TARGET_10_4_VOW_CONFIG 0
801 +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
802 +index 9408c1f8e3977..f01ef8ecfaf39 100644
803 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
804 ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
805 +@@ -755,8 +755,11 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
806 +
807 + usb_anchor_urb(urb, &rtlusb->rx_submitted);
808 + err = usb_submit_urb(urb, GFP_KERNEL);
809 +- if (err)
810 ++ if (err) {
811 ++ usb_unanchor_urb(urb);
812 ++ usb_free_urb(urb);
813 + goto err_out;
814 ++ }
815 + usb_free_urb(urb);
816 + }
817 + return 0;
818 +diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
819 +index 429d34c348b9f..01a343ad7155c 100644
820 +--- a/drivers/pci/slot.c
821 ++++ b/drivers/pci/slot.c
822 +@@ -303,13 +303,16 @@ placeholder:
823 + slot_name = make_slot_name(name);
824 + if (!slot_name) {
825 + err = -ENOMEM;
826 ++ kfree(slot);
827 + goto err;
828 + }
829 +
830 + err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
831 + "%s", slot_name);
832 +- if (err)
833 ++ if (err) {
834 ++ kobject_put(&slot->kobj);
835 + goto err;
836 ++ }
837 +
838 + INIT_LIST_HEAD(&slot->list);
839 + list_add(&slot->list, &parent->slots);
840 +@@ -328,7 +331,6 @@ out:
841 + mutex_unlock(&pci_slot_mutex);
842 + return slot;
843 + err:
844 +- kfree(slot);
845 + slot = ERR_PTR(err);
846 + goto out;
847 + }
848 +diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
849 +index 8ecc956ecb59c..370a3a2c6de73 100644
850 +--- a/drivers/s390/cio/css.c
851 ++++ b/drivers/s390/cio/css.c
852 +@@ -529,6 +529,11 @@ static int slow_eval_known_fn(struct subchannel *sch, void *data)
853 + rc = css_evaluate_known_subchannel(sch, 1);
854 + if (rc == -EAGAIN)
855 + css_schedule_eval(sch->schid);
856 ++ /*
857 ++ * The loop might take long time for platforms with lots of
858 ++ * known devices. Allow scheduling here.
859 ++ */
860 ++ cond_resched();
861 + }
862 + return 0;
863 + }
864 +diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
865 +index 3bc610d160f57..53afdbe17d71d 100644
866 +--- a/drivers/scsi/fcoe/fcoe_ctlr.c
867 ++++ b/drivers/scsi/fcoe/fcoe_ctlr.c
868 +@@ -264,9 +264,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
869 + WARN_ON(!fcf_dev);
870 + new->fcf_dev = NULL;
871 + fcoe_fcf_device_delete(fcf_dev);
872 +- kfree(new);
873 + mutex_unlock(&cdev->lock);
874 + }
875 ++ kfree(new);
876 + }
877 +
878 + /**
879 +diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
880 +index 861c57bc4520a..72248712949e0 100644
881 +--- a/drivers/scsi/lpfc/lpfc_vport.c
882 ++++ b/drivers/scsi/lpfc/lpfc_vport.c
883 +@@ -615,27 +615,16 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
884 + vport->port_state < LPFC_VPORT_READY)
885 + return -EAGAIN;
886 + }
887 ++
888 + /*
889 +- * This is a bit of a mess. We want to ensure the shost doesn't get
890 +- * torn down until we're done with the embedded lpfc_vport structure.
891 +- *
892 +- * Beyond holding a reference for this function, we also need a
893 +- * reference for outstanding I/O requests we schedule during delete
894 +- * processing. But once we scsi_remove_host() we can no longer obtain
895 +- * a reference through scsi_host_get().
896 +- *
897 +- * So we take two references here. We release one reference at the
898 +- * bottom of the function -- after delinking the vport. And we
899 +- * release the other at the completion of the unreg_vpi that get's
900 +- * initiated after we've disposed of all other resources associated
901 +- * with the port.
902 ++ * Take early refcount for outstanding I/O requests we schedule during
903 ++ * delete processing for unreg_vpi. Always keep this before
904 ++ * scsi_remove_host() as we can no longer obtain a reference through
905 ++ * scsi_host_get() after scsi_host_remove as shost is set to SHOST_DEL.
906 + */
907 + if (!scsi_host_get(shost))
908 + return VPORT_INVAL;
909 +- if (!scsi_host_get(shost)) {
910 +- scsi_host_put(shost);
911 +- return VPORT_INVAL;
912 +- }
913 ++
914 + lpfc_free_sysfs_attr(vport);
915 +
916 + lpfc_debugfs_terminate(vport);
917 +@@ -783,8 +772,9 @@ skip_logo:
918 + if (!(vport->vpi_state & LPFC_VPI_REGISTERED) ||
919 + lpfc_mbx_unreg_vpi(vport))
920 + scsi_host_put(shost);
921 +- } else
922 ++ } else {
923 + scsi_host_put(shost);
924 ++ }
925 +
926 + lpfc_free_vpi(phba, vport->vpi);
927 + vport->work_port_events = 0;
928 +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
929 +index de10b461ec7ef..4903640316480 100644
930 +--- a/drivers/scsi/scsi_transport_iscsi.c
931 ++++ b/drivers/scsi/scsi_transport_iscsi.c
932 +@@ -3192,7 +3192,7 @@ static int iscsi_set_flashnode_param(struct iscsi_transport *transport,
933 + pr_err("%s could not find host no %u\n",
934 + __func__, ev->u.set_flashnode.host_no);
935 + err = -ENODEV;
936 +- goto put_host;
937 ++ goto exit_set_fnode;
938 + }
939 +
940 + idx = ev->u.set_flashnode.flashnode_idx;
941 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
942 +index d15cd7a02f9b4..d7a0a64f64536 100644
943 +--- a/drivers/scsi/ufs/ufshcd.c
944 ++++ b/drivers/scsi/ufs/ufshcd.c
945 +@@ -575,6 +575,7 @@ unblock_reqs:
946 + int ufshcd_hold(struct ufs_hba *hba, bool async)
947 + {
948 + int rc = 0;
949 ++ bool flush_result;
950 + unsigned long flags;
951 +
952 + if (!ufshcd_is_clkgating_allowed(hba))
953 +@@ -601,7 +602,9 @@ start:
954 + break;
955 + }
956 + spin_unlock_irqrestore(hba->host->host_lock, flags);
957 +- flush_work(&hba->clk_gating.ungate_work);
958 ++ flush_result = flush_work(&hba->clk_gating.ungate_work);
959 ++ if (hba->clk_gating.is_suspended && !flush_result)
960 ++ goto out;
961 + spin_lock_irqsave(hba->host->host_lock, flags);
962 + goto start;
963 + }
964 +diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
965 +index c43c942e1f876..bccde58bc5e30 100644
966 +--- a/drivers/target/target_core_user.c
967 ++++ b/drivers/target/target_core_user.c
968 +@@ -590,7 +590,14 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
969 + struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned;
970 + struct tcmu_cmd *cmd;
971 +
972 +- tcmu_flush_dcache_range(entry, sizeof(*entry));
973 ++ /*
974 ++ * Flush max. up to end of cmd ring since current entry might
975 ++ * be a padding that is shorter than sizeof(*entry)
976 ++ */
977 ++ size_t ring_left = head_to_end(udev->cmdr_last_cleaned,
978 ++ udev->cmdr_size);
979 ++ tcmu_flush_dcache_range(entry, ring_left < sizeof(*entry) ?
980 ++ ring_left : sizeof(*entry));
981 +
982 + if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) {
983 + UPDATE_HEAD(udev->cmdr_last_cleaned,
984 +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
985 +index d42d66b72d5a8..fef1b9335f604 100644
986 +--- a/drivers/tty/serial/8250/8250_port.c
987 ++++ b/drivers/tty/serial/8250/8250_port.c
988 +@@ -1902,6 +1902,10 @@ int serial8250_do_startup(struct uart_port *port)
989 +
990 + if (port->irq) {
991 + unsigned char iir1;
992 ++
993 ++ if (port->irqflags & IRQF_SHARED)
994 ++ disable_irq_nosync(port->irq);
995 ++
996 + /*
997 + * Test for UARTs that do not reassert THRE when the
998 + * transmitter is idle and the interrupt has already
999 +@@ -1911,8 +1915,6 @@ int serial8250_do_startup(struct uart_port *port)
1000 + * allow register changes to become visible.
1001 + */
1002 + spin_lock_irqsave(&port->lock, flags);
1003 +- if (up->port.irqflags & IRQF_SHARED)
1004 +- disable_irq_nosync(port->irq);
1005 +
1006 + wait_for_xmitr(up, UART_LSR_THRE);
1007 + serial_port_out_sync(port, UART_IER, UART_IER_THRI);
1008 +@@ -1924,9 +1926,10 @@ int serial8250_do_startup(struct uart_port *port)
1009 + iir = serial_port_in(port, UART_IIR);
1010 + serial_port_out(port, UART_IER, 0);
1011 +
1012 ++ spin_unlock_irqrestore(&port->lock, flags);
1013 ++
1014 + if (port->irqflags & IRQF_SHARED)
1015 + enable_irq(port->irq);
1016 +- spin_unlock_irqrestore(&port->lock, flags);
1017 +
1018 + /*
1019 + * If the interrupt is not reasserted, or we otherwise
1020 +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
1021 +index c5da46f7b9093..562f2a40e083c 100644
1022 +--- a/drivers/tty/serial/amba-pl011.c
1023 ++++ b/drivers/tty/serial/amba-pl011.c
1024 +@@ -2332,7 +2332,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
1025 +
1026 + static int pl011_register_port(struct uart_amba_port *uap)
1027 + {
1028 +- int ret;
1029 ++ int ret, i;
1030 +
1031 + /* Ensure interrupts from this UART are masked and cleared */
1032 + writew(0, uap->port.membase + UART011_IMSC);
1033 +@@ -2343,6 +2343,9 @@ static int pl011_register_port(struct uart_amba_port *uap)
1034 + if (ret < 0) {
1035 + dev_err(uap->port.dev,
1036 + "Failed to register AMBA-PL011 driver\n");
1037 ++ for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
1038 ++ if (amba_ports[i] == uap)
1039 ++ amba_ports[i] = NULL;
1040 + return ret;
1041 + }
1042 + }
1043 +diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
1044 +index 8d485f82443ed..70a51d0bc6044 100644
1045 +--- a/drivers/tty/serial/samsung.c
1046 ++++ b/drivers/tty/serial/samsung.c
1047 +@@ -1719,9 +1719,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1048 + ourport->tx_irq = ret + 1;
1049 + }
1050 +
1051 +- ret = platform_get_irq(platdev, 1);
1052 +- if (ret > 0)
1053 +- ourport->tx_irq = ret;
1054 ++ if (!s3c24xx_serial_has_interrupt_mask(port)) {
1055 ++ ret = platform_get_irq(platdev, 1);
1056 ++ if (ret > 0)
1057 ++ ourport->tx_irq = ret;
1058 ++ }
1059 + /*
1060 + * DMA is currently supported only on DT platforms, if DMA properties
1061 + * are specified.
1062 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1063 +index 4785ae061b659..0e4f54832fc79 100644
1064 +--- a/drivers/tty/vt/vt.c
1065 ++++ b/drivers/tty/vt/vt.c
1066 +@@ -864,7 +864,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
1067 + unsigned int old_rows, old_row_size;
1068 + unsigned int new_cols, new_rows, new_row_size, new_screen_size;
1069 + unsigned int user;
1070 +- unsigned short *newscreen;
1071 ++ unsigned short *oldscreen, *newscreen;
1072 +
1073 + WARN_CONSOLE_UNLOCKED();
1074 +
1075 +@@ -946,10 +946,11 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
1076 + if (new_scr_end > new_origin)
1077 + scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
1078 + new_scr_end - new_origin);
1079 +- kfree(vc->vc_screenbuf);
1080 ++ oldscreen = vc->vc_screenbuf;
1081 + vc->vc_screenbuf = newscreen;
1082 + vc->vc_screenbuf_size = new_screen_size;
1083 + set_origin(vc);
1084 ++ kfree(oldscreen);
1085 +
1086 + /* do part of a reset_terminal() */
1087 + vc->vc_top = 0;
1088 +diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
1089 +index 9353789e43372..b0f0771a57298 100644
1090 +--- a/drivers/tty/vt/vt_ioctl.c
1091 ++++ b/drivers/tty/vt/vt_ioctl.c
1092 +@@ -896,12 +896,22 @@ int vt_ioctl(struct tty_struct *tty,
1093 + console_lock();
1094 + vcp = vc_cons[i].d;
1095 + if (vcp) {
1096 ++ int ret;
1097 ++ int save_scan_lines = vcp->vc_scan_lines;
1098 ++ int save_font_height = vcp->vc_font.height;
1099 ++
1100 + if (v.v_vlin)
1101 + vcp->vc_scan_lines = v.v_vlin;
1102 + if (v.v_clin)
1103 + vcp->vc_font.height = v.v_clin;
1104 + vcp->vc_resize_user = 1;
1105 +- vc_resize(vcp, v.v_cols, v.v_rows);
1106 ++ ret = vc_resize(vcp, v.v_cols, v.v_rows);
1107 ++ if (ret) {
1108 ++ vcp->vc_scan_lines = save_scan_lines;
1109 ++ vcp->vc_font.height = save_font_height;
1110 ++ console_unlock();
1111 ++ return ret;
1112 ++ }
1113 + }
1114 + console_unlock();
1115 + }
1116 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1117 +index e6e0f786547bf..eed7c8d8e3d4f 100644
1118 +--- a/drivers/usb/core/quirks.c
1119 ++++ b/drivers/usb/core/quirks.c
1120 +@@ -299,6 +299,8 @@ static const struct usb_device_id usb_quirk_list[] = {
1121 +
1122 + { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
1123 +
1124 ++ { USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM },
1125 ++
1126 + /* DJI CineSSD */
1127 + { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
1128 +
1129 +diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
1130 +index 6865b919403f7..2ed062a2e93b4 100644
1131 +--- a/drivers/usb/host/ohci-exynos.c
1132 ++++ b/drivers/usb/host/ohci-exynos.c
1133 +@@ -166,9 +166,8 @@ skip_phy:
1134 + hcd->rsrc_len = resource_size(res);
1135 +
1136 + irq = platform_get_irq(pdev, 0);
1137 +- if (!irq) {
1138 +- dev_err(&pdev->dev, "Failed to get IRQ\n");
1139 +- err = -ENODEV;
1140 ++ if (irq < 0) {
1141 ++ err = irq;
1142 + goto fail_io;
1143 + }
1144 +
1145 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
1146 +index 3ef80c2c0dcc1..6891738278bcb 100644
1147 +--- a/drivers/usb/host/xhci-hub.c
1148 ++++ b/drivers/usb/host/xhci-hub.c
1149 +@@ -599,15 +599,6 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
1150 + {
1151 + u32 pls = status_reg & PORT_PLS_MASK;
1152 +
1153 +- /* resume state is a xHCI internal state.
1154 +- * Do not report it to usb core, instead, pretend to be U3,
1155 +- * thus usb core knows it's not ready for transfer
1156 +- */
1157 +- if (pls == XDEV_RESUME) {
1158 +- *status |= USB_SS_PORT_LS_U3;
1159 +- return;
1160 +- }
1161 +-
1162 + /* When the CAS bit is set then warm reset
1163 + * should be performed on port
1164 + */
1165 +@@ -629,6 +620,16 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
1166 + */
1167 + pls |= USB_PORT_STAT_CONNECTION;
1168 + } else {
1169 ++ /*
1170 ++ * Resume state is an xHCI internal state. Do not report it to
1171 ++ * usb core, instead, pretend to be U3, thus usb core knows
1172 ++ * it's not ready for transfer.
1173 ++ */
1174 ++ if (pls == XDEV_RESUME) {
1175 ++ *status |= USB_SS_PORT_LS_U3;
1176 ++ return;
1177 ++ }
1178 ++
1179 + /*
1180 + * If CAS bit isn't set but the Port is already at
1181 + * Compliance Mode, fake a connection so the USB core
1182 +diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
1183 +index 383fa007348f4..bda82e63c1a93 100644
1184 +--- a/drivers/usb/misc/lvstest.c
1185 ++++ b/drivers/usb/misc/lvstest.c
1186 +@@ -396,7 +396,7 @@ static int lvs_rh_probe(struct usb_interface *intf,
1187 + USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT);
1188 + if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) {
1189 + dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret);
1190 +- return ret;
1191 ++ return ret < 0 ? ret : -EINVAL;
1192 + }
1193 +
1194 + /* submit urb to poll interrupt endpoint */
1195 +diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
1196 +index 22da70fada5e5..971f1165dc4bb 100644
1197 +--- a/drivers/usb/misc/sisusbvga/sisusb.c
1198 ++++ b/drivers/usb/misc/sisusbvga/sisusb.c
1199 +@@ -790,7 +790,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
1200 + u8 swap8, fromkern = kernbuffer ? 1 : 0;
1201 + u16 swap16;
1202 + u32 swap32, flag = (length >> 28) & 1;
1203 +- char buf[4];
1204 ++ u8 buf[4];
1205 +
1206 + /* if neither kernbuffer not userbuffer are given, assume
1207 + * data in obuf
1208 +diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
1209 +index 44c6ced5d4422..b17aeaafbb7c3 100644
1210 +--- a/drivers/usb/misc/yurex.c
1211 ++++ b/drivers/usb/misc/yurex.c
1212 +@@ -510,7 +510,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
1213 + prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
1214 + dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
1215 + dev->cntl_buffer[0]);
1216 +- retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
1217 ++ retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
1218 + if (retval >= 0)
1219 + timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
1220 + finish_wait(&dev->waitq, &wait);
1221 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1222 +index ccf2d50e0d2e3..2c2ac15d25549 100644
1223 +--- a/drivers/usb/storage/unusual_devs.h
1224 ++++ b/drivers/usb/storage/unusual_devs.h
1225 +@@ -2213,7 +2213,7 @@ UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114,
1226 + "JMicron",
1227 + "USB to ATA/ATAPI Bridge",
1228 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1229 +- US_FL_BROKEN_FUA ),
1230 ++ US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ),
1231 +
1232 + /* Reported by Andrey Rahmatullin <wrar@××××××××.org> */
1233 + UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100,
1234 +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
1235 +index cb0af57aad6eb..b7171c19fca20 100644
1236 +--- a/drivers/usb/storage/unusual_uas.h
1237 ++++ b/drivers/usb/storage/unusual_uas.h
1238 +@@ -40,6 +40,13 @@
1239 + * and don't forget to CC: the USB development list <linux-usb@×××××××××××.org>
1240 + */
1241 +
1242 ++/* Reported-by: Till Dörges <doerges@×××××××××.de> */
1243 ++UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
1244 ++ "Sony",
1245 ++ "PSZ-HA*",
1246 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1247 ++ US_FL_NO_REPORT_OPCODES),
1248 ++
1249 + /* Reported-by: Julian Groß <julian.g@××××××.de> */
1250 + UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
1251 + "LaCie",
1252 +@@ -155,6 +162,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
1253 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1254 + US_FL_BROKEN_FUA),
1255 +
1256 ++/* Reported-by: Thinh Nguyen <thinhn@××××××××.com> */
1257 ++UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999,
1258 ++ "PNY",
1259 ++ "Pro Elite SSD",
1260 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1261 ++ US_FL_NO_ATA_1X),
1262 ++
1263 + /* Reported-by: Hans de Goede <hdegoede@××××××.com> */
1264 + UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
1265 + "VIA",
1266 +diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
1267 +index c03c5b9602bb3..fe0663787b3c9 100644
1268 +--- a/drivers/video/console/fbcon.c
1269 ++++ b/drivers/video/console/fbcon.c
1270 +@@ -2117,6 +2117,9 @@ static void updatescrollmode(struct display *p,
1271 + }
1272 + }
1273 +
1274 ++#define PITCH(w) (((w) + 7) >> 3)
1275 ++#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */
1276 ++
1277 + static int fbcon_resize(struct vc_data *vc, unsigned int width,
1278 + unsigned int height, unsigned int user)
1279 + {
1280 +@@ -2126,6 +2129,24 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
1281 + struct fb_var_screeninfo var = info->var;
1282 + int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
1283 +
1284 ++ if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {
1285 ++ int size;
1286 ++ int pitch = PITCH(vc->vc_font.width);
1287 ++
1288 ++ /*
1289 ++ * If user font, ensure that a possible change to user font
1290 ++ * height or width will not allow a font data out-of-bounds access.
1291 ++ * NOTE: must use original charcount in calculation as font
1292 ++ * charcount can change and cannot be used to determine the
1293 ++ * font data allocated size.
1294 ++ */
1295 ++ if (pitch <= 0)
1296 ++ return -EINVAL;
1297 ++ size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data));
1298 ++ if (size > FNTSIZE(vc->vc_font.data))
1299 ++ return -EINVAL;
1300 ++ }
1301 ++
1302 + virt_w = FBCON_SWAP(ops->rotate, width, height);
1303 + virt_h = FBCON_SWAP(ops->rotate, height, width);
1304 + virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
1305 +@@ -2587,7 +2608,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
1306 + int size;
1307 + int i, csum;
1308 + u8 *new_data, *data = font->data;
1309 +- int pitch = (font->width+7) >> 3;
1310 ++ int pitch = PITCH(font->width);
1311 +
1312 + /* Is there a reason why fbconsole couldn't handle any charcount >256?
1313 + * If not this check should be changed to charcount < 256 */
1314 +@@ -2603,7 +2624,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
1315 + if (fbcon_invalid_charcount(info, charcount))
1316 + return -EINVAL;
1317 +
1318 +- size = h * pitch * charcount;
1319 ++ size = CALC_FONTSZ(h, pitch, charcount);
1320 +
1321 + new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
1322 +
1323 +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
1324 +index 878a40950a3a1..e4dd991e2888b 100644
1325 +--- a/drivers/xen/events/events_base.c
1326 ++++ b/drivers/xen/events/events_base.c
1327 +@@ -155,7 +155,7 @@ int get_evtchn_to_irq(unsigned evtchn)
1328 + /* Get info for IRQ */
1329 + struct irq_info *info_for_irq(unsigned irq)
1330 + {
1331 +- return irq_get_handler_data(irq);
1332 ++ return irq_get_chip_data(irq);
1333 + }
1334 +
1335 + /* Constructors for packed IRQ information. */
1336 +@@ -384,7 +384,7 @@ static void xen_irq_init(unsigned irq)
1337 + info->type = IRQT_UNBOUND;
1338 + info->refcnt = -1;
1339 +
1340 +- irq_set_handler_data(irq, info);
1341 ++ irq_set_chip_data(irq, info);
1342 +
1343 + list_add_tail(&info->list, &xen_irq_list_head);
1344 + }
1345 +@@ -433,14 +433,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
1346 +
1347 + static void xen_free_irq(unsigned irq)
1348 + {
1349 +- struct irq_info *info = irq_get_handler_data(irq);
1350 ++ struct irq_info *info = irq_get_chip_data(irq);
1351 +
1352 + if (WARN_ON(!info))
1353 + return;
1354 +
1355 + list_del(&info->list);
1356 +
1357 +- irq_set_handler_data(irq, NULL);
1358 ++ irq_set_chip_data(irq, NULL);
1359 +
1360 + WARN_ON(info->refcnt > 0);
1361 +
1362 +@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
1363 + static void __unbind_from_irq(unsigned int irq)
1364 + {
1365 + int evtchn = evtchn_from_irq(irq);
1366 +- struct irq_info *info = irq_get_handler_data(irq);
1367 ++ struct irq_info *info = irq_get_chip_data(irq);
1368 +
1369 + if (info->refcnt > 0) {
1370 + info->refcnt--;
1371 +@@ -1114,7 +1114,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
1372 +
1373 + void unbind_from_irqhandler(unsigned int irq, void *dev_id)
1374 + {
1375 +- struct irq_info *info = irq_get_handler_data(irq);
1376 ++ struct irq_info *info = irq_get_chip_data(irq);
1377 +
1378 + if (WARN_ON(!info))
1379 + return;
1380 +@@ -1148,7 +1148,7 @@ int evtchn_make_refcounted(unsigned int evtchn)
1381 + if (irq == -1)
1382 + return -ENOENT;
1383 +
1384 +- info = irq_get_handler_data(irq);
1385 ++ info = irq_get_chip_data(irq);
1386 +
1387 + if (!info)
1388 + return -ENOENT;
1389 +@@ -1176,7 +1176,7 @@ int evtchn_get(unsigned int evtchn)
1390 + if (irq == -1)
1391 + goto done;
1392 +
1393 +- info = irq_get_handler_data(irq);
1394 ++ info = irq_get_chip_data(irq);
1395 +
1396 + if (!info)
1397 + goto done;
1398 +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
1399 +index 820d3b5bc4150..8f0f91de436d5 100644
1400 +--- a/fs/btrfs/tree-log.c
1401 ++++ b/fs/btrfs/tree-log.c
1402 +@@ -3169,11 +3169,13 @@ fail:
1403 + btrfs_free_path(path);
1404 + out_unlock:
1405 + mutex_unlock(&BTRFS_I(dir)->log_mutex);
1406 +- if (ret == -ENOSPC) {
1407 ++ if (err == -ENOSPC) {
1408 + btrfs_set_log_full_commit(root->fs_info, trans);
1409 +- ret = 0;
1410 +- } else if (ret < 0)
1411 +- btrfs_abort_transaction(trans, root, ret);
1412 ++ err = 0;
1413 ++ } else if (err < 0 && err != -ENOENT) {
1414 ++ /* ENOENT can be returned if the entry hasn't been fsynced yet */
1415 ++ btrfs_abort_transaction(trans, root, err);
1416 ++ }
1417 +
1418 + btrfs_end_log_trans(root);
1419 +
1420 +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
1421 +index a5de8e22629ba..b7fd7d69be075 100644
1422 +--- a/fs/ceph/mds_client.c
1423 ++++ b/fs/ceph/mds_client.c
1424 +@@ -3428,6 +3428,9 @@ static void delayed_work(struct work_struct *work)
1425 + dout("mdsc delayed_work\n");
1426 + ceph_check_delayed_caps(mdsc);
1427 +
1428 ++ if (mdsc->stopping)
1429 ++ return;
1430 ++
1431 + mutex_lock(&mdsc->mutex);
1432 + renew_interval = mdsc->mdsmap->m_session_timeout >> 2;
1433 + renew_caps = time_after_eq(jiffies, HZ*renew_interval +
1434 +@@ -3752,7 +3755,16 @@ void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc)
1435 + static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
1436 + {
1437 + dout("stop\n");
1438 +- cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */
1439 ++ /*
1440 ++ * Make sure the delayed work stopped before releasing
1441 ++ * the resources.
1442 ++ *
1443 ++ * Because the cancel_delayed_work_sync() will only
1444 ++ * guarantee that the work finishes executing. But the
1445 ++ * delayed work will re-arm itself again after that.
1446 ++ */
1447 ++ flush_delayed_work(&mdsc->delayed_work);
1448 ++
1449 + if (mdsc->mdsmap)
1450 + ceph_mdsmap_destroy(mdsc->mdsmap);
1451 + kfree(mdsc->sessions);
1452 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
1453 +index a2a2405571ccc..66a9c9dab8316 100644
1454 +--- a/fs/fs-writeback.c
1455 ++++ b/fs/fs-writeback.c
1456 +@@ -45,7 +45,6 @@ struct wb_completion {
1457 + struct wb_writeback_work {
1458 + long nr_pages;
1459 + struct super_block *sb;
1460 +- unsigned long *older_than_this;
1461 + enum writeback_sync_modes sync_mode;
1462 + unsigned int tagged_writepages:1;
1463 + unsigned int for_kupdate:1;
1464 +@@ -160,7 +159,9 @@ static void inode_io_list_del_locked(struct inode *inode,
1465 + struct bdi_writeback *wb)
1466 + {
1467 + assert_spin_locked(&wb->list_lock);
1468 ++ assert_spin_locked(&inode->i_lock);
1469 +
1470 ++ inode->i_state &= ~I_SYNC_QUEUED;
1471 + list_del_init(&inode->i_io_list);
1472 + wb_io_lists_depopulated(wb);
1473 + }
1474 +@@ -1034,7 +1035,9 @@ void inode_io_list_del(struct inode *inode)
1475 + struct bdi_writeback *wb;
1476 +
1477 + wb = inode_to_wb_and_lock_list(inode);
1478 ++ spin_lock(&inode->i_lock);
1479 + inode_io_list_del_locked(inode, wb);
1480 ++ spin_unlock(&inode->i_lock);
1481 + spin_unlock(&wb->list_lock);
1482 + }
1483 +
1484 +@@ -1047,8 +1050,10 @@ void inode_io_list_del(struct inode *inode)
1485 + * the case then the inode must have been redirtied while it was being written
1486 + * out and we don't reset its dirtied_when.
1487 + */
1488 +-static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
1489 ++static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb)
1490 + {
1491 ++ assert_spin_locked(&inode->i_lock);
1492 ++
1493 + if (!list_empty(&wb->b_dirty)) {
1494 + struct inode *tail;
1495 +
1496 +@@ -1057,6 +1062,14 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
1497 + inode->dirtied_when = jiffies;
1498 + }
1499 + inode_io_list_move_locked(inode, wb, &wb->b_dirty);
1500 ++ inode->i_state &= ~I_SYNC_QUEUED;
1501 ++}
1502 ++
1503 ++static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
1504 ++{
1505 ++ spin_lock(&inode->i_lock);
1506 ++ redirty_tail_locked(inode, wb);
1507 ++ spin_unlock(&inode->i_lock);
1508 + }
1509 +
1510 + /*
1511 +@@ -1095,16 +1108,13 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
1512 + #define EXPIRE_DIRTY_ATIME 0x0001
1513 +
1514 + /*
1515 +- * Move expired (dirtied before work->older_than_this) dirty inodes from
1516 ++ * Move expired (dirtied before dirtied_before) dirty inodes from
1517 + * @delaying_queue to @dispatch_queue.
1518 + */
1519 + static int move_expired_inodes(struct list_head *delaying_queue,
1520 + struct list_head *dispatch_queue,
1521 +- int flags,
1522 +- struct wb_writeback_work *work)
1523 ++ int flags, unsigned long dirtied_before)
1524 + {
1525 +- unsigned long *older_than_this = NULL;
1526 +- unsigned long expire_time;
1527 + LIST_HEAD(tmp);
1528 + struct list_head *pos, *node;
1529 + struct super_block *sb = NULL;
1530 +@@ -1112,21 +1122,17 @@ static int move_expired_inodes(struct list_head *delaying_queue,
1531 + int do_sb_sort = 0;
1532 + int moved = 0;
1533 +
1534 +- if ((flags & EXPIRE_DIRTY_ATIME) == 0)
1535 +- older_than_this = work->older_than_this;
1536 +- else if (!work->for_sync) {
1537 +- expire_time = jiffies - (dirtytime_expire_interval * HZ);
1538 +- older_than_this = &expire_time;
1539 +- }
1540 + while (!list_empty(delaying_queue)) {
1541 + inode = wb_inode(delaying_queue->prev);
1542 +- if (older_than_this &&
1543 +- inode_dirtied_after(inode, *older_than_this))
1544 ++ if (inode_dirtied_after(inode, dirtied_before))
1545 + break;
1546 + list_move(&inode->i_io_list, &tmp);
1547 + moved++;
1548 ++ spin_lock(&inode->i_lock);
1549 + if (flags & EXPIRE_DIRTY_ATIME)
1550 +- set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
1551 ++ inode->i_state |= I_DIRTY_TIME_EXPIRED;
1552 ++ inode->i_state |= I_SYNC_QUEUED;
1553 ++ spin_unlock(&inode->i_lock);
1554 + if (sb_is_blkdev_sb(inode->i_sb))
1555 + continue;
1556 + if (sb && sb != inode->i_sb)
1557 +@@ -1164,18 +1170,22 @@ out:
1558 + * |
1559 + * +--> dequeue for IO
1560 + */
1561 +-static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
1562 ++static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work,
1563 ++ unsigned long dirtied_before)
1564 + {
1565 + int moved;
1566 ++ unsigned long time_expire_jif = dirtied_before;
1567 +
1568 + assert_spin_locked(&wb->list_lock);
1569 + list_splice_init(&wb->b_more_io, &wb->b_io);
1570 +- moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, work);
1571 ++ moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before);
1572 ++ if (!work->for_sync)
1573 ++ time_expire_jif = jiffies - dirtytime_expire_interval * HZ;
1574 + moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
1575 +- EXPIRE_DIRTY_ATIME, work);
1576 ++ EXPIRE_DIRTY_ATIME, time_expire_jif);
1577 + if (moved)
1578 + wb_io_lists_populated(wb);
1579 +- trace_writeback_queue_io(wb, work, moved);
1580 ++ trace_writeback_queue_io(wb, work, dirtied_before, moved);
1581 + }
1582 +
1583 + static int write_inode(struct inode *inode, struct writeback_control *wbc)
1584 +@@ -1269,7 +1279,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
1585 + * writeback is not making progress due to locked
1586 + * buffers. Skip this inode for now.
1587 + */
1588 +- redirty_tail(inode, wb);
1589 ++ redirty_tail_locked(inode, wb);
1590 + return;
1591 + }
1592 +
1593 +@@ -1289,7 +1299,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
1594 + * retrying writeback of the dirty page/inode
1595 + * that cannot be performed immediately.
1596 + */
1597 +- redirty_tail(inode, wb);
1598 ++ redirty_tail_locked(inode, wb);
1599 + }
1600 + } else if (inode->i_state & I_DIRTY) {
1601 + /*
1602 +@@ -1297,10 +1307,11 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
1603 + * such as delayed allocation during submission or metadata
1604 + * updates after data IO completion.
1605 + */
1606 +- redirty_tail(inode, wb);
1607 ++ redirty_tail_locked(inode, wb);
1608 + } else if (inode->i_state & I_DIRTY_TIME) {
1609 + inode->dirtied_when = jiffies;
1610 + inode_io_list_move_locked(inode, wb, &wb->b_dirty_time);
1611 ++ inode->i_state &= ~I_SYNC_QUEUED;
1612 + } else {
1613 + /* The inode is clean. Remove from writeback lists. */
1614 + inode_io_list_del_locked(inode, wb);
1615 +@@ -1543,8 +1554,8 @@ static long writeback_sb_inodes(struct super_block *sb,
1616 + */
1617 + spin_lock(&inode->i_lock);
1618 + if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
1619 ++ redirty_tail_locked(inode, wb);
1620 + spin_unlock(&inode->i_lock);
1621 +- redirty_tail(inode, wb);
1622 + continue;
1623 + }
1624 + if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) {
1625 +@@ -1685,7 +1696,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
1626 + blk_start_plug(&plug);
1627 + spin_lock(&wb->list_lock);
1628 + if (list_empty(&wb->b_io))
1629 +- queue_io(wb, &work);
1630 ++ queue_io(wb, &work, jiffies);
1631 + __writeback_inodes_wb(wb, &work);
1632 + spin_unlock(&wb->list_lock);
1633 + blk_finish_plug(&plug);
1634 +@@ -1705,7 +1716,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
1635 + * takes longer than a dirty_writeback_interval interval, then leave a
1636 + * one-second gap.
1637 + *
1638 +- * older_than_this takes precedence over nr_to_write. So we'll only write back
1639 ++ * dirtied_before takes precedence over nr_to_write. So we'll only write back
1640 + * all dirty pages if they are all attached to "old" mappings.
1641 + */
1642 + static long wb_writeback(struct bdi_writeback *wb,
1643 +@@ -1713,14 +1724,11 @@ static long wb_writeback(struct bdi_writeback *wb,
1644 + {
1645 + unsigned long wb_start = jiffies;
1646 + long nr_pages = work->nr_pages;
1647 +- unsigned long oldest_jif;
1648 ++ unsigned long dirtied_before = jiffies;
1649 + struct inode *inode;
1650 + long progress;
1651 + struct blk_plug plug;
1652 +
1653 +- oldest_jif = jiffies;
1654 +- work->older_than_this = &oldest_jif;
1655 +-
1656 + blk_start_plug(&plug);
1657 + spin_lock(&wb->list_lock);
1658 + for (;;) {
1659 +@@ -1754,14 +1762,14 @@ static long wb_writeback(struct bdi_writeback *wb,
1660 + * safe.
1661 + */
1662 + if (work->for_kupdate) {
1663 +- oldest_jif = jiffies -
1664 ++ dirtied_before = jiffies -
1665 + msecs_to_jiffies(dirty_expire_interval * 10);
1666 + } else if (work->for_background)
1667 +- oldest_jif = jiffies;
1668 ++ dirtied_before = jiffies;
1669 +
1670 + trace_writeback_start(wb, work);
1671 + if (list_empty(&wb->b_io))
1672 +- queue_io(wb, work);
1673 ++ queue_io(wb, work, dirtied_before);
1674 + if (work->sb)
1675 + progress = writeback_sb_inodes(work->sb, wb, work);
1676 + else
1677 +@@ -2128,11 +2136,12 @@ void __mark_inode_dirty(struct inode *inode, int flags)
1678 + inode->i_state |= flags;
1679 +
1680 + /*
1681 +- * If the inode is being synced, just update its dirty state.
1682 +- * The unlocker will place the inode on the appropriate
1683 +- * superblock list, based upon its state.
1684 ++ * If the inode is queued for writeback by flush worker, just
1685 ++ * update its dirty state. Once the flush worker is done with
1686 ++ * the inode it will place it on the appropriate superblock
1687 ++ * list, based upon its state.
1688 + */
1689 +- if (inode->i_state & I_SYNC)
1690 ++ if (inode->i_state & I_SYNC_QUEUED)
1691 + goto out_unlock_inode;
1692 +
1693 + /*
1694 +diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
1695 +index 3233e5ac9774f..ce2bf9d74224c 100644
1696 +--- a/fs/jbd2/transaction.c
1697 ++++ b/fs/jbd2/transaction.c
1698 +@@ -1906,6 +1906,9 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh)
1699 + */
1700 + static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
1701 + {
1702 ++ J_ASSERT_JH(jh, jh->b_transaction != NULL);
1703 ++ J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
1704 ++
1705 + __jbd2_journal_temp_unlink_buffer(jh);
1706 + jh->b_transaction = NULL;
1707 + jbd2_journal_put_journal_head(jh);
1708 +@@ -1997,6 +2000,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
1709 + {
1710 + struct buffer_head *head;
1711 + struct buffer_head *bh;
1712 ++ bool has_write_io_error = false;
1713 + int ret = 0;
1714 +
1715 + J_ASSERT(PageLocked(page));
1716 +@@ -2021,11 +2025,26 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
1717 + jbd_unlock_bh_state(bh);
1718 + if (buffer_jbd(bh))
1719 + goto busy;
1720 ++
1721 ++ /*
1722 ++ * If we free a metadata buffer which has been failed to
1723 ++ * write out, the jbd2 checkpoint procedure will not detect
1724 ++ * this failure and may lead to filesystem inconsistency
1725 ++ * after cleanup journal tail.
1726 ++ */
1727 ++ if (buffer_write_io_error(bh)) {
1728 ++ pr_err("JBD2: Error while async write back metadata bh %llu.",
1729 ++ (unsigned long long)bh->b_blocknr);
1730 ++ has_write_io_error = true;
1731 ++ }
1732 + } while ((bh = bh->b_this_page) != head);
1733 +
1734 + ret = try_to_free_buffers(page);
1735 +
1736 + busy:
1737 ++ if (has_write_io_error)
1738 ++ jbd2_journal_abort(journal, -EIO);
1739 ++
1740 + return ret;
1741 + }
1742 +
1743 +@@ -2453,6 +2472,13 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh)
1744 +
1745 + was_dirty = test_clear_buffer_jbddirty(bh);
1746 + __jbd2_journal_temp_unlink_buffer(jh);
1747 ++
1748 ++ /*
1749 ++ * b_transaction must be set, otherwise the new b_transaction won't
1750 ++ * be holding jh reference
1751 ++ */
1752 ++ J_ASSERT_JH(jh, jh->b_transaction != NULL);
1753 ++
1754 + /*
1755 + * We set b_transaction here because b_next_transaction will inherit
1756 + * our jh reference and thus __jbd2_journal_file_buffer() must not
1757 +diff --git a/include/linux/fs.h b/include/linux/fs.h
1758 +index 842a6a28b0e89..cdcef9b3bc60a 100644
1759 +--- a/include/linux/fs.h
1760 ++++ b/include/linux/fs.h
1761 +@@ -1882,6 +1882,10 @@ struct super_operations {
1762 + * wb stat updates to grab mapping->tree_lock. See
1763 + * inode_switch_wb_work_fn() for details.
1764 + *
1765 ++ * I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists.
1766 ++ * Used to detect that mark_inode_dirty() should not move
1767 ++ * inode between dirty lists.
1768 ++ *
1769 + * Q: What is the difference between I_WILL_FREE and I_FREEING?
1770 + */
1771 + #define I_DIRTY_SYNC (1 << 0)
1772 +@@ -1899,9 +1903,9 @@ struct super_operations {
1773 + #define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
1774 + #define I_LINKABLE (1 << 10)
1775 + #define I_DIRTY_TIME (1 << 11)
1776 +-#define __I_DIRTY_TIME_EXPIRED 12
1777 +-#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED)
1778 ++#define I_DIRTY_TIME_EXPIRED (1 << 12)
1779 + #define I_WB_SWITCH (1 << 13)
1780 ++#define I_SYNC_QUEUED (1 << 17)
1781 +
1782 + #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1783 + #define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
1784 +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
1785 +index fff846b512e6e..2609b1c3549e2 100644
1786 +--- a/include/trace/events/writeback.h
1787 ++++ b/include/trace/events/writeback.h
1788 +@@ -390,8 +390,9 @@ DEFINE_WBC_EVENT(wbc_writepage);
1789 + TRACE_EVENT(writeback_queue_io,
1790 + TP_PROTO(struct bdi_writeback *wb,
1791 + struct wb_writeback_work *work,
1792 ++ unsigned long dirtied_before,
1793 + int moved),
1794 +- TP_ARGS(wb, work, moved),
1795 ++ TP_ARGS(wb, work, dirtied_before, moved),
1796 + TP_STRUCT__entry(
1797 + __array(char, name, 32)
1798 + __field(unsigned long, older)
1799 +@@ -401,19 +402,17 @@ TRACE_EVENT(writeback_queue_io,
1800 + __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb))
1801 + ),
1802 + TP_fast_assign(
1803 +- unsigned long *older_than_this = work->older_than_this;
1804 + strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
1805 +- __entry->older = older_than_this ? *older_than_this : 0;
1806 +- __entry->age = older_than_this ?
1807 +- (jiffies - *older_than_this) * 1000 / HZ : -1;
1808 ++ __entry->older = dirtied_before;
1809 ++ __entry->age = (jiffies - dirtied_before) * 1000 / HZ;
1810 + __entry->moved = moved;
1811 + __entry->reason = work->reason;
1812 + __trace_wb_assign_cgroup(__get_str(cgroup), wb);
1813 + ),
1814 + TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup=%s",
1815 + __entry->name,
1816 +- __entry->older, /* older_than_this in jiffies */
1817 +- __entry->age, /* older_than_this in relative milliseconds */
1818 ++ __entry->older, /* dirtied_before in jiffies */
1819 ++ __entry->age, /* dirtied_before in relative milliseconds */
1820 + __entry->moved,
1821 + __print_symbolic(__entry->reason, WB_WORK_REASON),
1822 + __get_str(cgroup)
1823 +diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
1824 +index 35b34eccdd109..9484f934aa349 100644
1825 +--- a/kernel/locking/lockdep_proc.c
1826 ++++ b/kernel/locking/lockdep_proc.c
1827 +@@ -423,7 +423,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt)
1828 + seq_time(m, lt->min);
1829 + seq_time(m, lt->max);
1830 + seq_time(m, lt->total);
1831 +- seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0);
1832 ++ seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0);
1833 + }
1834 +
1835 + static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
1836 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
1837 +index 4e944fe986271..e87ec3659ef61 100644
1838 +--- a/net/core/skbuff.c
1839 ++++ b/net/core/skbuff.c
1840 +@@ -4370,8 +4370,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
1841 + skb = skb_share_check(skb, GFP_ATOMIC);
1842 + if (unlikely(!skb))
1843 + goto err_free;
1844 +-
1845 +- if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
1846 ++ /* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
1847 ++ if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
1848 + goto err_free;
1849 +
1850 + vhdr = (struct vlan_hdr *)skb->data;
1851 +diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
1852 +index 8d2e54c4bda6b..0975a28f8686c 100644
1853 +--- a/net/tipc/netlink_compat.c
1854 ++++ b/net/tipc/netlink_compat.c
1855 +@@ -250,8 +250,9 @@ err_out:
1856 + static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
1857 + struct tipc_nl_compat_msg *msg)
1858 + {
1859 +- int err;
1860 ++ struct nlmsghdr *nlh;
1861 + struct sk_buff *arg;
1862 ++ int err;
1863 +
1864 + if (msg->req_type && (!msg->req_size ||
1865 + !TLV_CHECK_TYPE(msg->req, msg->req_type)))
1866 +@@ -280,6 +281,15 @@ static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
1867 + return -ENOMEM;
1868 + }
1869 +
1870 ++ nlh = nlmsg_put(arg, 0, 0, tipc_genl_family.id, 0, NLM_F_MULTI);
1871 ++ if (!nlh) {
1872 ++ kfree_skb(arg);
1873 ++ kfree_skb(msg->rep);
1874 ++ msg->rep = NULL;
1875 ++ return -EMSGSIZE;
1876 ++ }
1877 ++ nlmsg_end(arg, nlh);
1878 ++
1879 + err = __tipc_nl_compat_dumpit(cmd, msg, arg);
1880 + if (err) {
1881 + kfree_skb(msg->rep);
1882 +diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
1883 +index 2706f271a83b0..8a174c170e0aa 100644
1884 +--- a/sound/pci/cs46xx/cs46xx_lib.c
1885 ++++ b/sound/pci/cs46xx/cs46xx_lib.c
1886 +@@ -780,7 +780,7 @@ static void snd_cs46xx_set_capture_sample_rate(struct snd_cs46xx *chip, unsigned
1887 + rate = 48000 / 9;
1888 +
1889 + /*
1890 +- * We can not capture at at rate greater than the Input Rate (48000).
1891 ++ * We can not capture at a rate greater than the Input Rate (48000).
1892 + * Return an error if an attempt is made to stray outside that limit.
1893 + */
1894 + if (rate > 48000)
1895 +diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
1896 +index 7488e1b7a7707..4e726d39b05d1 100644
1897 +--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
1898 ++++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
1899 +@@ -1742,7 +1742,7 @@ int cs46xx_iec958_pre_open (struct snd_cs46xx *chip)
1900 + struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1901 +
1902 + if ( ins->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED ) {
1903 +- /* remove AsynchFGTxSCB and and PCMSerialInput_II */
1904 ++ /* remove AsynchFGTxSCB and PCMSerialInput_II */
1905 + cs46xx_dsp_disable_spdif_out (chip);
1906 +
1907 + /* save state */
1908 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
1909 +index 825d9b27dbe12..4962a9d8a572b 100644
1910 +--- a/sound/pci/hda/hda_codec.c
1911 ++++ b/sound/pci/hda/hda_codec.c
1912 +@@ -3496,7 +3496,7 @@ EXPORT_SYMBOL_GPL(snd_hda_set_power_save);
1913 + * @nid: NID to check / update
1914 + *
1915 + * Check whether the given NID is in the amp list. If it's in the list,
1916 +- * check the current AMP status, and update the the power-status according
1917 ++ * check the current AMP status, and update the power-status according
1918 + * to the mute status.
1919 + *
1920 + * This function is supposed to be set or called from the check_power_status
1921 +diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
1922 +index 869c322ddae31..7cd1047a4edf3 100644
1923 +--- a/sound/pci/hda/hda_generic.c
1924 ++++ b/sound/pci/hda/hda_generic.c
1925 +@@ -837,7 +837,7 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path,
1926 + }
1927 + }
1928 +
1929 +-/* sync power of each widget in the the given path */
1930 ++/* sync power of each widget in the given path */
1931 + static hda_nid_t path_power_update(struct hda_codec *codec,
1932 + struct nid_path *path,
1933 + bool allow_powerdown)
1934 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
1935 +index d1a6d20ace0da..80b72d0702c5e 100644
1936 +--- a/sound/pci/hda/patch_sigmatel.c
1937 ++++ b/sound/pci/hda/patch_sigmatel.c
1938 +@@ -862,7 +862,7 @@ static int stac_auto_create_beep_ctls(struct hda_codec *codec,
1939 + static struct snd_kcontrol_new beep_vol_ctl =
1940 + HDA_CODEC_VOLUME(NULL, 0, 0, 0);
1941 +
1942 +- /* check for mute support for the the amp */
1943 ++ /* check for mute support for the amp */
1944 + if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
1945 + const struct snd_kcontrol_new *temp;
1946 + if (spec->anabeep_nid == nid)
1947 +diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c
1948 +index 3919aed39ca03..5e52086d7b986 100644
1949 +--- a/sound/pci/ice1712/prodigy192.c
1950 ++++ b/sound/pci/ice1712/prodigy192.c
1951 +@@ -31,7 +31,7 @@
1952 + * Experimentally I found out that only a combination of
1953 + * OCKS0=1, OCKS1=1 (128fs, 64fs output) and ice1724 -
1954 + * VT1724_MT_I2S_MCLK_128X=0 (256fs input) yields correct
1955 +- * sampling rate. That means the the FPGA doubles the
1956 ++ * sampling rate. That means that the FPGA doubles the
1957 + * MCK01 rate.
1958 + *
1959 + * Copyright (c) 2003 Takashi Iwai <tiwai@××××.de>
1960 +diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
1961 +index 4cf3200e988b0..df44135e1b0c9 100644
1962 +--- a/sound/pci/oxygen/xonar_dg.c
1963 ++++ b/sound/pci/oxygen/xonar_dg.c
1964 +@@ -39,7 +39,7 @@
1965 + * GPIO 4 <- headphone detect
1966 + * GPIO 5 -> enable ADC analog circuit for the left channel
1967 + * GPIO 6 -> enable ADC analog circuit for the right channel
1968 +- * GPIO 7 -> switch green rear output jack between CS4245 and and the first
1969 ++ * GPIO 7 -> switch green rear output jack between CS4245 and the first
1970 + * channel of CS4361 (mechanical relay)
1971 + * GPIO 8 -> enable output to speakers
1972 + *
1973 +diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
1974 +index fef3b9a21a667..e441e23a37e4f 100644
1975 +--- a/sound/soc/tegra/tegra30_ahub.c
1976 ++++ b/sound/soc/tegra/tegra30_ahub.c
1977 +@@ -656,8 +656,10 @@ static int tegra30_ahub_resume(struct device *dev)
1978 + int ret;
1979 +
1980 + ret = pm_runtime_get_sync(dev);
1981 +- if (ret < 0)
1982 ++ if (ret < 0) {
1983 ++ pm_runtime_put(dev);
1984 + return ret;
1985 ++ }
1986 + ret = regcache_sync(ahub->regmap_ahub);
1987 + ret |= regcache_sync(ahub->regmap_apbif);
1988 + pm_runtime_put(dev);
1989 +diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
1990 +index 8e55583aa104e..516f37896092c 100644
1991 +--- a/sound/soc/tegra/tegra30_i2s.c
1992 ++++ b/sound/soc/tegra/tegra30_i2s.c
1993 +@@ -552,8 +552,10 @@ static int tegra30_i2s_resume(struct device *dev)
1994 + int ret;
1995 +
1996 + ret = pm_runtime_get_sync(dev);
1997 +- if (ret < 0)
1998 ++ if (ret < 0) {
1999 ++ pm_runtime_put(dev);
2000 + return ret;
2001 ++ }
2002 + ret = regcache_sync(i2s->regmap);
2003 + pm_runtime_put(dev);
2004 +
2005 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
2006 +index 689fd3103e5b6..a917b7e02d312 100644
2007 +--- a/sound/usb/quirks-table.h
2008 ++++ b/sound/usb/quirks-table.h
2009 +@@ -3331,8 +3331,8 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
2010 + * they pretend to be 96kHz mono as a workaround for stereo being broken
2011 + * by that...
2012 + *
2013 +- * They also have swapped L-R channels, but that's for userspace to deal
2014 +- * with.
2015 ++ * They also have an issue with initial stream alignment that causes the
2016 ++ * channels to be swapped and out of phase, which is dealt with in quirks.c.
2017 + */
2018 + {
2019 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2020 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
2021 +index 94110b1dcd3d8..031baa43646fb 100644
2022 +--- a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
2023 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
2024 +@@ -91,8 +91,6 @@ int back_to_back_ebbs(void)
2025 + ebb_global_disable();
2026 + ebb_freeze_pmcs();
2027 +
2028 +- count_pmc(1, sample_period);
2029 +-
2030 + dump_ebb_state();
2031 +
2032 + event_close(&event);
2033 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
2034 +index 7c57a8d79535d..361e0be9df9ae 100644
2035 +--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
2036 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
2037 +@@ -42,8 +42,6 @@ int cycles(void)
2038 + ebb_global_disable();
2039 + ebb_freeze_pmcs();
2040 +
2041 +- count_pmc(1, sample_period);
2042 +-
2043 + dump_ebb_state();
2044 +
2045 + event_close(&event);
2046 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
2047 +index ecf5ee3283a3e..fe7d0dc2a1a26 100644
2048 +--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
2049 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
2050 +@@ -99,8 +99,6 @@ int cycles_with_freeze(void)
2051 + ebb_global_disable();
2052 + ebb_freeze_pmcs();
2053 +
2054 +- count_pmc(1, sample_period);
2055 +-
2056 + dump_ebb_state();
2057 +
2058 + printf("EBBs while frozen %d\n", ebbs_while_frozen);
2059 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
2060 +index c0faba520b35c..b9b30f974b5ea 100644
2061 +--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
2062 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
2063 +@@ -71,8 +71,6 @@ int cycles_with_mmcr2(void)
2064 + ebb_global_disable();
2065 + ebb_freeze_pmcs();
2066 +
2067 +- count_pmc(1, sample_period);
2068 +-
2069 + dump_ebb_state();
2070 +
2071 + event_close(&event);
2072 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
2073 +index 9729d9f902187..4154498bc5dc5 100644
2074 +--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
2075 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
2076 +@@ -398,8 +398,6 @@ int ebb_child(union pipe read_pipe, union pipe write_pipe)
2077 + ebb_global_disable();
2078 + ebb_freeze_pmcs();
2079 +
2080 +- count_pmc(1, sample_period);
2081 +-
2082 + dump_ebb_state();
2083 +
2084 + event_close(&event);
2085 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
2086 +index a991d2ea8d0a1..174e4f4dae6c0 100644
2087 +--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
2088 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
2089 +@@ -38,8 +38,6 @@ static int victim_child(union pipe read_pipe, union pipe write_pipe)
2090 + ebb_global_disable();
2091 + ebb_freeze_pmcs();
2092 +
2093 +- count_pmc(1, sample_period);
2094 +-
2095 + dump_ebb_state();
2096 +
2097 + FAIL_IF(ebb_state.stats.ebb_count == 0);
2098 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
2099 +index eb8acb78bc6c1..531083accfcad 100644
2100 +--- a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
2101 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
2102 +@@ -75,7 +75,6 @@ static int test_body(void)
2103 + ebb_freeze_pmcs();
2104 + ebb_global_disable();
2105 +
2106 +- count_pmc(4, sample_period);
2107 + mtspr(SPRN_PMC4, 0xdead);
2108 +
2109 + dump_summary_ebb_state();
2110 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
2111 +index 6ff8c8ff27d66..035c02273cd49 100644
2112 +--- a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
2113 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
2114 +@@ -70,13 +70,6 @@ int multi_counter(void)
2115 + ebb_global_disable();
2116 + ebb_freeze_pmcs();
2117 +
2118 +- count_pmc(1, sample_period);
2119 +- count_pmc(2, sample_period);
2120 +- count_pmc(3, sample_period);
2121 +- count_pmc(4, sample_period);
2122 +- count_pmc(5, sample_period);
2123 +- count_pmc(6, sample_period);
2124 +-
2125 + dump_ebb_state();
2126 +
2127 + for (i = 0; i < 6; i++)
2128 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
2129 +index 037cb6154f360..3e9d4ac965c85 100644
2130 +--- a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
2131 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
2132 +@@ -61,8 +61,6 @@ static int cycles_child(void)
2133 + ebb_global_disable();
2134 + ebb_freeze_pmcs();
2135 +
2136 +- count_pmc(1, sample_period);
2137 +-
2138 + dump_summary_ebb_state();
2139 +
2140 + event_close(&event);
2141 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
2142 +index c5fa64790c22e..d90891fe96a32 100644
2143 +--- a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
2144 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
2145 +@@ -82,8 +82,6 @@ static int test_body(void)
2146 + ebb_global_disable();
2147 + ebb_freeze_pmcs();
2148 +
2149 +- count_pmc(1, sample_period);
2150 +-
2151 + dump_ebb_state();
2152 +
2153 + if (mmcr0_mismatch)
2154 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
2155 +index 30e1ac62e8cb4..8ca92b9ee5b01 100644
2156 +--- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
2157 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
2158 +@@ -76,8 +76,6 @@ int pmc56_overflow(void)
2159 + ebb_global_disable();
2160 + ebb_freeze_pmcs();
2161 +
2162 +- count_pmc(2, sample_period);
2163 +-
2164 + dump_ebb_state();
2165 +
2166 + printf("PMC5/6 overflow %d\n", pmc56_overflowed);