Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Tue, 17 Jul 2018 10:25:51
Message-Id: 1531823137.c1863992c22d9bfe88853a78690636b47cacf954.mpagano@gentoo
1 commit: c1863992c22d9bfe88853a78690636b47cacf954
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 17 10:25:37 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 17 10:25:37 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c1863992
7
8 Linux patch 4.9.113
9
10 0000_README | 4 +
11 1112_linux-4.9.113.patch | 991 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 995 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index f268044..9efde71 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -491,6 +491,10 @@ Patch: 1111_linux-4.9.112.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.112
21
22 +Patch: 1112_linux-4.9.113.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.113
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1112_linux-4.9.113.patch b/1112_linux-4.9.113.patch
31 new file mode 100644
32 index 0000000..cbe1924
33 --- /dev/null
34 +++ b/1112_linux-4.9.113.patch
35 @@ -0,0 +1,991 @@
36 +diff --git a/Makefile b/Makefile
37 +index c4544293db10..3884afb2850f 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 112
44 ++SUBLEVEL = 113
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
49 +index ebb575c4231b..cb1e9c184b5a 100644
50 +--- a/arch/mips/kernel/process.c
51 ++++ b/arch/mips/kernel/process.c
52 +@@ -641,8 +641,8 @@ static void arch_dump_stack(void *info)
53 +
54 + if (regs)
55 + show_regs(regs);
56 +-
57 +- dump_stack();
58 ++ else
59 ++ dump_stack();
60 + }
61 +
62 + void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
63 +diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
64 +index bb1d9ff1be5c..8e0749665934 100644
65 +--- a/arch/mips/kernel/traps.c
66 ++++ b/arch/mips/kernel/traps.c
67 +@@ -351,6 +351,7 @@ static void __show_regs(const struct pt_regs *regs)
68 + void show_regs(struct pt_regs *regs)
69 + {
70 + __show_regs((struct pt_regs *)regs);
71 ++ dump_stack();
72 + }
73 +
74 + void show_registers(struct pt_regs *regs)
75 +diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
76 +index 1f189627440f..0dbcd90b19b5 100644
77 +--- a/arch/mips/mm/ioremap.c
78 ++++ b/arch/mips/mm/ioremap.c
79 +@@ -9,6 +9,7 @@
80 + #include <linux/export.h>
81 + #include <asm/addrspace.h>
82 + #include <asm/byteorder.h>
83 ++#include <linux/ioport.h>
84 + #include <linux/sched.h>
85 + #include <linux/slab.h>
86 + #include <linux/vmalloc.h>
87 +@@ -97,6 +98,20 @@ static int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
88 + return error;
89 + }
90 +
91 ++static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
92 ++ void *arg)
93 ++{
94 ++ unsigned long i;
95 ++
96 ++ for (i = 0; i < nr_pages; i++) {
97 ++ if (pfn_valid(start_pfn + i) &&
98 ++ !PageReserved(pfn_to_page(start_pfn + i)))
99 ++ return 1;
100 ++ }
101 ++
102 ++ return 0;
103 ++}
104 ++
105 + /*
106 + * Generic mapping function (not visible outside):
107 + */
108 +@@ -115,8 +130,8 @@ static int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
109 +
110 + void __iomem * __ioremap(phys_addr_t phys_addr, phys_addr_t size, unsigned long flags)
111 + {
112 ++ unsigned long offset, pfn, last_pfn;
113 + struct vm_struct * area;
114 +- unsigned long offset;
115 + phys_addr_t last_addr;
116 + void * addr;
117 +
118 +@@ -136,18 +151,16 @@ void __iomem * __ioremap(phys_addr_t phys_addr, phys_addr_t size, unsigned long
119 + return (void __iomem *) CKSEG1ADDR(phys_addr);
120 +
121 + /*
122 +- * Don't allow anybody to remap normal RAM that we're using..
123 ++ * Don't allow anybody to remap RAM that may be allocated by the page
124 ++ * allocator, since that could lead to races & data clobbering.
125 + */
126 +- if (phys_addr < virt_to_phys(high_memory)) {
127 +- char *t_addr, *t_end;
128 +- struct page *page;
129 +-
130 +- t_addr = __va(phys_addr);
131 +- t_end = t_addr + (size - 1);
132 +-
133 +- for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
134 +- if(!PageReserved(page))
135 +- return NULL;
136 ++ pfn = PFN_DOWN(phys_addr);
137 ++ last_pfn = PFN_DOWN(last_addr);
138 ++ if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
139 ++ __ioremap_check_ram) == 1) {
140 ++ WARN_ONCE(1, "ioremap on RAM at %pa - %pa\n",
141 ++ &phys_addr, &last_addr);
142 ++ return NULL;
143 + }
144 +
145 + /*
146 +diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
147 +index 495c776de4b4..e78a6b1db74b 100644
148 +--- a/arch/x86/kernel/uprobes.c
149 ++++ b/arch/x86/kernel/uprobes.c
150 +@@ -290,7 +290,7 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool
151 + insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64);
152 + /* has the side-effect of processing the entire instruction */
153 + insn_get_length(insn);
154 +- if (WARN_ON_ONCE(!insn_complete(insn)))
155 ++ if (!insn_complete(insn))
156 + return -ENOEXEC;
157 +
158 + if (is_prefix_bad(insn))
159 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
160 +index 4d4b5f607b81..faa91f8a17a5 100644
161 +--- a/drivers/ata/ahci.c
162 ++++ b/drivers/ata/ahci.c
163 +@@ -1260,6 +1260,59 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
164 + return strcmp(buf, dmi->driver_data) < 0;
165 + }
166 +
167 ++static bool ahci_broken_lpm(struct pci_dev *pdev)
168 ++{
169 ++ static const struct dmi_system_id sysids[] = {
170 ++ /* Various Lenovo 50 series have LPM issues with older BIOSen */
171 ++ {
172 ++ .matches = {
173 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
174 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X250"),
175 ++ },
176 ++ .driver_data = "20180406", /* 1.31 */
177 ++ },
178 ++ {
179 ++ .matches = {
180 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
181 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L450"),
182 ++ },
183 ++ .driver_data = "20180420", /* 1.28 */
184 ++ },
185 ++ {
186 ++ .matches = {
187 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
188 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T450s"),
189 ++ },
190 ++ .driver_data = "20180315", /* 1.33 */
191 ++ },
192 ++ {
193 ++ .matches = {
194 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
195 ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"),
196 ++ },
197 ++ /*
198 ++ * Note date based on release notes, 2.35 has been
199 ++ * reported to be good, but I've been unable to get
200 ++ * a hold of the reporter to get the DMI BIOS date.
201 ++ * TODO: fix this.
202 ++ */
203 ++ .driver_data = "20180310", /* 2.35 */
204 ++ },
205 ++ { } /* terminate list */
206 ++ };
207 ++ const struct dmi_system_id *dmi = dmi_first_match(sysids);
208 ++ int year, month, date;
209 ++ char buf[9];
210 ++
211 ++ if (!dmi)
212 ++ return false;
213 ++
214 ++ dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
215 ++ snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
216 ++
217 ++ return strcmp(buf, dmi->driver_data) < 0;
218 ++}
219 ++
220 + static bool ahci_broken_online(struct pci_dev *pdev)
221 + {
222 + #define ENCODE_BUSDEVFN(bus, slot, func) \
223 +@@ -1626,6 +1679,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
224 + "quirky BIOS, skipping spindown on poweroff\n");
225 + }
226 +
227 ++ if (ahci_broken_lpm(pdev)) {
228 ++ pi.flags |= ATA_FLAG_NO_LPM;
229 ++ dev_warn(&pdev->dev,
230 ++ "BIOS update required for Link Power Management support\n");
231 ++ }
232 ++
233 + if (ahci_broken_suspend(pdev)) {
234 + hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
235 + dev_warn(&pdev->dev,
236 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
237 +index 82c59a143a14..73d636d35961 100644
238 +--- a/drivers/ata/libata-core.c
239 ++++ b/drivers/ata/libata-core.c
240 +@@ -2385,6 +2385,9 @@ int ata_dev_configure(struct ata_device *dev)
241 + (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2)
242 + dev->horkage |= ATA_HORKAGE_NOLPM;
243 +
244 ++ if (ap->flags & ATA_FLAG_NO_LPM)
245 ++ dev->horkage |= ATA_HORKAGE_NOLPM;
246 ++
247 + if (dev->horkage & ATA_HORKAGE_NOLPM) {
248 + ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
249 + dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
250 +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
251 +index fb2c00fce8f9..a3d60ccafd9a 100644
252 +--- a/drivers/ata/libata-scsi.c
253 ++++ b/drivers/ata/libata-scsi.c
254 +@@ -3772,10 +3772,20 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
255 + */
256 + goto invalid_param_len;
257 + }
258 +- if (block > dev->n_sectors)
259 +- goto out_of_range;
260 +
261 + all = cdb[14] & 0x1;
262 ++ if (all) {
263 ++ /*
264 ++ * Ignore the block address (zone ID) as defined by ZBC.
265 ++ */
266 ++ block = 0;
267 ++ } else if (block >= dev->n_sectors) {
268 ++ /*
269 ++ * Block must be a valid zone ID (a zone start LBA).
270 ++ */
271 ++ fp = 2;
272 ++ goto invalid_fld;
273 ++ }
274 +
275 + if (ata_ncq_enabled(qc->dev) &&
276 + ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
277 +@@ -3804,10 +3814,6 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
278 + invalid_fld:
279 + ata_scsi_set_invalid_field(qc->dev, scmd, fp, 0xff);
280 + return 1;
281 +- out_of_range:
282 +- /* "Logical Block Address out of range" */
283 +- ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x21, 0x00);
284 +- return 1;
285 + invalid_param_len:
286 + /* "Parameter list length error" */
287 + ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x1a, 0x0);
288 +diff --git a/drivers/block/loop.c b/drivers/block/loop.c
289 +index ff1c4d7aa025..9f840d9fdfcb 100644
290 +--- a/drivers/block/loop.c
291 ++++ b/drivers/block/loop.c
292 +@@ -640,6 +640,36 @@ static void loop_reread_partitions(struct loop_device *lo,
293 + __func__, lo->lo_number, lo->lo_file_name, rc);
294 + }
295 +
296 ++static inline int is_loop_device(struct file *file)
297 ++{
298 ++ struct inode *i = file->f_mapping->host;
299 ++
300 ++ return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
301 ++}
302 ++
303 ++static int loop_validate_file(struct file *file, struct block_device *bdev)
304 ++{
305 ++ struct inode *inode = file->f_mapping->host;
306 ++ struct file *f = file;
307 ++
308 ++ /* Avoid recursion */
309 ++ while (is_loop_device(f)) {
310 ++ struct loop_device *l;
311 ++
312 ++ if (f->f_mapping->host->i_bdev == bdev)
313 ++ return -EBADF;
314 ++
315 ++ l = f->f_mapping->host->i_bdev->bd_disk->private_data;
316 ++ if (l->lo_state == Lo_unbound) {
317 ++ return -EINVAL;
318 ++ }
319 ++ f = l->lo_backing_file;
320 ++ }
321 ++ if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
322 ++ return -EINVAL;
323 ++ return 0;
324 ++}
325 ++
326 + /*
327 + * loop_change_fd switched the backing store of a loopback device to
328 + * a new file. This is useful for operating system installers to free up
329 +@@ -669,14 +699,15 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
330 + if (!file)
331 + goto out;
332 +
333 ++ error = loop_validate_file(file, bdev);
334 ++ if (error)
335 ++ goto out_putf;
336 ++
337 + inode = file->f_mapping->host;
338 + old_file = lo->lo_backing_file;
339 +
340 + error = -EINVAL;
341 +
342 +- if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
343 +- goto out_putf;
344 +-
345 + /* size of the new backing store needs to be the same */
346 + if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
347 + goto out_putf;
348 +@@ -697,13 +728,6 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
349 + return error;
350 + }
351 +
352 +-static inline int is_loop_device(struct file *file)
353 +-{
354 +- struct inode *i = file->f_mapping->host;
355 +-
356 +- return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
357 +-}
358 +-
359 + /* loop sysfs attributes */
360 +
361 + static ssize_t loop_attr_show(struct device *dev, char *page,
362 +@@ -800,16 +824,17 @@ static struct attribute_group loop_attribute_group = {
363 + .attrs= loop_attrs,
364 + };
365 +
366 +-static int loop_sysfs_init(struct loop_device *lo)
367 ++static void loop_sysfs_init(struct loop_device *lo)
368 + {
369 +- return sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj,
370 +- &loop_attribute_group);
371 ++ lo->sysfs_inited = !sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj,
372 ++ &loop_attribute_group);
373 + }
374 +
375 + static void loop_sysfs_exit(struct loop_device *lo)
376 + {
377 +- sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj,
378 +- &loop_attribute_group);
379 ++ if (lo->sysfs_inited)
380 ++ sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj,
381 ++ &loop_attribute_group);
382 + }
383 +
384 + static void loop_config_discard(struct loop_device *lo)
385 +@@ -861,7 +886,7 @@ static int loop_prepare_queue(struct loop_device *lo)
386 + static int loop_set_fd(struct loop_device *lo, fmode_t mode,
387 + struct block_device *bdev, unsigned int arg)
388 + {
389 +- struct file *file, *f;
390 ++ struct file *file;
391 + struct inode *inode;
392 + struct address_space *mapping;
393 + unsigned lo_blocksize;
394 +@@ -881,29 +906,13 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
395 + if (lo->lo_state != Lo_unbound)
396 + goto out_putf;
397 +
398 +- /* Avoid recursion */
399 +- f = file;
400 +- while (is_loop_device(f)) {
401 +- struct loop_device *l;
402 +-
403 +- if (f->f_mapping->host->i_bdev == bdev)
404 +- goto out_putf;
405 +-
406 +- l = f->f_mapping->host->i_bdev->bd_disk->private_data;
407 +- if (l->lo_state == Lo_unbound) {
408 +- error = -EINVAL;
409 +- goto out_putf;
410 +- }
411 +- f = l->lo_backing_file;
412 +- }
413 ++ error = loop_validate_file(file, bdev);
414 ++ if (error)
415 ++ goto out_putf;
416 +
417 + mapping = file->f_mapping;
418 + inode = mapping->host;
419 +
420 +- error = -EINVAL;
421 +- if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
422 +- goto out_putf;
423 +-
424 + if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
425 + !file->f_op->write_iter)
426 + lo_flags |= LO_FLAGS_READ_ONLY;
427 +diff --git a/drivers/block/loop.h b/drivers/block/loop.h
428 +index fb2237c73e61..60f0fd2c0c65 100644
429 +--- a/drivers/block/loop.h
430 ++++ b/drivers/block/loop.h
431 +@@ -59,6 +59,7 @@ struct loop_device {
432 + struct kthread_worker worker;
433 + struct task_struct *worker_task;
434 + bool use_dio;
435 ++ bool sysfs_inited;
436 +
437 + struct request_queue *lo_queue;
438 + struct blk_mq_tag_set tag_set;
439 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
440 +index 9347b37a1303..019ee9181f2b 100644
441 +--- a/drivers/hid/hid-ids.h
442 ++++ b/drivers/hid/hid-ids.h
443 +@@ -549,6 +549,9 @@
444 + #define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615
445 + #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070
446 +
447 ++#define USB_VENDOR_ID_INNOMEDIA 0x1292
448 ++#define USB_DEVICE_ID_INNEX_GENESIS_ATARI 0x4745
449 ++
450 + #define USB_VENDOR_ID_ITE 0x048d
451 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
452 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
453 +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
454 +index 1916f80a692d..617ae294a318 100644
455 +--- a/drivers/hid/usbhid/hid-quirks.c
456 ++++ b/drivers/hid/usbhid/hid-quirks.c
457 +@@ -170,6 +170,7 @@ static const struct hid_blacklist {
458 + { USB_VENDOR_ID_MULTIPLE_1781, USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD, HID_QUIRK_MULTI_INPUT },
459 + { USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_2NES2SNES, HID_QUIRK_MULTI_INPUT },
460 + { USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_4NES4SNES, HID_QUIRK_MULTI_INPUT },
461 ++ { USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI, HID_QUIRK_MULTI_INPUT },
462 +
463 + { 0, 0 }
464 + };
465 +diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
466 +index 4af9bbae20df..586e557e113a 100644
467 +--- a/drivers/i2c/busses/i2c-tegra.c
468 ++++ b/drivers/i2c/busses/i2c-tegra.c
469 +@@ -547,6 +547,14 @@ static int tegra_i2c_disable_packet_mode(struct tegra_i2c_dev *i2c_dev)
470 + {
471 + u32 cnfg;
472 +
473 ++ /*
474 ++ * NACK interrupt is generated before the I2C controller generates
475 ++ * the STOP condition on the bus. So wait for 2 clock periods
476 ++ * before disabling the controller so that the STOP condition has
477 ++ * been delivered properly.
478 ++ */
479 ++ udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate));
480 ++
481 + cnfg = i2c_readl(i2c_dev, I2C_CNFG);
482 + if (cnfg & I2C_CNFG_PACKET_MODE_EN)
483 + i2c_writel(i2c_dev, cnfg & ~I2C_CNFG_PACKET_MODE_EN, I2C_CNFG);
484 +@@ -708,15 +716,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
485 + if (likely(i2c_dev->msg_err == I2C_ERR_NONE))
486 + return 0;
487 +
488 +- /*
489 +- * NACK interrupt is generated before the I2C controller generates
490 +- * the STOP condition on the bus. So wait for 2 clock periods
491 +- * before resetting the controller so that the STOP condition has
492 +- * been delivered properly.
493 +- */
494 +- if (i2c_dev->msg_err == I2C_ERR_NO_ACK)
495 +- udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate));
496 +-
497 + tegra_i2c_init(i2c_dev);
498 + if (i2c_dev->msg_err == I2C_ERR_NO_ACK) {
499 + if (msg->flags & I2C_M_IGNORE_NAK)
500 +diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
501 +index fb3fb89640e5..5d5368a3c819 100644
502 +--- a/drivers/infiniband/Kconfig
503 ++++ b/drivers/infiniband/Kconfig
504 +@@ -34,6 +34,18 @@ config INFINIBAND_USER_ACCESS
505 + libibverbs, libibcm and a hardware driver library from
506 + <http://www.openfabrics.org/git/>.
507 +
508 ++config INFINIBAND_USER_ACCESS_UCM
509 ++ bool "Userspace CM (UCM, DEPRECATED)"
510 ++ depends on BROKEN
511 ++ depends on INFINIBAND_USER_ACCESS
512 ++ help
513 ++ The UCM module has known security flaws, which no one is
514 ++ interested to fix. The user-space part of this code was
515 ++ dropped from the upstream a long time ago.
516 ++
517 ++ This option is DEPRECATED and planned to be removed.
518 ++
519 ++
520 + config INFINIBAND_USER_MEM
521 + bool
522 + depends on INFINIBAND_USER_ACCESS != n
523 +diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
524 +index edaae9f9853c..33dc00c721b9 100644
525 +--- a/drivers/infiniband/core/Makefile
526 ++++ b/drivers/infiniband/core/Makefile
527 +@@ -4,8 +4,8 @@ user_access-$(CONFIG_INFINIBAND_ADDR_TRANS) := rdma_ucm.o
528 + obj-$(CONFIG_INFINIBAND) += ib_core.o ib_cm.o iw_cm.o \
529 + $(infiniband-y)
530 + obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o
531 +-obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o \
532 +- $(user_access-y)
533 ++obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o $(user_access-y)
534 ++obj-$(CONFIG_INFINIBAND_USER_ACCESS_UCM) += ib_ucm.o $(user_access-y)
535 +
536 + ib_core-y := packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \
537 + device.o fmr_pool.o cache.o netlink.o \
538 +diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
539 +index 410408f886c1..0c215353adb9 100644
540 +--- a/drivers/infiniband/hw/cxgb4/mem.c
541 ++++ b/drivers/infiniband/hw/cxgb4/mem.c
542 +@@ -724,7 +724,7 @@ static int c4iw_set_page(struct ib_mr *ibmr, u64 addr)
543 + {
544 + struct c4iw_mr *mhp = to_c4iw_mr(ibmr);
545 +
546 +- if (unlikely(mhp->mpl_len == mhp->max_mpl_len))
547 ++ if (unlikely(mhp->mpl_len == mhp->attr.pbl_size))
548 + return -ENOMEM;
549 +
550 + mhp->mpl[mhp->mpl_len++] = addr;
551 +diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
552 +index 520f58439080..65ad7e5261bf 100644
553 +--- a/drivers/misc/ibmasm/ibmasmfs.c
554 ++++ b/drivers/misc/ibmasm/ibmasmfs.c
555 +@@ -507,35 +507,14 @@ static int remote_settings_file_close(struct inode *inode, struct file *file)
556 + static ssize_t remote_settings_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
557 + {
558 + void __iomem *address = (void __iomem *)file->private_data;
559 +- unsigned char *page;
560 +- int retval;
561 + int len = 0;
562 + unsigned int value;
563 +-
564 +- if (*offset < 0)
565 +- return -EINVAL;
566 +- if (count == 0 || count > 1024)
567 +- return 0;
568 +- if (*offset != 0)
569 +- return 0;
570 +-
571 +- page = (unsigned char *)__get_free_page(GFP_KERNEL);
572 +- if (!page)
573 +- return -ENOMEM;
574 ++ char lbuf[20];
575 +
576 + value = readl(address);
577 +- len = sprintf(page, "%d\n", value);
578 +-
579 +- if (copy_to_user(buf, page, len)) {
580 +- retval = -EFAULT;
581 +- goto exit;
582 +- }
583 +- *offset += len;
584 +- retval = len;
585 ++ len = snprintf(lbuf, sizeof(lbuf), "%d\n", value);
586 +
587 +-exit:
588 +- free_page((unsigned long)page);
589 +- return retval;
590 ++ return simple_read_from_buffer(buf, count, offset, lbuf, len);
591 + }
592 +
593 + static ssize_t remote_settings_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset)
594 +diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
595 +index fe90b7e04427..5e047bfc0cc4 100644
596 +--- a/drivers/misc/vmw_balloon.c
597 ++++ b/drivers/misc/vmw_balloon.c
598 +@@ -467,7 +467,7 @@ static int vmballoon_send_batched_lock(struct vmballoon *b,
599 + unsigned int num_pages, bool is_2m_pages, unsigned int *target)
600 + {
601 + unsigned long status;
602 +- unsigned long pfn = page_to_pfn(b->page);
603 ++ unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
604 +
605 + STATS_INC(b->stats.lock[is_2m_pages]);
606 +
607 +@@ -515,7 +515,7 @@ static bool vmballoon_send_batched_unlock(struct vmballoon *b,
608 + unsigned int num_pages, bool is_2m_pages, unsigned int *target)
609 + {
610 + unsigned long status;
611 +- unsigned long pfn = page_to_pfn(b->page);
612 ++ unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
613 +
614 + STATS_INC(b->stats.unlock[is_2m_pages]);
615 +
616 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
617 +index d382dbd44635..1a1501fde010 100644
618 +--- a/drivers/mmc/host/dw_mmc.c
619 ++++ b/drivers/mmc/host/dw_mmc.c
620 +@@ -981,8 +981,8 @@ static void dw_mci_ctrl_thld(struct dw_mci *host, struct mmc_data *data)
621 + * It's used when HS400 mode is enabled.
622 + */
623 + if (data->flags & MMC_DATA_WRITE &&
624 +- !(host->timing != MMC_TIMING_MMC_HS400))
625 +- return;
626 ++ host->timing != MMC_TIMING_MMC_HS400)
627 ++ goto disable;
628 +
629 + if (data->flags & MMC_DATA_WRITE)
630 + enable = SDMMC_CARD_WR_THR_EN;
631 +@@ -990,7 +990,8 @@ static void dw_mci_ctrl_thld(struct dw_mci *host, struct mmc_data *data)
632 + enable = SDMMC_CARD_RD_THR_EN;
633 +
634 + if (host->timing != MMC_TIMING_MMC_HS200 &&
635 +- host->timing != MMC_TIMING_UHS_SDR104)
636 ++ host->timing != MMC_TIMING_UHS_SDR104 &&
637 ++ host->timing != MMC_TIMING_MMC_HS400)
638 + goto disable;
639 +
640 + blksz_depth = blksz / (1 << host->data_shift);
641 +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
642 +index c823e9346389..979c6ecc6446 100644
643 +--- a/drivers/nvme/host/core.c
644 ++++ b/drivers/nvme/host/core.c
645 +@@ -2042,7 +2042,8 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
646 + mutex_lock(&ctrl->namespaces_mutex);
647 +
648 + /* Forcibly start all queues to avoid having stuck requests */
649 +- blk_mq_start_hw_queues(ctrl->admin_q);
650 ++ if (ctrl->admin_q)
651 ++ blk_mq_start_hw_queues(ctrl->admin_q);
652 +
653 + list_for_each_entry(ns, &ctrl->namespaces, list) {
654 + /*
655 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
656 +index a55d112583bd..fadf151ce830 100644
657 +--- a/drivers/nvme/host/pci.c
658 ++++ b/drivers/nvme/host/pci.c
659 +@@ -1034,17 +1034,15 @@ static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
660 + static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
661 + int qid, int depth)
662 + {
663 +- if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) {
664 +- unsigned offset = (qid - 1) * roundup(SQ_SIZE(depth),
665 +- dev->ctrl.page_size);
666 +- nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset;
667 +- nvmeq->sq_cmds_io = dev->cmb + offset;
668 +- } else {
669 +- nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth),
670 +- &nvmeq->sq_dma_addr, GFP_KERNEL);
671 +- if (!nvmeq->sq_cmds)
672 +- return -ENOMEM;
673 +- }
674 ++
675 ++ /* CMB SQEs will be mapped before creation */
676 ++ if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz))
677 ++ return 0;
678 ++
679 ++ nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth),
680 ++ &nvmeq->sq_dma_addr, GFP_KERNEL);
681 ++ if (!nvmeq->sq_cmds)
682 ++ return -ENOMEM;
683 +
684 + return 0;
685 + }
686 +@@ -1117,6 +1115,13 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
687 + struct nvme_dev *dev = nvmeq->dev;
688 + int result;
689 +
690 ++ if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) {
691 ++ unsigned offset = (qid - 1) * roundup(SQ_SIZE(nvmeq->q_depth),
692 ++ dev->ctrl.page_size);
693 ++ nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset;
694 ++ nvmeq->sq_cmds_io = dev->cmb + offset;
695 ++ }
696 ++
697 + nvmeq->cq_vector = qid - 1;
698 + result = adapter_alloc_cq(dev, qid, nvmeq);
699 + if (result < 0)
700 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
701 +index 40ce175655e6..99f67764765f 100644
702 +--- a/drivers/usb/core/quirks.c
703 ++++ b/drivers/usb/core/quirks.c
704 +@@ -231,6 +231,10 @@ static const struct usb_device_id usb_quirk_list[] = {
705 + /* Corsair K70 RGB */
706 + { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
707 +
708 ++ /* Corsair Strafe */
709 ++ { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
710 ++ USB_QUIRK_DELAY_CTRL_MSG },
711 ++
712 + /* Corsair Strafe RGB */
713 + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
714 + USB_QUIRK_DELAY_CTRL_MSG },
715 +diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
716 +index 48bdab4fdc8f..7199e400fbac 100644
717 +--- a/drivers/usb/host/xhci-mem.c
718 ++++ b/drivers/usb/host/xhci-mem.c
719 +@@ -650,7 +650,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
720 + if (!ep->stream_info)
721 + return NULL;
722 +
723 +- if (stream_id > ep->stream_info->num_streams)
724 ++ if (stream_id >= ep->stream_info->num_streams)
725 + return NULL;
726 + return ep->stream_info->stream_rings[stream_id];
727 + }
728 +diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
729 +index 54e53ac4c08f..f36968ee2e70 100644
730 +--- a/drivers/usb/misc/yurex.c
731 ++++ b/drivers/usb/misc/yurex.c
732 +@@ -406,8 +406,7 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
733 + loff_t *ppos)
734 + {
735 + struct usb_yurex *dev;
736 +- int retval = 0;
737 +- int bytes_read = 0;
738 ++ int len = 0;
739 + char in_buffer[20];
740 + unsigned long flags;
741 +
742 +@@ -415,26 +414,16 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
743 +
744 + mutex_lock(&dev->io_mutex);
745 + if (!dev->interface) { /* already disconnected */
746 +- retval = -ENODEV;
747 +- goto exit;
748 ++ mutex_unlock(&dev->io_mutex);
749 ++ return -ENODEV;
750 + }
751 +
752 + spin_lock_irqsave(&dev->lock, flags);
753 +- bytes_read = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
754 ++ len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
755 + spin_unlock_irqrestore(&dev->lock, flags);
756 +-
757 +- if (*ppos < bytes_read) {
758 +- if (copy_to_user(buffer, in_buffer + *ppos, bytes_read - *ppos))
759 +- retval = -EFAULT;
760 +- else {
761 +- retval = bytes_read - *ppos;
762 +- *ppos += bytes_read;
763 +- }
764 +- }
765 +-
766 +-exit:
767 + mutex_unlock(&dev->io_mutex);
768 +- return retval;
769 ++
770 ++ return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
771 + }
772 +
773 + static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
774 +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
775 +index e98590aab633..9a2c0c76d11b 100644
776 +--- a/drivers/usb/serial/ch341.c
777 ++++ b/drivers/usb/serial/ch341.c
778 +@@ -118,7 +118,7 @@ static int ch341_control_in(struct usb_device *dev,
779 + r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
780 + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
781 + value, index, buf, bufsize, DEFAULT_TIMEOUT);
782 +- if (r < bufsize) {
783 ++ if (r < (int)bufsize) {
784 + if (r >= 0) {
785 + dev_err(&dev->dev,
786 + "short control message received (%d < %u)\n",
787 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
788 +index 6f2c77a7c08e..c2b120021443 100644
789 +--- a/drivers/usb/serial/cp210x.c
790 ++++ b/drivers/usb/serial/cp210x.c
791 +@@ -146,6 +146,7 @@ static const struct usb_device_id id_table[] = {
792 + { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
793 + { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
794 + { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
795 ++ { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
796 + { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
797 + { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
798 + { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
799 +diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
800 +index d2dab2a341b8..d17f7872f95a 100644
801 +--- a/drivers/usb/serial/keyspan_pda.c
802 ++++ b/drivers/usb/serial/keyspan_pda.c
803 +@@ -373,8 +373,10 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial,
804 + 3, /* get pins */
805 + USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
806 + 0, 0, data, 1, 2000);
807 +- if (rc >= 0)
808 ++ if (rc == 1)
809 + *value = *data;
810 ++ else if (rc >= 0)
811 ++ rc = -EIO;
812 +
813 + kfree(data);
814 + return rc;
815 +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
816 +index 6baacf64b21e..03d63bad6be4 100644
817 +--- a/drivers/usb/serial/mos7840.c
818 ++++ b/drivers/usb/serial/mos7840.c
819 +@@ -482,6 +482,9 @@ static void mos7840_control_callback(struct urb *urb)
820 + }
821 +
822 + dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
823 ++ if (urb->actual_length < 1)
824 ++ goto out;
825 ++
826 + dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__,
827 + mos7840_port->MsrLsr, mos7840_port->port_num);
828 + data = urb->transfer_buffer;
829 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
830 +index 1fdf4e5bf8c6..a4fabf60d5ee 100644
831 +--- a/fs/binfmt_elf.c
832 ++++ b/fs/binfmt_elf.c
833 +@@ -1217,9 +1217,8 @@ static int load_elf_library(struct file *file)
834 + goto out_free_ph;
835 + }
836 +
837 +- len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
838 +- ELF_MIN_ALIGN - 1);
839 +- bss = eppnt->p_memsz + eppnt->p_vaddr;
840 ++ len = ELF_PAGEALIGN(eppnt->p_filesz + eppnt->p_vaddr);
841 ++ bss = ELF_PAGEALIGN(eppnt->p_memsz + eppnt->p_vaddr);
842 + if (bss > len) {
843 + error = vm_brk(len, bss - len);
844 + if (error)
845 +diff --git a/fs/inode.c b/fs/inode.c
846 +index 920aa0b1c6b0..2071ff5343c5 100644
847 +--- a/fs/inode.c
848 ++++ b/fs/inode.c
849 +@@ -2003,8 +2003,14 @@ void inode_init_owner(struct inode *inode, const struct inode *dir,
850 + inode->i_uid = current_fsuid();
851 + if (dir && dir->i_mode & S_ISGID) {
852 + inode->i_gid = dir->i_gid;
853 ++
854 ++ /* Directories are special, and always inherit S_ISGID */
855 + if (S_ISDIR(mode))
856 + mode |= S_ISGID;
857 ++ else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
858 ++ !in_group_p(inode->i_gid) &&
859 ++ !capable_wrt_inode_uidgid(dir, CAP_FSETID))
860 ++ mode &= ~S_ISGID;
861 + } else
862 + inode->i_gid = current_fsgid();
863 + inode->i_mode = mode;
864 +diff --git a/include/linux/libata.h b/include/linux/libata.h
865 +index 616eef4d81ea..df58b01e6962 100644
866 +--- a/include/linux/libata.h
867 ++++ b/include/linux/libata.h
868 +@@ -208,6 +208,7 @@ enum {
869 + ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
870 + /* (doesn't imply presence) */
871 + ATA_FLAG_SATA = (1 << 1),
872 ++ ATA_FLAG_NO_LPM = (1 << 2), /* host not happy with LPM */
873 + ATA_FLAG_NO_LOG_PAGE = (1 << 5), /* do not issue log page read */
874 + ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
875 + ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
876 +diff --git a/kernel/power/user.c b/kernel/power/user.c
877 +index 35310b627388..bc6dde1f1567 100644
878 +--- a/kernel/power/user.c
879 ++++ b/kernel/power/user.c
880 +@@ -186,6 +186,11 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
881 + res = PAGE_SIZE - pg_offp;
882 + }
883 +
884 ++ if (!data_of(data->handle)) {
885 ++ res = -EINVAL;
886 ++ goto unlock;
887 ++ }
888 ++
889 + res = simple_write_to_buffer(data_of(data->handle), res, &pg_offp,
890 + buf, count);
891 + if (res > 0)
892 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
893 +index da3d373eb5bd..cb6fbb525ba6 100644
894 +--- a/net/bridge/netfilter/ebtables.c
895 ++++ b/net/bridge/netfilter/ebtables.c
896 +@@ -704,6 +704,8 @@ ebt_check_entry(struct ebt_entry *e, struct net *net,
897 + }
898 + i = 0;
899 +
900 ++ memset(&mtpar, 0, sizeof(mtpar));
901 ++ memset(&tgpar, 0, sizeof(tgpar));
902 + mtpar.net = tgpar.net = net;
903 + mtpar.table = tgpar.table = name;
904 + mtpar.entryinfo = tgpar.entryinfo = e;
905 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
906 +index e78f6521823f..06aa4948d0c0 100644
907 +--- a/net/ipv4/netfilter/ip_tables.c
908 ++++ b/net/ipv4/netfilter/ip_tables.c
909 +@@ -554,6 +554,7 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
910 + return -ENOMEM;
911 +
912 + j = 0;
913 ++ memset(&mtpar, 0, sizeof(mtpar));
914 + mtpar.net = net;
915 + mtpar.table = name;
916 + mtpar.entryinfo = &e->ip;
917 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
918 +index e26becc9a43d..180f19526a80 100644
919 +--- a/net/ipv6/netfilter/ip6_tables.c
920 ++++ b/net/ipv6/netfilter/ip6_tables.c
921 +@@ -584,6 +584,7 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name,
922 + return -ENOMEM;
923 +
924 + j = 0;
925 ++ memset(&mtpar, 0, sizeof(mtpar));
926 + mtpar.net = net;
927 + mtpar.table = name;
928 + mtpar.entryinfo = &e->ipv6;
929 +diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
930 +index 5efb40291ac3..2a811b5634d4 100644
931 +--- a/net/netfilter/nfnetlink_queue.c
932 ++++ b/net/netfilter/nfnetlink_queue.c
933 +@@ -1210,6 +1210,9 @@ static int nfqnl_recv_unsupp(struct net *net, struct sock *ctnl,
934 + static const struct nla_policy nfqa_cfg_policy[NFQA_CFG_MAX+1] = {
935 + [NFQA_CFG_CMD] = { .len = sizeof(struct nfqnl_msg_config_cmd) },
936 + [NFQA_CFG_PARAMS] = { .len = sizeof(struct nfqnl_msg_config_params) },
937 ++ [NFQA_CFG_QUEUE_MAXLEN] = { .type = NLA_U32 },
938 ++ [NFQA_CFG_MASK] = { .type = NLA_U32 },
939 ++ [NFQA_CFG_FLAGS] = { .type = NLA_U32 },
940 + };
941 +
942 + static const struct nf_queue_handler nfqh = {
943 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
944 +index bd650222e711..76ae627e3f93 100644
945 +--- a/sound/pci/hda/patch_hdmi.c
946 ++++ b/sound/pci/hda/patch_hdmi.c
947 +@@ -33,6 +33,7 @@
948 + #include <linux/delay.h>
949 + #include <linux/slab.h>
950 + #include <linux/module.h>
951 ++#include <linux/pm_runtime.h>
952 + #include <sound/core.h>
953 + #include <sound/jack.h>
954 + #include <sound/asoundef.h>
955 +@@ -731,8 +732,10 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid)
956 +
957 + if (pin_idx < 0)
958 + return;
959 ++ mutex_lock(&spec->pcm_lock);
960 + if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
961 + snd_hda_jack_report_sync(codec);
962 ++ mutex_unlock(&spec->pcm_lock);
963 + }
964 +
965 + static void jack_callback(struct hda_codec *codec,
966 +@@ -1521,21 +1524,23 @@ static void sync_eld_via_acomp(struct hda_codec *codec,
967 + static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
968 + {
969 + struct hda_codec *codec = per_pin->codec;
970 +- struct hdmi_spec *spec = codec->spec;
971 + int ret;
972 +
973 + /* no temporary power up/down needed for component notifier */
974 +- if (!codec_has_acomp(codec))
975 +- snd_hda_power_up_pm(codec);
976 ++ if (!codec_has_acomp(codec)) {
977 ++ ret = snd_hda_power_up_pm(codec);
978 ++ if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) {
979 ++ snd_hda_power_down_pm(codec);
980 ++ return false;
981 ++ }
982 ++ }
983 +
984 +- mutex_lock(&spec->pcm_lock);
985 + if (codec_has_acomp(codec)) {
986 + sync_eld_via_acomp(codec, per_pin);
987 + ret = false; /* don't call snd_hda_jack_report_sync() */
988 + } else {
989 + ret = hdmi_present_sense_via_verbs(per_pin, repoll);
990 + }
991 +- mutex_unlock(&spec->pcm_lock);
992 +
993 + if (!codec_has_acomp(codec))
994 + snd_hda_power_down_pm(codec);
995 +@@ -1547,12 +1552,16 @@ static void hdmi_repoll_eld(struct work_struct *work)
996 + {
997 + struct hdmi_spec_per_pin *per_pin =
998 + container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work);
999 ++ struct hda_codec *codec = per_pin->codec;
1000 ++ struct hdmi_spec *spec = codec->spec;
1001 +
1002 + if (per_pin->repoll_count++ > 6)
1003 + per_pin->repoll_count = 0;
1004 +
1005 ++ mutex_lock(&spec->pcm_lock);
1006 + if (hdmi_present_sense(per_pin, per_pin->repoll_count))
1007 + snd_hda_jack_report_sync(per_pin->codec);
1008 ++ mutex_unlock(&spec->pcm_lock);
1009 + }
1010 +
1011 + static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
1012 +diff --git a/tools/build/Build.include b/tools/build/Build.include
1013 +index b8165545ddf6..ab02f8df0d56 100644
1014 +--- a/tools/build/Build.include
1015 ++++ b/tools/build/Build.include
1016 +@@ -63,8 +63,8 @@ dep-cmd = $(if $(wildcard $(fixdep)),
1017 + $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \
1018 + rm -f $(depfile); \
1019 + mv -f $(dot-target).tmp $(dot-target).cmd, \
1020 +- printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
1021 +- printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \
1022 ++ printf '$(pound) cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
1023 ++ printf '$(pound) using basic dep data\n\n' >> $(dot-target).cmd; \
1024 + cat $(depfile) >> $(dot-target).cmd; \
1025 + printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd)
1026 +