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