Magellan Linux

Contents of /trunk/kernel-alx/patches-4.9/0329-4.9.230-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3604 - (show annotations) (download)
Thu Aug 13 10:21:43 2020 UTC (3 years, 8 months ago) by niro
File size: 37602 byte(s)
linux-230
1 diff --git a/Makefile b/Makefile
2 index a8a9704a6e2e..e426d0c90188 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 229
9 +SUBLEVEL = 230
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
14 index 8e0749665934..5f717473d08e 100644
15 --- a/arch/mips/kernel/traps.c
16 +++ b/arch/mips/kernel/traps.c
17 @@ -2137,6 +2137,7 @@ static void configure_status(void)
18
19 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
20 status_set);
21 + back_to_back_c0_hazard();
22 }
23
24 unsigned int hwrena;
25 diff --git a/crypto/af_alg.c b/crypto/af_alg.c
26 index cf3975ee4fd8..c48ddeb6c328 100644
27 --- a/crypto/af_alg.c
28 +++ b/crypto/af_alg.c
29 @@ -130,21 +130,15 @@ EXPORT_SYMBOL_GPL(af_alg_release);
30 void af_alg_release_parent(struct sock *sk)
31 {
32 struct alg_sock *ask = alg_sk(sk);
33 - unsigned int nokey = ask->nokey_refcnt;
34 - bool last = nokey && !ask->refcnt;
35 + unsigned int nokey = atomic_read(&ask->nokey_refcnt);
36
37 sk = ask->parent;
38 ask = alg_sk(sk);
39
40 - local_bh_disable();
41 - bh_lock_sock(sk);
42 - ask->nokey_refcnt -= nokey;
43 - if (!last)
44 - last = !--ask->refcnt;
45 - bh_unlock_sock(sk);
46 - local_bh_enable();
47 + if (nokey)
48 + atomic_dec(&ask->nokey_refcnt);
49
50 - if (last)
51 + if (atomic_dec_and_test(&ask->refcnt))
52 sock_put(sk);
53 }
54 EXPORT_SYMBOL_GPL(af_alg_release_parent);
55 @@ -189,7 +183,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
56
57 err = -EBUSY;
58 lock_sock(sk);
59 - if (ask->refcnt | ask->nokey_refcnt)
60 + if (atomic_read(&ask->refcnt))
61 goto unlock;
62
63 swap(ask->type, type);
64 @@ -238,7 +232,7 @@ static int alg_setsockopt(struct socket *sock, int level, int optname,
65 int err = -EBUSY;
66
67 lock_sock(sk);
68 - if (ask->refcnt)
69 + if (atomic_read(&ask->refcnt) != atomic_read(&ask->nokey_refcnt))
70 goto unlock;
71
72 type = ask->type;
73 @@ -305,12 +299,14 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
74
75 sk2->sk_family = PF_ALG;
76
77 - if (nokey || !ask->refcnt++)
78 + if (atomic_inc_return_relaxed(&ask->refcnt) == 1)
79 sock_hold(sk);
80 - ask->nokey_refcnt += nokey;
81 + if (nokey) {
82 + atomic_inc(&ask->nokey_refcnt);
83 + atomic_set(&alg_sk(sk2)->nokey_refcnt, 1);
84 + }
85 alg_sk(sk2)->parent = sk;
86 alg_sk(sk2)->type = type;
87 - alg_sk(sk2)->nokey_refcnt = nokey;
88
89 newsock->ops = type->ops;
90 newsock->state = SS_CONNECTED;
91 diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
92 index 6c11537ca404..d38f098350f6 100644
93 --- a/crypto/algif_aead.c
94 +++ b/crypto/algif_aead.c
95 @@ -747,7 +747,7 @@ static int aead_check_key(struct socket *sock)
96 struct alg_sock *ask = alg_sk(sk);
97
98 lock_sock(sk);
99 - if (ask->refcnt)
100 + if (!atomic_read(&ask->nokey_refcnt))
101 goto unlock_child;
102
103 psk = ask->parent;
104 @@ -759,11 +759,8 @@ static int aead_check_key(struct socket *sock)
105 if (!tfm->has_key)
106 goto unlock;
107
108 - if (!pask->refcnt++)
109 - sock_hold(psk);
110 -
111 - ask->refcnt = 1;
112 - sock_put(psk);
113 + atomic_dec(&pask->nokey_refcnt);
114 + atomic_set(&ask->nokey_refcnt, 0);
115
116 err = 0;
117
118 diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
119 index 731b5fb8567b..7ae4f79cc839 100644
120 --- a/crypto/algif_hash.c
121 +++ b/crypto/algif_hash.c
122 @@ -308,7 +308,7 @@ static int hash_check_key(struct socket *sock)
123 struct alg_sock *ask = alg_sk(sk);
124
125 lock_sock(sk);
126 - if (ask->refcnt)
127 + if (!atomic_read(&ask->nokey_refcnt))
128 goto unlock_child;
129
130 psk = ask->parent;
131 @@ -320,11 +320,8 @@ static int hash_check_key(struct socket *sock)
132 if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
133 goto unlock;
134
135 - if (!pask->refcnt++)
136 - sock_hold(psk);
137 -
138 - ask->refcnt = 1;
139 - sock_put(psk);
140 + atomic_dec(&pask->nokey_refcnt);
141 + atomic_set(&ask->nokey_refcnt, 0);
142
143 err = 0;
144
145 diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
146 index b28f45aca2ef..931a777a4ec4 100644
147 --- a/crypto/algif_skcipher.c
148 +++ b/crypto/algif_skcipher.c
149 @@ -774,7 +774,7 @@ static int skcipher_check_key(struct socket *sock)
150 struct alg_sock *ask = alg_sk(sk);
151
152 lock_sock(sk);
153 - if (ask->refcnt)
154 + if (!atomic_read(&ask->nokey_refcnt))
155 goto unlock_child;
156
157 psk = ask->parent;
158 @@ -786,11 +786,8 @@ static int skcipher_check_key(struct socket *sock)
159 if (!tfm->has_key)
160 goto unlock;
161
162 - if (!pask->refcnt++)
163 - sock_hold(psk);
164 -
165 - ask->refcnt = 1;
166 - sock_put(psk);
167 + atomic_dec(&pask->nokey_refcnt);
168 + atomic_set(&ask->nokey_refcnt, 0);
169
170 err = 0;
171
172 diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
173 index f287eec36b28..e57a1f6e39d5 100644
174 --- a/drivers/block/virtio_blk.c
175 +++ b/drivers/block/virtio_blk.c
176 @@ -749,6 +749,7 @@ out_put_disk:
177 put_disk(vblk->disk);
178 out_free_vq:
179 vdev->config->del_vqs(vdev);
180 + kfree(vblk->vqs);
181 out_free_vblk:
182 kfree(vblk);
183 out_free_index:
184 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
185 index 1c5f23224b3c..020dd07d1c23 100644
186 --- a/drivers/edac/amd64_edac.c
187 +++ b/drivers/edac/amd64_edac.c
188 @@ -243,6 +243,8 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
189
190 if (pvt->model == 0x60)
191 amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
192 + else
193 + amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
194 } else
195 amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
196
197 diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
198 index c981be17d3c0..8ebc6f8bf9b9 100644
199 --- a/drivers/firmware/efi/Kconfig
200 +++ b/drivers/firmware/efi/Kconfig
201 @@ -129,6 +129,17 @@ config EFI_TEST
202 Say Y here to enable the runtime services support via /dev/efi_test.
203 If unsure, say N.
204
205 +config EFI_CUSTOM_SSDT_OVERLAYS
206 + bool "Load custom ACPI SSDT overlay from an EFI variable"
207 + depends on EFI_VARS && ACPI
208 + default ACPI_TABLE_UPGRADE
209 + help
210 + Allow loading of an ACPI SSDT overlay from an EFI variable specified
211 + by a kernel command line option.
212 +
213 + See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
214 + information.
215 +
216 endmenu
217
218 config UEFI_CPER
219 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
220 index d89457d62a24..6e6a590b8388 100644
221 --- a/drivers/firmware/efi/efi.c
222 +++ b/drivers/firmware/efi/efi.c
223 @@ -198,7 +198,7 @@ static void generic_ops_unregister(void)
224 efivars_unregister(&generic_efivars);
225 }
226
227 -#if IS_ENABLED(CONFIG_ACPI)
228 +#ifdef CONFIG_EFI_CUSTOM_SSDT_OVERLAYS
229 #define EFIVAR_SSDT_NAME_MAX 16
230 static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
231 static int __init efivar_ssdt_setup(char *str)
232 diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
233 index e27f7e12c05b..9b4ad6c74041 100644
234 --- a/drivers/hwmon/acpi_power_meter.c
235 +++ b/drivers/hwmon/acpi_power_meter.c
236 @@ -895,7 +895,7 @@ static int acpi_power_meter_add(struct acpi_device *device)
237
238 res = setup_attrs(resource);
239 if (res)
240 - goto exit_free;
241 + goto exit_free_capability;
242
243 resource->hwmon_dev = hwmon_device_register(&device->dev);
244 if (IS_ERR(resource->hwmon_dev)) {
245 @@ -908,6 +908,8 @@ static int acpi_power_meter_add(struct acpi_device *device)
246
247 exit_remove:
248 remove_attrs(resource);
249 +exit_free_capability:
250 + free_capabilities(resource);
251 exit_free:
252 kfree(resource);
253 exit:
254 diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c
255 index f03a71722849..d4bb3d6aaf18 100644
256 --- a/drivers/hwmon/max6697.c
257 +++ b/drivers/hwmon/max6697.c
258 @@ -46,8 +46,9 @@ static const u8 MAX6697_REG_CRIT[] = {
259 * Map device tree / platform data register bit map to chip bit map.
260 * Applies to alert register and over-temperature register.
261 */
262 -#define MAX6697_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \
263 +#define MAX6697_ALERT_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \
264 (((reg) & 0x01) << 6) | ((reg) & 0x80))
265 +#define MAX6697_OVERT_MAP_BITS(reg) (((reg) >> 1) | (((reg) & 0x01) << 7))
266
267 #define MAX6697_REG_STAT(n) (0x44 + (n))
268
269 @@ -586,12 +587,12 @@ static int max6697_init_chip(struct max6697_data *data,
270 return ret;
271
272 ret = i2c_smbus_write_byte_data(client, MAX6697_REG_ALERT_MASK,
273 - MAX6697_MAP_BITS(pdata->alert_mask));
274 + MAX6697_ALERT_MAP_BITS(pdata->alert_mask));
275 if (ret < 0)
276 return ret;
277
278 ret = i2c_smbus_write_byte_data(client, MAX6697_REG_OVERT_MASK,
279 - MAX6697_MAP_BITS(pdata->over_temperature_mask));
280 + MAX6697_OVERT_MAP_BITS(pdata->over_temperature_mask));
281 if (ret < 0)
282 return ret;
283
284 diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
285 index e370804ec8bc..3a9db4626cb6 100644
286 --- a/drivers/i2c/algos/i2c-algo-pca.c
287 +++ b/drivers/i2c/algos/i2c-algo-pca.c
288 @@ -326,7 +326,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
289 DEB2("BUS ERROR - SDA Stuck low\n");
290 pca_reset(adap);
291 goto out;
292 - case 0x90: /* Bus error - SCL stuck low */
293 + case 0x78: /* Bus error - SCL stuck low (PCA9665) */
294 + case 0x90: /* Bus error - SCL stuck low (PCA9564) */
295 DEB2("BUS ERROR - SCL Stuck low\n");
296 pca_reset(adap);
297 goto out;
298 diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c
299 index 49d2debb334e..6afad4d3385a 100644
300 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c
301 +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c
302 @@ -47,7 +47,7 @@ static int fill_match_fields(struct adapter *adap,
303 bool next_header)
304 {
305 unsigned int i, j;
306 - u32 val, mask;
307 + __be32 val, mask;
308 int off, err;
309 bool found;
310
311 @@ -217,7 +217,7 @@ int cxgb4_config_knode(struct net_device *dev, __be16 protocol,
312 const struct cxgb4_next_header *next;
313 bool found = false;
314 unsigned int i, j;
315 - u32 val, mask;
316 + __be32 val, mask;
317 int off;
318
319 if (t->table[link_uhtid - 1].link_handle) {
320 @@ -231,10 +231,10 @@ int cxgb4_config_knode(struct net_device *dev, __be16 protocol,
321
322 /* Try to find matches that allow jumps to next header. */
323 for (i = 0; next[i].jump; i++) {
324 - if (next[i].offoff != cls->knode.sel->offoff ||
325 - next[i].shift != cls->knode.sel->offshift ||
326 - next[i].mask != cls->knode.sel->offmask ||
327 - next[i].offset != cls->knode.sel->off)
328 + if (next[i].sel.offoff != cls->knode.sel->offoff ||
329 + next[i].sel.offshift != cls->knode.sel->offshift ||
330 + next[i].sel.offmask != cls->knode.sel->offmask ||
331 + next[i].sel.off != cls->knode.sel->off)
332 continue;
333
334 /* Found a possible candidate. Find a key that
335 @@ -246,9 +246,9 @@ int cxgb4_config_knode(struct net_device *dev, __be16 protocol,
336 val = cls->knode.sel->keys[j].val;
337 mask = cls->knode.sel->keys[j].mask;
338
339 - if (next[i].match_off == off &&
340 - next[i].match_val == val &&
341 - next[i].match_mask == mask) {
342 + if (next[i].key.off == off &&
343 + next[i].key.val == val &&
344 + next[i].key.mask == mask) {
345 found = true;
346 break;
347 }
348 diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
349 index a4b99edcc339..141085e159e5 100644
350 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
351 +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
352 @@ -38,12 +38,12 @@
353 struct cxgb4_match_field {
354 int off; /* Offset from the beginning of the header to match */
355 /* Fill the value/mask pair in the spec if matched */
356 - int (*val)(struct ch_filter_specification *f, u32 val, u32 mask);
357 + int (*val)(struct ch_filter_specification *f, __be32 val, __be32 mask);
358 };
359
360 /* IPv4 match fields */
361 static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f,
362 - u32 val, u32 mask)
363 + __be32 val, __be32 mask)
364 {
365 f->val.tos = (ntohl(val) >> 16) & 0x000000FF;
366 f->mask.tos = (ntohl(mask) >> 16) & 0x000000FF;
367 @@ -52,7 +52,7 @@ static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f,
368 }
369
370 static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f,
371 - u32 val, u32 mask)
372 + __be32 val, __be32 mask)
373 {
374 u32 mask_val;
375 u8 frag_val;
376 @@ -74,7 +74,7 @@ static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f,
377 }
378
379 static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f,
380 - u32 val, u32 mask)
381 + __be32 val, __be32 mask)
382 {
383 f->val.proto = (ntohl(val) >> 16) & 0x000000FF;
384 f->mask.proto = (ntohl(mask) >> 16) & 0x000000FF;
385 @@ -83,7 +83,7 @@ static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f,
386 }
387
388 static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f,
389 - u32 val, u32 mask)
390 + __be32 val, __be32 mask)
391 {
392 memcpy(&f->val.fip[0], &val, sizeof(u32));
393 memcpy(&f->mask.fip[0], &mask, sizeof(u32));
394 @@ -92,7 +92,7 @@ static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f,
395 }
396
397 static inline int cxgb4_fill_ipv4_dst_ip(struct ch_filter_specification *f,
398 - u32 val, u32 mask)
399 + __be32 val, __be32 mask)
400 {
401 memcpy(&f->val.lip[0], &val, sizeof(u32));
402 memcpy(&f->mask.lip[0], &mask, sizeof(u32));
403 @@ -111,7 +111,7 @@ static const struct cxgb4_match_field cxgb4_ipv4_fields[] = {
404
405 /* IPv6 match fields */
406 static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f,
407 - u32 val, u32 mask)
408 + __be32 val, __be32 mask)
409 {
410 f->val.tos = (ntohl(val) >> 20) & 0x000000FF;
411 f->mask.tos = (ntohl(mask) >> 20) & 0x000000FF;
412 @@ -120,7 +120,7 @@ static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f,
413 }
414
415 static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f,
416 - u32 val, u32 mask)
417 + __be32 val, __be32 mask)
418 {
419 f->val.proto = (ntohl(val) >> 8) & 0x000000FF;
420 f->mask.proto = (ntohl(mask) >> 8) & 0x000000FF;
421 @@ -129,7 +129,7 @@ static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f,
422 }
423
424 static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f,
425 - u32 val, u32 mask)
426 + __be32 val, __be32 mask)
427 {
428 memcpy(&f->val.fip[0], &val, sizeof(u32));
429 memcpy(&f->mask.fip[0], &mask, sizeof(u32));
430 @@ -138,7 +138,7 @@ static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f,
431 }
432
433 static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f,
434 - u32 val, u32 mask)
435 + __be32 val, __be32 mask)
436 {
437 memcpy(&f->val.fip[4], &val, sizeof(u32));
438 memcpy(&f->mask.fip[4], &mask, sizeof(u32));
439 @@ -147,7 +147,7 @@ static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f,
440 }
441
442 static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f,
443 - u32 val, u32 mask)
444 + __be32 val, __be32 mask)
445 {
446 memcpy(&f->val.fip[8], &val, sizeof(u32));
447 memcpy(&f->mask.fip[8], &mask, sizeof(u32));
448 @@ -156,7 +156,7 @@ static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f,
449 }
450
451 static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f,
452 - u32 val, u32 mask)
453 + __be32 val, __be32 mask)
454 {
455 memcpy(&f->val.fip[12], &val, sizeof(u32));
456 memcpy(&f->mask.fip[12], &mask, sizeof(u32));
457 @@ -165,7 +165,7 @@ static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f,
458 }
459
460 static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f,
461 - u32 val, u32 mask)
462 + __be32 val, __be32 mask)
463 {
464 memcpy(&f->val.lip[0], &val, sizeof(u32));
465 memcpy(&f->mask.lip[0], &mask, sizeof(u32));
466 @@ -174,7 +174,7 @@ static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f,
467 }
468
469 static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f,
470 - u32 val, u32 mask)
471 + __be32 val, __be32 mask)
472 {
473 memcpy(&f->val.lip[4], &val, sizeof(u32));
474 memcpy(&f->mask.lip[4], &mask, sizeof(u32));
475 @@ -183,7 +183,7 @@ static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f,
476 }
477
478 static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f,
479 - u32 val, u32 mask)
480 + __be32 val, __be32 mask)
481 {
482 memcpy(&f->val.lip[8], &val, sizeof(u32));
483 memcpy(&f->mask.lip[8], &mask, sizeof(u32));
484 @@ -192,7 +192,7 @@ static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f,
485 }
486
487 static inline int cxgb4_fill_ipv6_dst_ip3(struct ch_filter_specification *f,
488 - u32 val, u32 mask)
489 + __be32 val, __be32 mask)
490 {
491 memcpy(&f->val.lip[12], &val, sizeof(u32));
492 memcpy(&f->mask.lip[12], &mask, sizeof(u32));
493 @@ -216,7 +216,7 @@ static const struct cxgb4_match_field cxgb4_ipv6_fields[] = {
494
495 /* TCP/UDP match */
496 static inline int cxgb4_fill_l4_ports(struct ch_filter_specification *f,
497 - u32 val, u32 mask)
498 + __be32 val, __be32 mask)
499 {
500 f->val.fport = ntohl(val) >> 16;
501 f->mask.fport = ntohl(mask) >> 16;
502 @@ -237,19 +237,13 @@ static const struct cxgb4_match_field cxgb4_udp_fields[] = {
503 };
504
505 struct cxgb4_next_header {
506 - unsigned int offset; /* Offset to next header */
507 - /* offset, shift, and mask added to offset above
508 + /* Offset, shift, and mask added to beginning of the header
509 * to get to next header. Useful when using a header
510 * field's value to jump to next header such as IHL field
511 * in IPv4 header.
512 */
513 - unsigned int offoff;
514 - u32 shift;
515 - u32 mask;
516 - /* match criteria to make this jump */
517 - unsigned int match_off;
518 - u32 match_val;
519 - u32 match_mask;
520 + struct tc_u32_sel sel;
521 + struct tc_u32_key key;
522 /* location of jump to make */
523 const struct cxgb4_match_field *jump;
524 };
525 @@ -258,26 +252,74 @@ struct cxgb4_next_header {
526 * IPv4 header.
527 */
528 static const struct cxgb4_next_header cxgb4_ipv4_jumps[] = {
529 - { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF,
530 - .match_off = 8, .match_val = 0x600, .match_mask = 0xFF00,
531 - .jump = cxgb4_tcp_fields },
532 - { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF,
533 - .match_off = 8, .match_val = 0x1100, .match_mask = 0xFF00,
534 - .jump = cxgb4_udp_fields },
535 - { .jump = NULL }
536 + {
537 + /* TCP Jump */
538 + .sel = {
539 + .off = 0,
540 + .offoff = 0,
541 + .offshift = 6,
542 + .offmask = cpu_to_be16(0x0f00),
543 + },
544 + .key = {
545 + .off = 8,
546 + .val = cpu_to_be32(0x00060000),
547 + .mask = cpu_to_be32(0x00ff0000),
548 + },
549 + .jump = cxgb4_tcp_fields,
550 + },
551 + {
552 + /* UDP Jump */
553 + .sel = {
554 + .off = 0,
555 + .offoff = 0,
556 + .offshift = 6,
557 + .offmask = cpu_to_be16(0x0f00),
558 + },
559 + .key = {
560 + .off = 8,
561 + .val = cpu_to_be32(0x00110000),
562 + .mask = cpu_to_be32(0x00ff0000),
563 + },
564 + .jump = cxgb4_udp_fields,
565 + },
566 + { .jump = NULL },
567 };
568
569 /* Accept a rule with a jump directly past the 40 Bytes of IPv6 fixed header
570 * to get to transport layer header.
571 */
572 static const struct cxgb4_next_header cxgb4_ipv6_jumps[] = {
573 - { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0,
574 - .match_off = 4, .match_val = 0x60000, .match_mask = 0xFF0000,
575 - .jump = cxgb4_tcp_fields },
576 - { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0,
577 - .match_off = 4, .match_val = 0x110000, .match_mask = 0xFF0000,
578 - .jump = cxgb4_udp_fields },
579 - { .jump = NULL }
580 + {
581 + /* TCP Jump */
582 + .sel = {
583 + .off = 40,
584 + .offoff = 0,
585 + .offshift = 0,
586 + .offmask = 0,
587 + },
588 + .key = {
589 + .off = 4,
590 + .val = cpu_to_be32(0x00000600),
591 + .mask = cpu_to_be32(0x0000ff00),
592 + },
593 + .jump = cxgb4_tcp_fields,
594 + },
595 + {
596 + /* UDP Jump */
597 + .sel = {
598 + .off = 40,
599 + .offoff = 0,
600 + .offshift = 0,
601 + .offmask = 0,
602 + },
603 + .key = {
604 + .off = 4,
605 + .val = cpu_to_be32(0x00001100),
606 + .mask = cpu_to_be32(0x0000ff00),
607 + },
608 + .jump = cxgb4_udp_fields,
609 + },
610 + { .jump = NULL },
611 };
612
613 struct cxgb4_link {
614 diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
615 index e719ecd69d01..6852ebafd4d3 100644
616 --- a/drivers/net/usb/smsc95xx.c
617 +++ b/drivers/net/usb/smsc95xx.c
618 @@ -1327,7 +1327,7 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
619 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
620
621 if (pdata) {
622 - cancel_delayed_work(&pdata->carrier_check);
623 + cancel_delayed_work_sync(&pdata->carrier_check);
624 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
625 kfree(pdata);
626 pdata = NULL;
627 diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
628 index e31f72b3a22c..54b8e8645e0b 100644
629 --- a/drivers/usb/misc/usbtest.c
630 +++ b/drivers/usb/misc/usbtest.c
631 @@ -2771,6 +2771,7 @@ static void usbtest_disconnect(struct usb_interface *intf)
632
633 usb_set_intfdata(intf, NULL);
634 dev_dbg(&intf->dev, "disconnect\n");
635 + kfree(dev->buf);
636 kfree(dev);
637 }
638
639 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
640 index a83f353e4418..c0033a0d0078 100644
641 --- a/fs/btrfs/extent-tree.c
642 +++ b/fs/btrfs/extent-tree.c
643 @@ -10645,7 +10645,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
644 path = btrfs_alloc_path();
645 if (!path) {
646 ret = -ENOMEM;
647 - goto out_put_group;
648 + goto out;
649 }
650
651 /*
652 @@ -10684,7 +10684,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
653 ret = btrfs_orphan_add(trans, inode);
654 if (ret) {
655 btrfs_add_delayed_iput(inode);
656 - goto out_put_group;
657 + goto out;
658 }
659 clear_nlink(inode);
660 /* One for the block groups ref */
661 @@ -10707,13 +10707,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
662
663 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
664 if (ret < 0)
665 - goto out_put_group;
666 + goto out;
667 if (ret > 0)
668 btrfs_release_path(path);
669 if (ret == 0) {
670 ret = btrfs_del_item(trans, tree_root, path);
671 if (ret)
672 - goto out_put_group;
673 + goto out;
674 btrfs_release_path(path);
675 }
676
677 @@ -10722,6 +10722,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
678 &root->fs_info->block_group_cache_tree);
679 RB_CLEAR_NODE(&block_group->cache_node);
680
681 + /* Once for the block groups rbtree */
682 + btrfs_put_block_group(block_group);
683 +
684 if (root->fs_info->first_logical_byte == block_group->key.objectid)
685 root->fs_info->first_logical_byte = (u64)-1;
686 spin_unlock(&root->fs_info->block_group_cache_lock);
687 @@ -10871,10 +10874,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
688
689 ret = remove_block_group_free_space(trans, root->fs_info, block_group);
690 if (ret)
691 - goto out_put_group;
692 -
693 - /* Once for the block groups rbtree */
694 - btrfs_put_block_group(block_group);
695 + goto out;
696
697 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
698 if (ret > 0)
699 @@ -10884,10 +10884,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
700
701 ret = btrfs_del_item(trans, root, path);
702
703 -out_put_group:
704 +out:
705 /* Once for the lookup reference */
706 btrfs_put_block_group(block_group);
707 -out:
708 btrfs_free_path(path);
709 return ret;
710 }
711 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
712 index c425443c31fe..dfc0b3adf57a 100644
713 --- a/fs/btrfs/inode.c
714 +++ b/fs/btrfs/inode.c
715 @@ -947,7 +947,7 @@ static noinline int cow_file_range(struct inode *inode,
716 u64 alloc_hint = 0;
717 u64 num_bytes;
718 unsigned long ram_size;
719 - u64 disk_num_bytes;
720 + u64 min_alloc_size;
721 u64 cur_alloc_size;
722 u64 blocksize = root->sectorsize;
723 struct btrfs_key ins;
724 @@ -963,7 +963,6 @@ static noinline int cow_file_range(struct inode *inode,
725
726 num_bytes = ALIGN(end - start + 1, blocksize);
727 num_bytes = max(blocksize, num_bytes);
728 - disk_num_bytes = num_bytes;
729
730 /* if this is a small write inside eof, kick off defrag */
731 if (num_bytes < SZ_64K &&
732 @@ -992,18 +991,33 @@ static noinline int cow_file_range(struct inode *inode,
733 }
734 }
735
736 - BUG_ON(disk_num_bytes >
737 - btrfs_super_total_bytes(root->fs_info->super_copy));
738 + BUG_ON(num_bytes > btrfs_super_total_bytes(root->fs_info->super_copy));
739
740 alloc_hint = get_extent_allocation_hint(inode, start, num_bytes);
741 btrfs_drop_extent_cache(inode, start, start + num_bytes - 1, 0);
742
743 - while (disk_num_bytes > 0) {
744 + /*
745 + * Relocation relies on the relocated extents to have exactly the same
746 + * size as the original extents. Normally writeback for relocation data
747 + * extents follows a NOCOW path because relocation preallocates the
748 + * extents. However, due to an operation such as scrub turning a block
749 + * group to RO mode, it may fallback to COW mode, so we must make sure
750 + * an extent allocated during COW has exactly the requested size and can
751 + * not be split into smaller extents, otherwise relocation breaks and
752 + * fails during the stage where it updates the bytenr of file extent
753 + * items.
754 + */
755 + if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID)
756 + min_alloc_size = num_bytes;
757 + else
758 + min_alloc_size = root->sectorsize;
759 +
760 + while (num_bytes > 0) {
761 unsigned long op;
762
763 - cur_alloc_size = disk_num_bytes;
764 + cur_alloc_size = num_bytes;
765 ret = btrfs_reserve_extent(root, cur_alloc_size, cur_alloc_size,
766 - root->sectorsize, 0, alloc_hint,
767 + min_alloc_size, 0, alloc_hint,
768 &ins, 1, 1);
769 if (ret < 0)
770 goto out_unlock;
771 @@ -1058,7 +1072,7 @@ static noinline int cow_file_range(struct inode *inode,
772
773 btrfs_dec_block_group_reservations(root->fs_info, ins.objectid);
774
775 - if (disk_num_bytes < cur_alloc_size)
776 + if (num_bytes < cur_alloc_size)
777 break;
778
779 /* we're not doing compressed IO, don't unlock the first
780 @@ -1076,8 +1090,10 @@ static noinline int cow_file_range(struct inode *inode,
781 delalloc_end, locked_page,
782 EXTENT_LOCKED | EXTENT_DELALLOC,
783 op);
784 - disk_num_bytes -= cur_alloc_size;
785 - num_bytes -= cur_alloc_size;
786 + if (num_bytes < cur_alloc_size)
787 + num_bytes = 0;
788 + else
789 + num_bytes -= cur_alloc_size;
790 alloc_hint = ins.objectid + ins.offset;
791 start += cur_alloc_size;
792 }
793 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
794 index 3545b237187a..df8fab6fc2ca 100644
795 --- a/fs/cifs/connect.c
796 +++ b/fs/cifs/connect.c
797 @@ -4213,9 +4213,12 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
798 vol_info->retry = master_tcon->retry;
799 vol_info->nocase = master_tcon->nocase;
800 vol_info->local_lease = master_tcon->local_lease;
801 + vol_info->resilient = master_tcon->use_resilient;
802 + vol_info->persistent = master_tcon->use_persistent;
803 vol_info->no_linux_ext = !master_tcon->unix_ext;
804 vol_info->sectype = master_tcon->ses->sectype;
805 vol_info->sign = master_tcon->ses->sign;
806 + vol_info->seal = master_tcon->seal;
807
808 rc = cifs_set_vol_auth(vol_info, master_tcon->ses);
809 if (rc) {
810 diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
811 index dfa85ad5b481..3dad943da956 100644
812 --- a/fs/cifs/inode.c
813 +++ b/fs/cifs/inode.c
814 @@ -1770,6 +1770,7 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
815 FILE_UNIX_BASIC_INFO *info_buf_target;
816 unsigned int xid;
817 int rc, tmprc;
818 + bool new_target = d_really_is_negative(target_dentry);
819
820 if (flags & ~RENAME_NOREPLACE)
821 return -EINVAL;
822 @@ -1846,8 +1847,13 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
823 */
824
825 unlink_target:
826 - /* Try unlinking the target dentry if it's not negative */
827 - if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
828 + /*
829 + * If the target dentry was created during the rename, try
830 + * unlinking it if it's not negative
831 + */
832 + if (new_target &&
833 + d_really_is_positive(target_dentry) &&
834 + (rc == -EACCES || rc == -EEXIST)) {
835 if (d_is_dir(target_dentry))
836 tmprc = cifs_rmdir(target_dir, target_dentry);
837 else
838 diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
839 index a2bfd7843f18..4bb6b98782e9 100644
840 --- a/include/crypto/if_alg.h
841 +++ b/include/crypto/if_alg.h
842 @@ -30,8 +30,8 @@ struct alg_sock {
843
844 struct sock *parent;
845
846 - unsigned int refcnt;
847 - unsigned int nokey_refcnt;
848 + atomic_t refcnt;
849 + atomic_t nokey_refcnt;
850
851 const struct af_alg_type *type;
852 void *private;
853 diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
854 index 05e8b6e4edcb..debcd4bf2295 100644
855 --- a/include/linux/sched/sysctl.h
856 +++ b/include/linux/sched/sysctl.h
857 @@ -60,6 +60,7 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice;
858 extern unsigned int sysctl_sched_autogroup_enabled;
859 #endif
860
861 +extern int sysctl_sched_rr_timeslice;
862 extern int sched_rr_timeslice;
863
864 extern int sched_rr_handler(struct ctl_table *table, int write,
865 diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
866 index 9c939c6bf21c..321ccdbb7364 100644
867 --- a/kernel/debug/debug_core.c
868 +++ b/kernel/debug/debug_core.c
869 @@ -488,6 +488,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
870 arch_kgdb_ops.disable_hw_break(regs);
871
872 acquirelock:
873 + rcu_read_lock();
874 /*
875 * Interrupts will be restored by the 'trap return' code, except when
876 * single stepping.
877 @@ -542,6 +543,7 @@ return_normal:
878 atomic_dec(&slaves_in_kgdb);
879 dbg_touch_watchdogs();
880 local_irq_restore(flags);
881 + rcu_read_unlock();
882 return 0;
883 }
884 cpu_relax();
885 @@ -560,6 +562,7 @@ return_normal:
886 raw_spin_unlock(&dbg_master_lock);
887 dbg_touch_watchdogs();
888 local_irq_restore(flags);
889 + rcu_read_unlock();
890
891 goto acquirelock;
892 }
893 @@ -677,6 +680,7 @@ kgdb_restore:
894 raw_spin_unlock(&dbg_master_lock);
895 dbg_touch_watchdogs();
896 local_irq_restore(flags);
897 + rcu_read_unlock();
898
899 return kgdb_info[cpu].ret_state;
900 }
901 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
902 index 870d802c46f9..c7c7ba8807f8 100644
903 --- a/kernel/sched/core.c
904 +++ b/kernel/sched/core.c
905 @@ -8389,8 +8389,9 @@ int sched_rr_handler(struct ctl_table *table, int write,
906 /* make sure that internally we keep jiffies */
907 /* also, writing zero resets timeslice to default */
908 if (!ret && write) {
909 - sched_rr_timeslice = sched_rr_timeslice <= 0 ?
910 - RR_TIMESLICE : msecs_to_jiffies(sched_rr_timeslice);
911 + sched_rr_timeslice =
912 + sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE :
913 + msecs_to_jiffies(sysctl_sched_rr_timeslice);
914 }
915 mutex_unlock(&mutex);
916 return ret;
917 diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
918 index 9ab4d73e9cc9..5034c41a5313 100644
919 --- a/kernel/sched/rt.c
920 +++ b/kernel/sched/rt.c
921 @@ -9,6 +9,7 @@
922 #include <linux/irq_work.h>
923
924 int sched_rr_timeslice = RR_TIMESLICE;
925 +int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
926
927 static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun);
928
929 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
930 index 34449ec0689d..513e6da318c4 100644
931 --- a/kernel/sysctl.c
932 +++ b/kernel/sysctl.c
933 @@ -426,7 +426,7 @@ static struct ctl_table kern_table[] = {
934 },
935 {
936 .procname = "sched_rr_timeslice_ms",
937 - .data = &sched_rr_timeslice,
938 + .data = &sysctl_sched_rr_timeslice,
939 .maxlen = sizeof(int),
940 .mode = 0644,
941 .proc_handler = sched_rr_handler,
942 diff --git a/mm/slub.c b/mm/slub.c
943 index 3d45713187a4..454c1d550ad2 100644
944 --- a/mm/slub.c
945 +++ b/mm/slub.c
946 @@ -624,6 +624,20 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...)
947 va_end(args);
948 }
949
950 +static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
951 + void *freelist, void *nextfree)
952 +{
953 + if ((s->flags & SLAB_CONSISTENCY_CHECKS) &&
954 + !check_valid_pointer(s, page, nextfree)) {
955 + object_err(s, page, freelist, "Freechain corrupt");
956 + freelist = NULL;
957 + slab_fix(s, "Isolate corrupted freechain");
958 + return true;
959 + }
960 +
961 + return false;
962 +}
963 +
964 static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
965 {
966 unsigned int off; /* Offset of last byte */
967 @@ -1305,6 +1319,11 @@ static inline void inc_slabs_node(struct kmem_cache *s, int node,
968 static inline void dec_slabs_node(struct kmem_cache *s, int node,
969 int objects) {}
970
971 +static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
972 + void *freelist, void *nextfree)
973 +{
974 + return false;
975 +}
976 #endif /* CONFIG_SLUB_DEBUG */
977
978 /*
979 @@ -2016,6 +2035,14 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
980 void *prior;
981 unsigned long counters;
982
983 + /*
984 + * If 'nextfree' is invalid, it is possible that the object at
985 + * 'freelist' is already corrupted. So isolate all objects
986 + * starting at 'freelist'.
987 + */
988 + if (freelist_corrupted(s, page, freelist, nextfree))
989 + break;
990 +
991 do {
992 prior = page->freelist;
993 counters = page->counters;
994 @@ -5499,7 +5526,8 @@ static void memcg_propagate_slab_attrs(struct kmem_cache *s)
995 */
996 if (buffer)
997 buf = buffer;
998 - else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf))
999 + else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf) &&
1000 + !IS_ENABLED(CONFIG_SLUB_STATS))
1001 buf = mbuf;
1002 else {
1003 buffer = (char *) get_zeroed_page(GFP_KERNEL);
1004 diff --git a/mm/swap_state.c b/mm/swap_state.c
1005 index 35d7e0ee1c77..f5cb6b23ceda 100644
1006 --- a/mm/swap_state.c
1007 +++ b/mm/swap_state.c
1008 @@ -19,6 +19,7 @@
1009 #include <linux/migrate.h>
1010
1011 #include <asm/pgtable.h>
1012 +#include "internal.h"
1013
1014 /*
1015 * swapper_space is a fiction, retained to simplify the path through
1016 @@ -326,7 +327,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
1017 /*
1018 * call radix_tree_preload() while we can wait.
1019 */
1020 - err = radix_tree_maybe_preload(gfp_mask & GFP_KERNEL);
1021 + err = radix_tree_maybe_preload(gfp_mask & GFP_RECLAIM_MASK);
1022 if (err)
1023 break;
1024
1025 diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
1026 index f65d93639d12..29fe1e7eac88 100644
1027 --- a/net/netfilter/nf_conntrack_h323_main.c
1028 +++ b/net/netfilter/nf_conntrack_h323_main.c
1029 @@ -1225,6 +1225,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
1030 {
1031 .name = "Q.931",
1032 .me = THIS_MODULE,
1033 + .data_len = sizeof(struct nf_ct_h323_master),
1034 .tuple.src.l3num = AF_INET6,
1035 .tuple.src.u.tcp.port = cpu_to_be16(Q931_PORT),
1036 .tuple.dst.protonum = IPPROTO_TCP,
1037 diff --git a/sound/usb/card.h b/sound/usb/card.h
1038 index c4599cf0ddc9..111b0f009afa 100644
1039 --- a/sound/usb/card.h
1040 +++ b/sound/usb/card.h
1041 @@ -80,10 +80,6 @@ struct snd_usb_endpoint {
1042 dma_addr_t sync_dma; /* DMA address of syncbuf */
1043
1044 unsigned int pipe; /* the data i/o pipe */
1045 - unsigned int framesize[2]; /* small/large frame sizes in samples */
1046 - unsigned int sample_rem; /* remainder from division fs/fps */
1047 - unsigned int sample_accum; /* sample accumulator */
1048 - unsigned int fps; /* frames per second */
1049 unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */
1050 unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */
1051 int freqshift; /* how much to shift the feedback value to get Q16.16 */
1052 diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
1053 index b5207e71ed72..30aa5f2df6da 100644
1054 --- a/sound/usb/endpoint.c
1055 +++ b/sound/usb/endpoint.c
1056 @@ -137,12 +137,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep)
1057
1058 /*
1059 * For streaming based on information derived from sync endpoints,
1060 - * prepare_outbound_urb_sizes() will call slave_next_packet_size() to
1061 + * prepare_outbound_urb_sizes() will call next_packet_size() to
1062 * determine the number of samples to be sent in the next packet.
1063 *
1064 - * For implicit feedback, slave_next_packet_size() is unused.
1065 + * For implicit feedback, next_packet_size() is unused.
1066 */
1067 -int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep)
1068 +int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
1069 {
1070 unsigned long flags;
1071 int ret;
1072 @@ -159,29 +159,6 @@ int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep)
1073 return ret;
1074 }
1075
1076 -/*
1077 - * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes()
1078 - * will call next_packet_size() to determine the number of samples to be
1079 - * sent in the next packet.
1080 - */
1081 -int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
1082 -{
1083 - int ret;
1084 -
1085 - if (ep->fill_max)
1086 - return ep->maxframesize;
1087 -
1088 - ep->sample_accum += ep->sample_rem;
1089 - if (ep->sample_accum >= ep->fps) {
1090 - ep->sample_accum -= ep->fps;
1091 - ret = ep->framesize[1];
1092 - } else {
1093 - ret = ep->framesize[0];
1094 - }
1095 -
1096 - return ret;
1097 -}
1098 -
1099 static void retire_outbound_urb(struct snd_usb_endpoint *ep,
1100 struct snd_urb_ctx *urb_ctx)
1101 {
1102 @@ -226,8 +203,6 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep,
1103
1104 if (ctx->packet_size[i])
1105 counts = ctx->packet_size[i];
1106 - else if (ep->sync_master)
1107 - counts = snd_usb_endpoint_slave_next_packet_size(ep);
1108 else
1109 counts = snd_usb_endpoint_next_packet_size(ep);
1110
1111 @@ -900,17 +875,10 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
1112 ep->maxpacksize = fmt->maxpacksize;
1113 ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX);
1114
1115 - if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) {
1116 + if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL)
1117 ep->freqn = get_usb_full_speed_rate(rate);
1118 - ep->fps = 1000;
1119 - } else {
1120 + else
1121 ep->freqn = get_usb_high_speed_rate(rate);
1122 - ep->fps = 8000;
1123 - }
1124 -
1125 - ep->sample_rem = rate % ep->fps;
1126 - ep->framesize[0] = rate / ep->fps;
1127 - ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps;
1128
1129 /* calculate the frequency in 16.16 format */
1130 ep->freqm = ep->freqn;
1131 @@ -969,7 +937,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
1132 ep->active_mask = 0;
1133 ep->unlink_mask = 0;
1134 ep->phase = 0;
1135 - ep->sample_accum = 0;
1136
1137 snd_usb_endpoint_start_quirk(ep);
1138
1139 diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
1140 index 4aad49cbeb5f..584f295d7c77 100644
1141 --- a/sound/usb/endpoint.h
1142 +++ b/sound/usb/endpoint.h
1143 @@ -27,7 +27,6 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
1144 void snd_usb_endpoint_free(struct snd_usb_endpoint *ep);
1145
1146 int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
1147 -int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep);
1148 int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep);
1149
1150 void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
1151 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
1152 index 615213aeda33..9bc995f9b4e1 100644
1153 --- a/sound/usb/pcm.c
1154 +++ b/sound/usb/pcm.c
1155 @@ -1483,8 +1483,6 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
1156 for (i = 0; i < ctx->packets; i++) {
1157 if (ctx->packet_size[i])
1158 counts = ctx->packet_size[i];
1159 - else if (ep->sync_master)
1160 - counts = snd_usb_endpoint_slave_next_packet_size(ep);
1161 else
1162 counts = snd_usb_endpoint_next_packet_size(ep);
1163