Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0360-4.9.261-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3662 - (show annotations) (download)
Mon Oct 24 14:07:40 2022 UTC (18 months, 3 weeks ago) by niro
File size: 16939 byte(s)
-linux-4.9.261
1 diff --git a/Makefile b/Makefile
2 index 7a29676e2b2f9..7a233c641906c 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 260
9 +SUBLEVEL = 261
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
14 index 6beafaa335c71..97b678c0ea136 100644
15 --- a/drivers/block/rsxx/core.c
16 +++ b/drivers/block/rsxx/core.c
17 @@ -180,15 +180,17 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
18 {
19 struct rsxx_cardinfo *card = file_inode(fp)->i_private;
20 char *buf;
21 - ssize_t st;
22 + int st;
23
24 buf = kzalloc(cnt, GFP_KERNEL);
25 if (!buf)
26 return -ENOMEM;
27
28 st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
29 - if (!st)
30 - st = copy_to_user(ubuf, buf, cnt);
31 + if (!st) {
32 + if (copy_to_user(ubuf, buf, cnt))
33 + st = -EFAULT;
34 + }
35 kfree(buf);
36 if (st)
37 return st;
38 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
39 index f4a15d9f2bbb2..8377bd388d673 100644
40 --- a/drivers/iommu/amd_iommu.c
41 +++ b/drivers/iommu/amd_iommu.c
42 @@ -1331,24 +1331,26 @@ static void increase_address_space(struct protection_domain *domain,
43 unsigned long flags;
44 u64 *pte;
45
46 + pte = (void *)get_zeroed_page(gfp);
47 + if (!pte)
48 + goto out;
49 +
50 spin_lock_irqsave(&domain->lock, flags);
51
52 if (WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL))
53 /* address space already 64 bit large */
54 goto out;
55
56 - pte = (void *)get_zeroed_page(gfp);
57 - if (!pte)
58 - goto out;
59 -
60 *pte = PM_LEVEL_PDE(domain->mode,
61 virt_to_phys(domain->pt_root));
62 domain->pt_root = pte;
63 domain->mode += 1;
64 domain->updated = true;
65 + pte = NULL;
66
67 out:
68 spin_unlock_irqrestore(&domain->lock, flags);
69 + free_page((unsigned long)pte);
70
71 return;
72 }
73 diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
74 index 5d120c3cee57d..4fc68c00c2315 100644
75 --- a/drivers/md/dm-table.c
76 +++ b/drivers/md/dm-table.c
77 @@ -848,12 +848,12 @@ void dm_table_set_type(struct dm_table *t, unsigned type)
78 }
79 EXPORT_SYMBOL_GPL(dm_table_set_type);
80
81 -static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
82 - sector_t start, sector_t len, void *data)
83 +static int device_not_dax_capable(struct dm_target *ti, struct dm_dev *dev,
84 + sector_t start, sector_t len, void *data)
85 {
86 struct request_queue *q = bdev_get_queue(dev->bdev);
87
88 - return q && blk_queue_dax(q);
89 + return q && !blk_queue_dax(q);
90 }
91
92 static bool dm_table_supports_dax(struct dm_table *t)
93 @@ -869,7 +869,7 @@ static bool dm_table_supports_dax(struct dm_table *t)
94 return false;
95
96 if (!ti->type->iterate_devices ||
97 - !ti->type->iterate_devices(ti, device_supports_dax, NULL))
98 + ti->type->iterate_devices(ti, device_not_dax_capable, NULL))
99 return false;
100 }
101
102 @@ -1306,6 +1306,46 @@ struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector)
103 return &t->targets[(KEYS_PER_NODE * n) + k];
104 }
105
106 +/*
107 + * type->iterate_devices() should be called when the sanity check needs to
108 + * iterate and check all underlying data devices. iterate_devices() will
109 + * iterate all underlying data devices until it encounters a non-zero return
110 + * code, returned by whether the input iterate_devices_callout_fn, or
111 + * iterate_devices() itself internally.
112 + *
113 + * For some target type (e.g. dm-stripe), one call of iterate_devices() may
114 + * iterate multiple underlying devices internally, in which case a non-zero
115 + * return code returned by iterate_devices_callout_fn will stop the iteration
116 + * in advance.
117 + *
118 + * Cases requiring _any_ underlying device supporting some kind of attribute,
119 + * should use the iteration structure like dm_table_any_dev_attr(), or call
120 + * it directly. @func should handle semantics of positive examples, e.g.
121 + * capable of something.
122 + *
123 + * Cases requiring _all_ underlying devices supporting some kind of attribute,
124 + * should use the iteration structure like dm_table_supports_nowait() or
125 + * dm_table_supports_discards(). Or introduce dm_table_all_devs_attr() that
126 + * uses an @anti_func that handle semantics of counter examples, e.g. not
127 + * capable of something. So: return !dm_table_any_dev_attr(t, anti_func);
128 + */
129 +static bool dm_table_any_dev_attr(struct dm_table *t,
130 + iterate_devices_callout_fn func)
131 +{
132 + struct dm_target *ti;
133 + unsigned int i;
134 +
135 + for (i = 0; i < dm_table_get_num_targets(t); i++) {
136 + ti = dm_table_get_target(t, i);
137 +
138 + if (ti->type->iterate_devices &&
139 + ti->type->iterate_devices(ti, func, NULL))
140 + return true;
141 + }
142 +
143 + return false;
144 +}
145 +
146 static int count_device(struct dm_target *ti, struct dm_dev *dev,
147 sector_t start, sector_t len, void *data)
148 {
149 @@ -1476,12 +1516,12 @@ static bool dm_table_discard_zeroes_data(struct dm_table *t)
150 return true;
151 }
152
153 -static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
154 - sector_t start, sector_t len, void *data)
155 +static int device_is_rotational(struct dm_target *ti, struct dm_dev *dev,
156 + sector_t start, sector_t len, void *data)
157 {
158 struct request_queue *q = bdev_get_queue(dev->bdev);
159
160 - return q && blk_queue_nonrot(q);
161 + return q && !blk_queue_nonrot(q);
162 }
163
164 static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,
165 @@ -1492,29 +1532,12 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,
166 return q && !blk_queue_add_random(q);
167 }
168
169 -static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,
170 - sector_t start, sector_t len, void *data)
171 +static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,
172 + sector_t start, sector_t len, void *data)
173 {
174 struct request_queue *q = bdev_get_queue(dev->bdev);
175
176 - return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
177 -}
178 -
179 -static bool dm_table_all_devices_attribute(struct dm_table *t,
180 - iterate_devices_callout_fn func)
181 -{
182 - struct dm_target *ti;
183 - unsigned i = 0;
184 -
185 - while (i < dm_table_get_num_targets(t)) {
186 - ti = dm_table_get_target(t, i++);
187 -
188 - if (!ti->type->iterate_devices ||
189 - !ti->type->iterate_devices(ti, func, NULL))
190 - return false;
191 - }
192 -
193 - return true;
194 + return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
195 }
196
197 static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,
198 @@ -1607,18 +1630,18 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
199 q->limits.discard_zeroes_data = 0;
200
201 /* Ensure that all underlying devices are non-rotational. */
202 - if (dm_table_all_devices_attribute(t, device_is_nonrot))
203 - queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
204 - else
205 + if (dm_table_any_dev_attr(t, device_is_rotational))
206 queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q);
207 + else
208 + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
209
210 if (!dm_table_supports_write_same(t))
211 q->limits.max_write_same_sectors = 0;
212
213 - if (dm_table_all_devices_attribute(t, queue_supports_sg_merge))
214 - queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
215 - else
216 + if (dm_table_any_dev_attr(t, queue_no_sg_merge))
217 queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
218 + else
219 + queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
220
221 dm_table_verify_integrity(t);
222
223 @@ -1628,7 +1651,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
224 * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not
225 * have it set.
226 */
227 - if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_is_not_random))
228 + if (blk_queue_add_random(q) && dm_table_any_dev_attr(t, device_is_not_random))
229 queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
230
231 /*
232 diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
233 index d30deee1effda..30b490329f55e 100644
234 --- a/drivers/misc/eeprom/eeprom_93xx46.c
235 +++ b/drivers/misc/eeprom/eeprom_93xx46.c
236 @@ -38,6 +38,10 @@ static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = {
237 EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH,
238 };
239
240 +static const struct eeprom_93xx46_devtype_data microchip_93lc46b_data = {
241 + .quirks = EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE,
242 +};
243 +
244 struct eeprom_93xx46_dev {
245 struct spi_device *spi;
246 struct eeprom_93xx46_platform_data *pdata;
247 @@ -58,6 +62,11 @@ static inline bool has_quirk_instruction_length(struct eeprom_93xx46_dev *edev)
248 return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH;
249 }
250
251 +static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *edev)
252 +{
253 + return edev->pdata->quirks & EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE;
254 +}
255 +
256 static int eeprom_93xx46_read(void *priv, unsigned int off,
257 void *val, size_t count)
258 {
259 @@ -99,6 +108,11 @@ static int eeprom_93xx46_read(void *priv, unsigned int off,
260 dev_dbg(&edev->spi->dev, "read cmd 0x%x, %d Hz\n",
261 cmd_addr, edev->spi->max_speed_hz);
262
263 + if (has_quirk_extra_read_cycle(edev)) {
264 + cmd_addr <<= 1;
265 + bits += 1;
266 + }
267 +
268 spi_message_init(&m);
269
270 t[0].tx_buf = (char *)&cmd_addr;
271 @@ -366,6 +380,7 @@ static void select_deassert(void *context)
272 static const struct of_device_id eeprom_93xx46_of_table[] = {
273 { .compatible = "eeprom-93xx46", },
274 { .compatible = "atmel,at93c46d", .data = &atmel_at93c46d_data, },
275 + { .compatible = "microchip,93lc46b", .data = &microchip_93lc46b_data, },
276 {}
277 };
278 MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table);
279 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
280 index 1fdb1ef5eaaeb..0ebf7500e171e 100644
281 --- a/drivers/pci/quirks.c
282 +++ b/drivers/pci/quirks.c
283 @@ -3911,6 +3911,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9182,
284 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */
285 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0,
286 quirk_dma_func1_alias);
287 +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c135 */
288 +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9215,
289 + quirk_dma_func1_alias);
290 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */
291 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9220,
292 quirk_dma_func1_alias);
293 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
294 index 90015e2cce9bf..ec3cbb7844bce 100644
295 --- a/drivers/platform/x86/acer-wmi.c
296 +++ b/drivers/platform/x86/acer-wmi.c
297 @@ -229,6 +229,7 @@ static int mailled = -1;
298 static int brightness = -1;
299 static int threeg = -1;
300 static int force_series;
301 +static int force_caps = -1;
302 static bool ec_raw_mode;
303 static bool has_type_aa;
304 static u16 commun_func_bitmap;
305 @@ -238,11 +239,13 @@ module_param(mailled, int, 0444);
306 module_param(brightness, int, 0444);
307 module_param(threeg, int, 0444);
308 module_param(force_series, int, 0444);
309 +module_param(force_caps, int, 0444);
310 module_param(ec_raw_mode, bool, 0444);
311 MODULE_PARM_DESC(mailled, "Set initial state of Mail LED");
312 MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness");
313 MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware");
314 MODULE_PARM_DESC(force_series, "Force a different laptop series");
315 +MODULE_PARM_DESC(force_caps, "Force the capability bitmask to this value");
316 MODULE_PARM_DESC(ec_raw_mode, "Enable EC raw mode");
317
318 struct acer_data {
319 @@ -2198,7 +2201,7 @@ static int __init acer_wmi_init(void)
320 }
321 /* WMID always provides brightness methods */
322 interface->capability |= ACER_CAP_BRIGHTNESS;
323 - } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
324 + } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa && force_caps == -1) {
325 pr_err("No WMID device detection method found\n");
326 return -ENODEV;
327 }
328 @@ -2228,6 +2231,9 @@ static int __init acer_wmi_init(void)
329 if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
330 interface->capability &= ~ACER_CAP_BRIGHTNESS;
331
332 + if (force_caps != -1)
333 + interface->capability = force_caps;
334 +
335 if (wmi_has_guid(WMID_GUID3)) {
336 if (ec_raw_mode) {
337 if (ACPI_FAILURE(acer_wmi_enable_ec_raw())) {
338 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
339 index 5aa07de5750e8..4b5d806e8fc67 100644
340 --- a/fs/btrfs/raid56.c
341 +++ b/fs/btrfs/raid56.c
342 @@ -1179,22 +1179,19 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
343 int nr_data = rbio->nr_data;
344 int stripe;
345 int pagenr;
346 - int p_stripe = -1;
347 - int q_stripe = -1;
348 + bool has_qstripe;
349 struct bio_list bio_list;
350 struct bio *bio;
351 int ret;
352
353 bio_list_init(&bio_list);
354
355 - if (rbio->real_stripes - rbio->nr_data == 1) {
356 - p_stripe = rbio->real_stripes - 1;
357 - } else if (rbio->real_stripes - rbio->nr_data == 2) {
358 - p_stripe = rbio->real_stripes - 2;
359 - q_stripe = rbio->real_stripes - 1;
360 - } else {
361 + if (rbio->real_stripes - rbio->nr_data == 1)
362 + has_qstripe = false;
363 + else if (rbio->real_stripes - rbio->nr_data == 2)
364 + has_qstripe = true;
365 + else
366 BUG();
367 - }
368
369 /* at this point we either have a full stripe,
370 * or we've read the full stripe from the drive.
371 @@ -1238,7 +1235,7 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
372 SetPageUptodate(p);
373 pointers[stripe++] = kmap(p);
374
375 - if (q_stripe != -1) {
376 + if (has_qstripe) {
377
378 /*
379 * raid6, add the qstripe and call the
380 @@ -2306,8 +2303,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
381 int nr_data = rbio->nr_data;
382 int stripe;
383 int pagenr;
384 - int p_stripe = -1;
385 - int q_stripe = -1;
386 + bool has_qstripe;
387 struct page *p_page = NULL;
388 struct page *q_page = NULL;
389 struct bio_list bio_list;
390 @@ -2317,14 +2313,12 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
391
392 bio_list_init(&bio_list);
393
394 - if (rbio->real_stripes - rbio->nr_data == 1) {
395 - p_stripe = rbio->real_stripes - 1;
396 - } else if (rbio->real_stripes - rbio->nr_data == 2) {
397 - p_stripe = rbio->real_stripes - 2;
398 - q_stripe = rbio->real_stripes - 1;
399 - } else {
400 + if (rbio->real_stripes - rbio->nr_data == 1)
401 + has_qstripe = false;
402 + else if (rbio->real_stripes - rbio->nr_data == 2)
403 + has_qstripe = true;
404 + else
405 BUG();
406 - }
407
408 if (bbio->num_tgtdevs && bbio->tgtdev_map[rbio->scrubp]) {
409 is_replace = 1;
410 @@ -2346,17 +2340,22 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
411 goto cleanup;
412 SetPageUptodate(p_page);
413
414 - if (q_stripe != -1) {
415 + if (has_qstripe) {
416 + /* RAID6, allocate and map temp space for the Q stripe */
417 q_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
418 if (!q_page) {
419 __free_page(p_page);
420 goto cleanup;
421 }
422 SetPageUptodate(q_page);
423 + pointers[rbio->real_stripes - 1] = kmap(q_page);
424 }
425
426 atomic_set(&rbio->error, 0);
427
428 + /* Map the parity stripe just once */
429 + pointers[nr_data] = kmap(p_page);
430 +
431 for_each_set_bit(pagenr, rbio->dbitmap, rbio->stripe_npages) {
432 struct page *p;
433 void *parity;
434 @@ -2366,17 +2365,8 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
435 pointers[stripe] = kmap(p);
436 }
437
438 - /* then add the parity stripe */
439 - pointers[stripe++] = kmap(p_page);
440 -
441 - if (q_stripe != -1) {
442 -
443 - /*
444 - * raid6, add the qstripe and call the
445 - * library function to fill in our p/q
446 - */
447 - pointers[stripe++] = kmap(q_page);
448 -
449 + if (has_qstripe) {
450 + /* RAID6, call the library function to fill in our P/Q */
451 raid6_call.gen_syndrome(rbio->real_stripes, PAGE_SIZE,
452 pointers);
453 } else {
454 @@ -2397,12 +2387,14 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
455
456 for (stripe = 0; stripe < nr_data; stripe++)
457 kunmap(page_in_rbio(rbio, stripe, pagenr, 0));
458 - kunmap(p_page);
459 }
460
461 + kunmap(p_page);
462 __free_page(p_page);
463 - if (q_page)
464 + if (q_page) {
465 + kunmap(q_page);
466 __free_page(q_page);
467 + }
468
469 writeback:
470 /*
471 diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h
472 index 885f587a35550..affe4d1d7d4a5 100644
473 --- a/include/linux/eeprom_93xx46.h
474 +++ b/include/linux/eeprom_93xx46.h
475 @@ -16,6 +16,8 @@ struct eeprom_93xx46_platform_data {
476 #define EEPROM_93XX46_QUIRK_SINGLE_WORD_READ (1 << 0)
477 /* Instructions such as EWEN are (addrlen + 2) in length. */
478 #define EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH (1 << 1)
479 +/* Add extra cycle after address during a read */
480 +#define EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE BIT(2)
481
482 /*
483 * optional hooks to control additional logic
484 diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
485 index 18ee7768b7c40..ae8aa10a4a5d0 100644
486 --- a/sound/pci/ctxfi/cthw20k2.c
487 +++ b/sound/pci/ctxfi/cthw20k2.c
488 @@ -995,7 +995,7 @@ static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf)
489
490 if (idx < 4) {
491 /* S/PDIF output */
492 - switch ((conf & 0x7)) {
493 + switch ((conf & 0xf)) {
494 case 1:
495 set_field(&ctl->txctl[idx], ATXCTL_NUC, 0);
496 break;
497 diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c
498 index 4bb905925b0e4..99c26a175beb1 100644
499 --- a/tools/usb/usbip/libsrc/usbip_host_common.c
500 +++ b/tools/usb/usbip/libsrc/usbip_host_common.c
501 @@ -35,7 +35,7 @@
502 #include "list.h"
503 #include "sysfs_utils.h"
504
505 -struct udev *udev_context;
506 +extern struct udev *udev_context;
507
508 static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
509 {