1 |
commit: e624fc864e3b04b8f5e32b6a5bd3bb094a537039 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Feb 20 00:06:32 2016 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 20 00:06:32 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e624fc86 |
7 |
|
8 |
Linux patch 3.10.97 |
9 |
|
10 |
0000_README | 4 + |
11 |
1096_linux-3.10.97.patch | 2341 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 2345 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 19931f8..f3215a3 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -426,6 +426,10 @@ Patch: 1095_linux-3.10.96.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 3.10.96 |
21 |
|
22 |
+Patch: 1096_linux-3.10.97.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 3.10.97 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1096_linux-3.10.97.patch b/1096_linux-3.10.97.patch |
31 |
new file mode 100644 |
32 |
index 0000000..487d76e |
33 |
--- /dev/null |
34 |
+++ b/1096_linux-3.10.97.patch |
35 |
@@ -0,0 +1,2341 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index c88ea5d8d19c..f26470169c70 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 3 |
42 |
+ PATCHLEVEL = 10 |
43 |
+-SUBLEVEL = 96 |
44 |
++SUBLEVEL = 97 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = TOSSUG Baby Fish |
47 |
+ |
48 |
+diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h |
49 |
+index 294d251ca7b2..2ae13ce592e8 100644 |
50 |
+--- a/arch/parisc/include/uapi/asm/mman.h |
51 |
++++ b/arch/parisc/include/uapi/asm/mman.h |
52 |
+@@ -46,16 +46,6 @@ |
53 |
+ #define MADV_DONTFORK 10 /* don't inherit across fork */ |
54 |
+ #define MADV_DOFORK 11 /* do inherit across fork */ |
55 |
+ |
56 |
+-/* The range 12-64 is reserved for page size specification. */ |
57 |
+-#define MADV_4K_PAGES 12 /* Use 4K pages */ |
58 |
+-#define MADV_16K_PAGES 14 /* Use 16K pages */ |
59 |
+-#define MADV_64K_PAGES 16 /* Use 64K pages */ |
60 |
+-#define MADV_256K_PAGES 18 /* Use 256K pages */ |
61 |
+-#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */ |
62 |
+-#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */ |
63 |
+-#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ |
64 |
+-#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ |
65 |
+- |
66 |
+ #define MADV_MERGEABLE 65 /* KSM may merge identical pages */ |
67 |
+ #define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */ |
68 |
+ |
69 |
+diff --git a/arch/parisc/include/uapi/asm/siginfo.h b/arch/parisc/include/uapi/asm/siginfo.h |
70 |
+index d7034728f377..1c75565d984b 100644 |
71 |
+--- a/arch/parisc/include/uapi/asm/siginfo.h |
72 |
++++ b/arch/parisc/include/uapi/asm/siginfo.h |
73 |
+@@ -1,6 +1,10 @@ |
74 |
+ #ifndef _PARISC_SIGINFO_H |
75 |
+ #define _PARISC_SIGINFO_H |
76 |
+ |
77 |
++#if defined(__LP64__) |
78 |
++#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) |
79 |
++#endif |
80 |
++ |
81 |
+ #include <asm-generic/siginfo.h> |
82 |
+ |
83 |
+ #undef NSIGTRAP |
84 |
+diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c |
85 |
+index 940188d1942c..ae9aa83854c0 100644 |
86 |
+--- a/arch/parisc/kernel/signal.c |
87 |
++++ b/arch/parisc/kernel/signal.c |
88 |
+@@ -449,6 +449,55 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
89 |
+ regs->gr[28]); |
90 |
+ } |
91 |
+ |
92 |
++/* |
93 |
++ * Check how the syscall number gets loaded into %r20 within |
94 |
++ * the delay branch in userspace and adjust as needed. |
95 |
++ */ |
96 |
++ |
97 |
++static void check_syscallno_in_delay_branch(struct pt_regs *regs) |
98 |
++{ |
99 |
++ u32 opcode, source_reg; |
100 |
++ u32 __user *uaddr; |
101 |
++ int err; |
102 |
++ |
103 |
++ /* Usually we don't have to restore %r20 (the system call number) |
104 |
++ * because it gets loaded in the delay slot of the branch external |
105 |
++ * instruction via the ldi instruction. |
106 |
++ * In some cases a register-to-register copy instruction might have |
107 |
++ * been used instead, in which case we need to copy the syscall |
108 |
++ * number into the source register before returning to userspace. |
109 |
++ */ |
110 |
++ |
111 |
++ /* A syscall is just a branch, so all we have to do is fiddle the |
112 |
++ * return pointer so that the ble instruction gets executed again. |
113 |
++ */ |
114 |
++ regs->gr[31] -= 8; /* delayed branching */ |
115 |
++ |
116 |
++ /* Get assembler opcode of code in delay branch */ |
117 |
++ uaddr = (unsigned int *) ((regs->gr[31] & ~3) + 4); |
118 |
++ err = get_user(opcode, uaddr); |
119 |
++ if (err) |
120 |
++ return; |
121 |
++ |
122 |
++ /* Check if delay branch uses "ldi int,%r20" */ |
123 |
++ if ((opcode & 0xffff0000) == 0x34140000) |
124 |
++ return; /* everything ok, just return */ |
125 |
++ |
126 |
++ /* Check if delay branch uses "nop" */ |
127 |
++ if (opcode == INSN_NOP) |
128 |
++ return; |
129 |
++ |
130 |
++ /* Check if delay branch uses "copy %rX,%r20" */ |
131 |
++ if ((opcode & 0xffe0ffff) == 0x08000254) { |
132 |
++ source_reg = (opcode >> 16) & 31; |
133 |
++ regs->gr[source_reg] = regs->gr[20]; |
134 |
++ return; |
135 |
++ } |
136 |
++ |
137 |
++ pr_warn("syscall restart: %s (pid %d): unexpected opcode 0x%08x\n", |
138 |
++ current->comm, task_pid_nr(current), opcode); |
139 |
++} |
140 |
++ |
141 |
+ static inline void |
142 |
+ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) |
143 |
+ { |
144 |
+@@ -471,10 +520,7 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) |
145 |
+ } |
146 |
+ /* fallthrough */ |
147 |
+ case -ERESTARTNOINTR: |
148 |
+- /* A syscall is just a branch, so all |
149 |
+- * we have to do is fiddle the return pointer. |
150 |
+- */ |
151 |
+- regs->gr[31] -= 8; /* delayed branching */ |
152 |
++ check_syscallno_in_delay_branch(regs); |
153 |
+ break; |
154 |
+ } |
155 |
+ } |
156 |
+@@ -523,15 +569,9 @@ insert_restart_trampoline(struct pt_regs *regs) |
157 |
+ } |
158 |
+ case -ERESTARTNOHAND: |
159 |
+ case -ERESTARTSYS: |
160 |
+- case -ERESTARTNOINTR: { |
161 |
+- /* Hooray for delayed branching. We don't |
162 |
+- * have to restore %r20 (the system call |
163 |
+- * number) because it gets loaded in the delay |
164 |
+- * slot of the branch external instruction. |
165 |
+- */ |
166 |
+- regs->gr[31] -= 8; |
167 |
++ case -ERESTARTNOINTR: |
168 |
++ check_syscallno_in_delay_branch(regs); |
169 |
+ return; |
170 |
+- } |
171 |
+ default: |
172 |
+ break; |
173 |
+ } |
174 |
+diff --git a/arch/sh/include/uapi/asm/unistd_64.h b/arch/sh/include/uapi/asm/unistd_64.h |
175 |
+index e6820c86e8c7..47ebd5b5ed55 100644 |
176 |
+--- a/arch/sh/include/uapi/asm/unistd_64.h |
177 |
++++ b/arch/sh/include/uapi/asm/unistd_64.h |
178 |
+@@ -278,7 +278,7 @@ |
179 |
+ #define __NR_fsetxattr 256 |
180 |
+ #define __NR_getxattr 257 |
181 |
+ #define __NR_lgetxattr 258 |
182 |
+-#define __NR_fgetxattr 269 |
183 |
++#define __NR_fgetxattr 259 |
184 |
+ #define __NR_listxattr 260 |
185 |
+ #define __NR_llistxattr 261 |
186 |
+ #define __NR_flistxattr 262 |
187 |
+diff --git a/crypto/af_alg.c b/crypto/af_alg.c |
188 |
+index 6ef6e2ad344e..0ca108f3c840 100644 |
189 |
+--- a/crypto/af_alg.c |
190 |
++++ b/crypto/af_alg.c |
191 |
+@@ -125,6 +125,23 @@ int af_alg_release(struct socket *sock) |
192 |
+ } |
193 |
+ EXPORT_SYMBOL_GPL(af_alg_release); |
194 |
+ |
195 |
++void af_alg_release_parent(struct sock *sk) |
196 |
++{ |
197 |
++ struct alg_sock *ask = alg_sk(sk); |
198 |
++ bool last; |
199 |
++ |
200 |
++ sk = ask->parent; |
201 |
++ ask = alg_sk(sk); |
202 |
++ |
203 |
++ lock_sock(sk); |
204 |
++ last = !--ask->refcnt; |
205 |
++ release_sock(sk); |
206 |
++ |
207 |
++ if (last) |
208 |
++ sock_put(sk); |
209 |
++} |
210 |
++EXPORT_SYMBOL_GPL(af_alg_release_parent); |
211 |
++ |
212 |
+ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
213 |
+ { |
214 |
+ struct sock *sk = sock->sk; |
215 |
+@@ -132,6 +149,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
216 |
+ struct sockaddr_alg *sa = (void *)uaddr; |
217 |
+ const struct af_alg_type *type; |
218 |
+ void *private; |
219 |
++ int err; |
220 |
+ |
221 |
+ if (sock->state == SS_CONNECTED) |
222 |
+ return -EINVAL; |
223 |
+@@ -157,16 +175,22 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
224 |
+ return PTR_ERR(private); |
225 |
+ } |
226 |
+ |
227 |
++ err = -EBUSY; |
228 |
+ lock_sock(sk); |
229 |
++ if (ask->refcnt) |
230 |
++ goto unlock; |
231 |
+ |
232 |
+ swap(ask->type, type); |
233 |
+ swap(ask->private, private); |
234 |
+ |
235 |
++ err = 0; |
236 |
++ |
237 |
++unlock: |
238 |
+ release_sock(sk); |
239 |
+ |
240 |
+ alg_do_release(type, private); |
241 |
+ |
242 |
+- return 0; |
243 |
++ return err; |
244 |
+ } |
245 |
+ |
246 |
+ static int alg_setkey(struct sock *sk, char __user *ukey, |
247 |
+@@ -199,11 +223,15 @@ static int alg_setsockopt(struct socket *sock, int level, int optname, |
248 |
+ struct sock *sk = sock->sk; |
249 |
+ struct alg_sock *ask = alg_sk(sk); |
250 |
+ const struct af_alg_type *type; |
251 |
+- int err = -ENOPROTOOPT; |
252 |
++ int err = -EBUSY; |
253 |
+ |
254 |
+ lock_sock(sk); |
255 |
++ if (ask->refcnt) |
256 |
++ goto unlock; |
257 |
++ |
258 |
+ type = ask->type; |
259 |
+ |
260 |
++ err = -ENOPROTOOPT; |
261 |
+ if (level != SOL_ALG || !type) |
262 |
+ goto unlock; |
263 |
+ |
264 |
+@@ -247,14 +275,13 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) |
265 |
+ security_sk_clone(sk, sk2); |
266 |
+ |
267 |
+ err = type->accept(ask->private, sk2); |
268 |
+- if (err) { |
269 |
+- sk_free(sk2); |
270 |
++ if (err) |
271 |
+ goto unlock; |
272 |
+- } |
273 |
+ |
274 |
+ sk2->sk_family = PF_ALG; |
275 |
+ |
276 |
+- sock_hold(sk); |
277 |
++ if (!ask->refcnt++) |
278 |
++ sock_hold(sk); |
279 |
+ alg_sk(sk2)->parent = sk; |
280 |
+ alg_sk(sk2)->type = type; |
281 |
+ |
282 |
+diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c |
283 |
+index 850246206b12..c542c0d88afd 100644 |
284 |
+--- a/crypto/algif_hash.c |
285 |
++++ b/crypto/algif_hash.c |
286 |
+@@ -51,7 +51,8 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, |
287 |
+ |
288 |
+ lock_sock(sk); |
289 |
+ if (!ctx->more) { |
290 |
+- err = crypto_ahash_init(&ctx->req); |
291 |
++ err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req), |
292 |
++ &ctx->completion); |
293 |
+ if (err) |
294 |
+ goto unlock; |
295 |
+ } |
296 |
+@@ -131,6 +132,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page, |
297 |
+ } else { |
298 |
+ if (!ctx->more) { |
299 |
+ err = crypto_ahash_init(&ctx->req); |
300 |
++ err = af_alg_wait_for_completion(err, &ctx->completion); |
301 |
+ if (err) |
302 |
+ goto unlock; |
303 |
+ } |
304 |
+@@ -192,9 +194,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) |
305 |
+ struct sock *sk2; |
306 |
+ struct alg_sock *ask2; |
307 |
+ struct hash_ctx *ctx2; |
308 |
++ bool more; |
309 |
+ int err; |
310 |
+ |
311 |
+- err = crypto_ahash_export(req, state); |
312 |
++ lock_sock(sk); |
313 |
++ more = ctx->more; |
314 |
++ err = more ? crypto_ahash_export(req, state) : 0; |
315 |
++ release_sock(sk); |
316 |
++ |
317 |
+ if (err) |
318 |
+ return err; |
319 |
+ |
320 |
+@@ -205,7 +212,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) |
321 |
+ sk2 = newsock->sk; |
322 |
+ ask2 = alg_sk(sk2); |
323 |
+ ctx2 = ask2->private; |
324 |
+- ctx2->more = 1; |
325 |
++ ctx2->more = more; |
326 |
++ |
327 |
++ if (!more) |
328 |
++ return err; |
329 |
+ |
330 |
+ err = crypto_ahash_import(&ctx2->req, state); |
331 |
+ if (err) { |
332 |
+diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c |
333 |
+index c7666f401381..a3dfc0d83107 100644 |
334 |
+--- a/crypto/crypto_user.c |
335 |
++++ b/crypto/crypto_user.c |
336 |
+@@ -477,6 +477,7 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
337 |
+ if (link->dump == NULL) |
338 |
+ return -EINVAL; |
339 |
+ |
340 |
++ down_read(&crypto_alg_sem); |
341 |
+ list_for_each_entry(alg, &crypto_alg_list, cra_list) |
342 |
+ dump_alloc += CRYPTO_REPORT_MAXSIZE; |
343 |
+ |
344 |
+@@ -486,8 +487,11 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
345 |
+ .done = link->done, |
346 |
+ .min_dump_alloc = dump_alloc, |
347 |
+ }; |
348 |
+- return netlink_dump_start(crypto_nlsk, skb, nlh, &c); |
349 |
++ err = netlink_dump_start(crypto_nlsk, skb, nlh, &c); |
350 |
+ } |
351 |
++ up_read(&crypto_alg_sem); |
352 |
++ |
353 |
++ return err; |
354 |
+ } |
355 |
+ |
356 |
+ err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, |
357 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
358 |
+index 9064a2f2760c..cb106934bf1c 100644 |
359 |
+--- a/drivers/ata/ahci.c |
360 |
++++ b/drivers/ata/ahci.c |
361 |
+@@ -247,6 +247,26 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
362 |
+ { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ |
363 |
+ { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ |
364 |
+ { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ |
365 |
++ { PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */ |
366 |
++ { PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */ |
367 |
++ { PCI_VDEVICE(INTEL, 0x19b2), board_ahci }, /* DNV AHCI */ |
368 |
++ { PCI_VDEVICE(INTEL, 0x19b3), board_ahci }, /* DNV AHCI */ |
369 |
++ { PCI_VDEVICE(INTEL, 0x19b4), board_ahci }, /* DNV AHCI */ |
370 |
++ { PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */ |
371 |
++ { PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */ |
372 |
++ { PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */ |
373 |
++ { PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */ |
374 |
++ { PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */ |
375 |
++ { PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */ |
376 |
++ { PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */ |
377 |
++ { PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */ |
378 |
++ { PCI_VDEVICE(INTEL, 0x19c3), board_ahci }, /* DNV AHCI */ |
379 |
++ { PCI_VDEVICE(INTEL, 0x19c4), board_ahci }, /* DNV AHCI */ |
380 |
++ { PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */ |
381 |
++ { PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */ |
382 |
++ { PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */ |
383 |
++ { PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */ |
384 |
++ { PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */ |
385 |
+ { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ |
386 |
+ { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ |
387 |
+ { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ |
388 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
389 |
+index cf5f35877559..d04f5c8dbbdc 100644 |
390 |
+--- a/drivers/ata/libahci.c |
391 |
++++ b/drivers/ata/libahci.c |
392 |
+@@ -486,8 +486,8 @@ void ahci_save_initial_config(struct device *dev, |
393 |
+ } |
394 |
+ } |
395 |
+ |
396 |
+- /* fabricate port_map from cap.nr_ports */ |
397 |
+- if (!port_map) { |
398 |
++ /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ |
399 |
++ if (!port_map && vers < 0x10300) { |
400 |
+ port_map = (1 << ahci_nr_ports(cap)) - 1; |
401 |
+ dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); |
402 |
+ |
403 |
+@@ -1244,6 +1244,15 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, |
404 |
+ ata_tf_to_fis(tf, pmp, is_cmd, fis); |
405 |
+ ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12)); |
406 |
+ |
407 |
++ /* set port value for softreset of Port Multiplier */ |
408 |
++ if (pp->fbs_enabled && pp->fbs_last_dev != pmp) { |
409 |
++ tmp = readl(port_mmio + PORT_FBS); |
410 |
++ tmp &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); |
411 |
++ tmp |= pmp << PORT_FBS_DEV_OFFSET; |
412 |
++ writel(tmp, port_mmio + PORT_FBS); |
413 |
++ pp->fbs_last_dev = pmp; |
414 |
++ } |
415 |
++ |
416 |
+ /* issue & wait */ |
417 |
+ writel(1, port_mmio + PORT_CMD_ISSUE); |
418 |
+ |
419 |
+diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c |
420 |
+index a6524c3efdf7..ce854bbd33ef 100644 |
421 |
+--- a/drivers/char/tpm/tpm_ibmvtpm.c |
422 |
++++ b/drivers/char/tpm/tpm_ibmvtpm.c |
423 |
+@@ -529,7 +529,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, |
424 |
+ } |
425 |
+ ibmvtpm->rtce_size = be16_to_cpu(crq->len); |
426 |
+ ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, |
427 |
+- GFP_KERNEL); |
428 |
++ GFP_ATOMIC); |
429 |
+ if (!ibmvtpm->rtce_buf) { |
430 |
+ dev_err(ibmvtpm->dev, "Failed to allocate memory for rtce buffer\n"); |
431 |
+ return; |
432 |
+diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c |
433 |
+index de904e6a4ab7..5da58e3899eb 100644 |
434 |
+--- a/drivers/hid/usbhid/hid-core.c |
435 |
++++ b/drivers/hid/usbhid/hid-core.c |
436 |
+@@ -490,8 +490,6 @@ static void hid_ctrl(struct urb *urb) |
437 |
+ struct usbhid_device *usbhid = hid->driver_data; |
438 |
+ int unplug = 0, status = urb->status; |
439 |
+ |
440 |
+- spin_lock(&usbhid->lock); |
441 |
+- |
442 |
+ switch (status) { |
443 |
+ case 0: /* success */ |
444 |
+ if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) |
445 |
+@@ -511,6 +509,8 @@ static void hid_ctrl(struct urb *urb) |
446 |
+ hid_warn(urb->dev, "ctrl urb status %d received\n", status); |
447 |
+ } |
448 |
+ |
449 |
++ spin_lock(&usbhid->lock); |
450 |
++ |
451 |
+ if (unplug) { |
452 |
+ usbhid->ctrltail = usbhid->ctrlhead; |
453 |
+ } else { |
454 |
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
455 |
+index 0ba21b0f3972..eb7ddb20fd48 100644 |
456 |
+--- a/drivers/md/dm-mpath.c |
457 |
++++ b/drivers/md/dm-mpath.c |
458 |
+@@ -1608,11 +1608,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, |
459 |
+ /* |
460 |
+ * Only pass ioctls through if the device sizes match exactly. |
461 |
+ */ |
462 |
+- if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) { |
463 |
+- int err = scsi_verify_blk_ioctl(NULL, cmd); |
464 |
+- if (err) |
465 |
+- r = err; |
466 |
+- } |
467 |
++ if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) |
468 |
++ r = scsi_verify_blk_ioctl(NULL, cmd); |
469 |
+ |
470 |
+ if (r == -ENOTCONN && !fatal_signal_pending(current)) |
471 |
+ queue_work(kmultipathd, &m->process_queued_ios); |
472 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
473 |
+index b53669404cb5..6d7f4d950b8f 100644 |
474 |
+--- a/drivers/md/persistent-data/dm-btree.c |
475 |
++++ b/drivers/md/persistent-data/dm-btree.c |
476 |
+@@ -455,8 +455,10 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root, |
477 |
+ |
478 |
+ r = insert_at(sizeof(__le64), pn, parent_index + 1, |
479 |
+ le64_to_cpu(rn->keys[0]), &location); |
480 |
+- if (r) |
481 |
++ if (r) { |
482 |
++ unlock_block(s->info, right); |
483 |
+ return r; |
484 |
++ } |
485 |
+ |
486 |
+ if (key < le64_to_cpu(rn->keys[0])) { |
487 |
+ unlock_block(s->info, right); |
488 |
+diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c |
489 |
+index dbcdfbf8aed0..11b0ef3a2858 100644 |
490 |
+--- a/drivers/media/pci/saa7134/saa7134-alsa.c |
491 |
++++ b/drivers/media/pci/saa7134/saa7134-alsa.c |
492 |
+@@ -1145,6 +1145,8 @@ static int alsa_device_init(struct saa7134_dev *dev) |
493 |
+ |
494 |
+ static int alsa_device_exit(struct saa7134_dev *dev) |
495 |
+ { |
496 |
++ if (!snd_saa7134_cards[dev->nr]) |
497 |
++ return 1; |
498 |
+ |
499 |
+ snd_card_free(snd_saa7134_cards[dev->nr]); |
500 |
+ snd_saa7134_cards[dev->nr] = NULL; |
501 |
+@@ -1194,7 +1196,8 @@ static void saa7134_alsa_exit(void) |
502 |
+ int idx; |
503 |
+ |
504 |
+ for (idx = 0; idx < SNDRV_CARDS; idx++) { |
505 |
+- snd_card_free(snd_saa7134_cards[idx]); |
506 |
++ if (snd_saa7134_cards[idx]) |
507 |
++ snd_card_free(snd_saa7134_cards[idx]); |
508 |
+ } |
509 |
+ |
510 |
+ saa7134_dmasound_init = NULL; |
511 |
+diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
512 |
+index e2b0a0969ebb..35fb8f0cb539 100644 |
513 |
+--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
514 |
++++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c |
515 |
+@@ -264,7 +264,7 @@ static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_ |
516 |
+ |
517 |
+ struct v4l2_standard32 { |
518 |
+ __u32 index; |
519 |
+- __u32 id[2]; /* __u64 would get the alignment wrong */ |
520 |
++ compat_u64 id; |
521 |
+ __u8 name[24]; |
522 |
+ struct v4l2_fract frameperiod; /* Frames, not fields */ |
523 |
+ __u32 framelines; |
524 |
+@@ -284,7 +284,7 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 |
525 |
+ { |
526 |
+ if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || |
527 |
+ put_user(kp->index, &up->index) || |
528 |
+- copy_to_user(up->id, &kp->id, sizeof(__u64)) || |
529 |
++ put_user(kp->id, &up->id) || |
530 |
+ copy_to_user(up->name, kp->name, 24) || |
531 |
+ copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || |
532 |
+ put_user(kp->framelines, &up->framelines) || |
533 |
+@@ -576,10 +576,10 @@ struct v4l2_input32 { |
534 |
+ __u32 type; /* Type of input */ |
535 |
+ __u32 audioset; /* Associated audios (bitfield) */ |
536 |
+ __u32 tuner; /* Associated tuner */ |
537 |
+- v4l2_std_id std; |
538 |
++ compat_u64 std; |
539 |
+ __u32 status; |
540 |
+ __u32 reserved[4]; |
541 |
+-} __attribute__ ((packed)); |
542 |
++}; |
543 |
+ |
544 |
+ /* The 64-bit v4l2_input struct has extra padding at the end of the struct. |
545 |
+ Otherwise it is identical to the 32-bit version. */ |
546 |
+@@ -719,6 +719,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext |
547 |
+ struct v4l2_event32 { |
548 |
+ __u32 type; |
549 |
+ union { |
550 |
++ compat_s64 value64; |
551 |
+ __u8 data[64]; |
552 |
+ } u; |
553 |
+ __u32 pending; |
554 |
+diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c |
555 |
+index fd56f2563201..297fbc59a800 100644 |
556 |
+--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c |
557 |
++++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c |
558 |
+@@ -117,7 +117,8 @@ static void vb2_dc_prepare(void *buf_priv) |
559 |
+ if (!sgt || buf->db_attach) |
560 |
+ return; |
561 |
+ |
562 |
+- dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); |
563 |
++ dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents, |
564 |
++ buf->dma_dir); |
565 |
+ } |
566 |
+ |
567 |
+ static void vb2_dc_finish(void *buf_priv) |
568 |
+@@ -129,7 +130,7 @@ static void vb2_dc_finish(void *buf_priv) |
569 |
+ if (!sgt || buf->db_attach) |
570 |
+ return; |
571 |
+ |
572 |
+- dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); |
573 |
++ dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); |
574 |
+ } |
575 |
+ |
576 |
+ /*********************************************/ |
577 |
+diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c |
578 |
+index 301493382cd0..f8013c1d8cd5 100644 |
579 |
+--- a/drivers/mtd/mtdpart.c |
580 |
++++ b/drivers/mtd/mtdpart.c |
581 |
+@@ -634,8 +634,10 @@ int add_mtd_partitions(struct mtd_info *master, |
582 |
+ |
583 |
+ for (i = 0; i < nbparts; i++) { |
584 |
+ slave = allocate_partition(master, parts + i, i, cur_offset); |
585 |
+- if (IS_ERR(slave)) |
586 |
++ if (IS_ERR(slave)) { |
587 |
++ del_mtd_partitions(master); |
588 |
+ return PTR_ERR(slave); |
589 |
++ } |
590 |
+ |
591 |
+ mutex_lock(&mtd_partitions_mutex); |
592 |
+ list_add(&slave->list, &mtd_partitions); |
593 |
+diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h |
594 |
+index af7d9f9b3b4d..beed58b0c795 100644 |
595 |
+--- a/drivers/net/wireless/ti/wlcore/io.h |
596 |
++++ b/drivers/net/wireless/ti/wlcore/io.h |
597 |
+@@ -203,19 +203,23 @@ static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg, |
598 |
+ |
599 |
+ static inline void wl1271_power_off(struct wl1271 *wl) |
600 |
+ { |
601 |
+- int ret; |
602 |
++ int ret = 0; |
603 |
+ |
604 |
+ if (!test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags)) |
605 |
+ return; |
606 |
+ |
607 |
+- ret = wl->if_ops->power(wl->dev, false); |
608 |
++ if (wl->if_ops->power) |
609 |
++ ret = wl->if_ops->power(wl->dev, false); |
610 |
+ if (!ret) |
611 |
+ clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
612 |
+ } |
613 |
+ |
614 |
+ static inline int wl1271_power_on(struct wl1271 *wl) |
615 |
+ { |
616 |
+- int ret = wl->if_ops->power(wl->dev, true); |
617 |
++ int ret = 0; |
618 |
++ |
619 |
++ if (wl->if_ops->power) |
620 |
++ ret = wl->if_ops->power(wl->dev, true); |
621 |
+ if (ret == 0) |
622 |
+ set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); |
623 |
+ |
624 |
+diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c |
625 |
+index e26447832683..bfb57e671034 100644 |
626 |
+--- a/drivers/net/wireless/ti/wlcore/spi.c |
627 |
++++ b/drivers/net/wireless/ti/wlcore/spi.c |
628 |
+@@ -72,7 +72,10 @@ |
629 |
+ */ |
630 |
+ #define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) |
631 |
+ |
632 |
+-#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) |
633 |
++/* Maximum number of SPI write chunks */ |
634 |
++#define WSPI_MAX_NUM_OF_CHUNKS \ |
635 |
++ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) |
636 |
++ |
637 |
+ |
638 |
+ struct wl12xx_spi_glue { |
639 |
+ struct device *dev; |
640 |
+@@ -270,9 +273,10 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, |
641 |
+ void *buf, size_t len, bool fixed) |
642 |
+ { |
643 |
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); |
644 |
+- struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)]; |
645 |
++ /* SPI write buffers - 2 for each chunk */ |
646 |
++ struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; |
647 |
+ struct spi_message m; |
648 |
+- u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; |
649 |
++ u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; /* 1 command per chunk */ |
650 |
+ u32 *cmd; |
651 |
+ u32 chunk_len; |
652 |
+ int i; |
653 |
+diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c |
654 |
+index 157a57309601..4ef0dbdcace1 100644 |
655 |
+--- a/drivers/remoteproc/remoteproc_debugfs.c |
656 |
++++ b/drivers/remoteproc/remoteproc_debugfs.c |
657 |
+@@ -156,7 +156,7 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf, |
658 |
+ char buf[10]; |
659 |
+ int ret; |
660 |
+ |
661 |
+- if (count > sizeof(buf)) |
662 |
++ if (count < 1 || count > sizeof(buf)) |
663 |
+ return count; |
664 |
+ |
665 |
+ ret = copy_from_user(buf, user_buf, count); |
666 |
+diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c |
667 |
+index 380387a47b1d..462af46ceee7 100644 |
668 |
+--- a/drivers/spi/spi-atmel.c |
669 |
++++ b/drivers/spi/spi-atmel.c |
670 |
+@@ -594,7 +594,8 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, |
671 |
+ |
672 |
+ *plen = len; |
673 |
+ |
674 |
+- if (atmel_spi_dma_slave_config(as, &slave_config, 8)) |
675 |
++ if (atmel_spi_dma_slave_config(as, &slave_config, |
676 |
++ xfer->bits_per_word)) |
677 |
+ goto err_exit; |
678 |
+ |
679 |
+ /* Send both scatterlists */ |
680 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
681 |
+index 7c159634aaae..cc80ab14aa32 100644 |
682 |
+--- a/drivers/spi/spi.c |
683 |
++++ b/drivers/spi/spi.c |
684 |
+@@ -1047,7 +1047,7 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) |
685 |
+ master->bus_num = -1; |
686 |
+ master->num_chipselect = 1; |
687 |
+ master->dev.class = &spi_master_class; |
688 |
+- master->dev.parent = get_device(dev); |
689 |
++ master->dev.parent = dev; |
690 |
+ spi_master_set_devdata(master, &master[1]); |
691 |
+ |
692 |
+ return master; |
693 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
694 |
+index 2967b6eb4c70..8977eaf24d9f 100644 |
695 |
+--- a/drivers/tty/tty_io.c |
696 |
++++ b/drivers/tty/tty_io.c |
697 |
+@@ -2576,6 +2576,28 @@ static int tiocsetd(struct tty_struct *tty, int __user *p) |
698 |
+ } |
699 |
+ |
700 |
+ /** |
701 |
++ * tiocgetd - get line discipline |
702 |
++ * @tty: tty device |
703 |
++ * @p: pointer to user data |
704 |
++ * |
705 |
++ * Retrieves the line discipline id directly from the ldisc. |
706 |
++ * |
707 |
++ * Locking: waits for ldisc reference (in case the line discipline |
708 |
++ * is changing or the tty is being hungup) |
709 |
++ */ |
710 |
++ |
711 |
++static int tiocgetd(struct tty_struct *tty, int __user *p) |
712 |
++{ |
713 |
++ struct tty_ldisc *ld; |
714 |
++ int ret; |
715 |
++ |
716 |
++ ld = tty_ldisc_ref_wait(tty); |
717 |
++ ret = put_user(ld->ops->num, p); |
718 |
++ tty_ldisc_deref(ld); |
719 |
++ return ret; |
720 |
++} |
721 |
++ |
722 |
++/** |
723 |
+ * send_break - performed time break |
724 |
+ * @tty: device to break on |
725 |
+ * @duration: timeout in mS |
726 |
+@@ -2789,7 +2811,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
727 |
+ case TIOCGSID: |
728 |
+ return tiocgsid(tty, real_tty, p); |
729 |
+ case TIOCGETD: |
730 |
+- return put_user(tty->ldisc->ops->num, (int __user *)p); |
731 |
++ return tiocgetd(tty, p); |
732 |
+ case TIOCSETD: |
733 |
+ return tiocsetd(tty, p); |
734 |
+ case TIOCVHANGUP: |
735 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
736 |
+index 4dc18615cd0f..9dd6fa3a1260 100644 |
737 |
+--- a/drivers/usb/host/xhci.c |
738 |
++++ b/drivers/usb/host/xhci.c |
739 |
+@@ -4788,6 +4788,9 @@ static int __init xhci_hcd_init(void) |
740 |
+ { |
741 |
+ int retval; |
742 |
+ |
743 |
++ if (usb_disabled()) |
744 |
++ return -ENODEV; |
745 |
++ |
746 |
+ retval = xhci_register_pci(); |
747 |
+ if (retval < 0) { |
748 |
+ printk(KERN_DEBUG "Problem registering PCI driver."); |
749 |
+@@ -4816,9 +4819,6 @@ static int __init xhci_hcd_init(void) |
750 |
+ /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ |
751 |
+ BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); |
752 |
+ |
753 |
+- if (usb_disabled()) |
754 |
+- return -ENODEV; |
755 |
+- |
756 |
+ return 0; |
757 |
+ unreg_pci: |
758 |
+ xhci_unregister_pci(); |
759 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
760 |
+index 72c14d7d604f..89ba7cfba5bc 100644 |
761 |
+--- a/drivers/usb/serial/cp210x.c |
762 |
++++ b/drivers/usb/serial/cp210x.c |
763 |
+@@ -98,6 +98,7 @@ static const struct usb_device_id id_table[] = { |
764 |
+ { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ |
765 |
+ { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */ |
766 |
+ { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ |
767 |
++ { USB_DEVICE(0x10C4, 0x81D7) }, /* IAI Corp. RCB-CV-USB USB to RS485 Adaptor */ |
768 |
+ { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ |
769 |
+ { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ |
770 |
+ { USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */ |
771 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
772 |
+index 514f3117ee2b..4e865664699b 100644 |
773 |
+--- a/drivers/usb/serial/ftdi_sio.c |
774 |
++++ b/drivers/usb/serial/ftdi_sio.c |
775 |
+@@ -840,6 +840,7 @@ static struct usb_device_id id_table_combined [] = { |
776 |
+ { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), |
777 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
778 |
+ { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, |
779 |
++ { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) }, |
780 |
+ { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, |
781 |
+ |
782 |
+ /* Papouch devices based on FTDI chip */ |
783 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
784 |
+index bfb0ecd98808..3eff1d6a2b17 100644 |
785 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
786 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
787 |
+@@ -615,6 +615,7 @@ |
788 |
+ */ |
789 |
+ #define RATOC_VENDOR_ID 0x0584 |
790 |
+ #define RATOC_PRODUCT_ID_USB60F 0xb020 |
791 |
++#define RATOC_PRODUCT_ID_SCU18 0xb03a |
792 |
+ |
793 |
+ /* |
794 |
+ * Infineon Technologies |
795 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
796 |
+index bdbe642e6569..81f6a572f016 100644 |
797 |
+--- a/drivers/usb/serial/option.c |
798 |
++++ b/drivers/usb/serial/option.c |
799 |
+@@ -269,6 +269,8 @@ static void option_instat_callback(struct urb *urb); |
800 |
+ #define TELIT_PRODUCT_CC864_SINGLE 0x1006 |
801 |
+ #define TELIT_PRODUCT_DE910_DUAL 0x1010 |
802 |
+ #define TELIT_PRODUCT_UE910_V2 0x1012 |
803 |
++#define TELIT_PRODUCT_LE922_USBCFG0 0x1042 |
804 |
++#define TELIT_PRODUCT_LE922_USBCFG3 0x1043 |
805 |
+ #define TELIT_PRODUCT_LE920 0x1200 |
806 |
+ #define TELIT_PRODUCT_LE910 0x1201 |
807 |
+ |
808 |
+@@ -623,6 +625,16 @@ static const struct option_blacklist_info telit_le920_blacklist = { |
809 |
+ .reserved = BIT(1) | BIT(5), |
810 |
+ }; |
811 |
+ |
812 |
++static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = { |
813 |
++ .sendsetup = BIT(2), |
814 |
++ .reserved = BIT(0) | BIT(1) | BIT(3), |
815 |
++}; |
816 |
++ |
817 |
++static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = { |
818 |
++ .sendsetup = BIT(0), |
819 |
++ .reserved = BIT(1) | BIT(2) | BIT(3), |
820 |
++}; |
821 |
++ |
822 |
+ static const struct usb_device_id option_ids[] = { |
823 |
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
824 |
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
825 |
+@@ -1168,6 +1180,10 @@ static const struct usb_device_id option_ids[] = { |
826 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
827 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
828 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, |
829 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), |
830 |
++ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, |
831 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3), |
832 |
++ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, |
833 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
834 |
+ .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, |
835 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
836 |
+@@ -1679,7 +1695,7 @@ static const struct usb_device_id option_ids[] = { |
837 |
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
838 |
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8), |
839 |
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
840 |
+- { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, |
841 |
++ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) }, |
842 |
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), |
843 |
+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
844 |
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
845 |
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c |
846 |
+index 4cc84c0c990d..0a7c68fa5e5e 100644 |
847 |
+--- a/drivers/usb/serial/ti_usb_3410_5052.c |
848 |
++++ b/drivers/usb/serial/ti_usb_3410_5052.c |
849 |
+@@ -158,7 +158,7 @@ static unsigned int product_5052_count; |
850 |
+ /* the array dimension is the number of default entries plus */ |
851 |
+ /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ |
852 |
+ /* null entry */ |
853 |
+-static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { |
854 |
++static struct usb_device_id ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = { |
855 |
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, |
856 |
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, |
857 |
+ { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, |
858 |
+@@ -184,7 +184,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { |
859 |
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, |
860 |
+ }; |
861 |
+ |
862 |
+-static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = { |
863 |
++static struct usb_device_id ti_id_table_combined[20+2*TI_EXTRA_VID_PID_COUNT+1] = { |
864 |
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, |
865 |
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, |
866 |
+ { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, |
867 |
+diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c |
868 |
+index 727905de0ba4..605068e6acf2 100644 |
869 |
+--- a/drivers/usb/serial/visor.c |
870 |
++++ b/drivers/usb/serial/visor.c |
871 |
+@@ -551,6 +551,11 @@ static int treo_attach(struct usb_serial *serial) |
872 |
+ (serial->num_interrupt_in == 0)) |
873 |
+ return 0; |
874 |
+ |
875 |
++ if (serial->num_bulk_in < 2 || serial->num_interrupt_in < 2) { |
876 |
++ dev_err(&serial->interface->dev, "missing endpoints\n"); |
877 |
++ return -ENODEV; |
878 |
++ } |
879 |
++ |
880 |
+ /* |
881 |
+ * It appears that Treos and Kyoceras want to use the |
882 |
+ * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint, |
883 |
+@@ -604,8 +609,10 @@ static int clie_5_attach(struct usb_serial *serial) |
884 |
+ */ |
885 |
+ |
886 |
+ /* some sanity check */ |
887 |
+- if (serial->num_ports < 2) |
888 |
+- return -1; |
889 |
++ if (serial->num_bulk_out < 2) { |
890 |
++ dev_err(&serial->interface->dev, "missing bulk out endpoints\n"); |
891 |
++ return -ENODEV; |
892 |
++ } |
893 |
+ |
894 |
+ /* port 0 now uses the modified endpoint Address */ |
895 |
+ port = serial->port[0]; |
896 |
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
897 |
+index 618bcc84a09e..948e6f21b594 100644 |
898 |
+--- a/fs/binfmt_elf.c |
899 |
++++ b/fs/binfmt_elf.c |
900 |
+@@ -682,16 +682,16 @@ static int load_elf_binary(struct linux_binprm *bprm) |
901 |
+ */ |
902 |
+ would_dump(bprm, interpreter); |
903 |
+ |
904 |
+- retval = kernel_read(interpreter, 0, bprm->buf, |
905 |
+- BINPRM_BUF_SIZE); |
906 |
+- if (retval != BINPRM_BUF_SIZE) { |
907 |
++ /* Get the exec headers */ |
908 |
++ retval = kernel_read(interpreter, 0, |
909 |
++ (void *)&loc->interp_elf_ex, |
910 |
++ sizeof(loc->interp_elf_ex)); |
911 |
++ if (retval != sizeof(loc->interp_elf_ex)) { |
912 |
+ if (retval >= 0) |
913 |
+ retval = -EIO; |
914 |
+ goto out_free_dentry; |
915 |
+ } |
916 |
+ |
917 |
+- /* Get the exec headers */ |
918 |
+- loc->interp_elf_ex = *((struct elfhdr *)bprm->buf); |
919 |
+ break; |
920 |
+ } |
921 |
+ elf_ppnt++; |
922 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
923 |
+index 2a71466b0115..6f74b8919237 100644 |
924 |
+--- a/fs/ext4/ext4.h |
925 |
++++ b/fs/ext4/ext4.h |
926 |
+@@ -26,6 +26,7 @@ |
927 |
+ #include <linux/seqlock.h> |
928 |
+ #include <linux/mutex.h> |
929 |
+ #include <linux/timer.h> |
930 |
++#include <linux/version.h> |
931 |
+ #include <linux/wait.h> |
932 |
+ #include <linux/blockgroup_lock.h> |
933 |
+ #include <linux/percpu_counter.h> |
934 |
+@@ -728,19 +729,55 @@ struct move_extent { |
935 |
+ <= (EXT4_GOOD_OLD_INODE_SIZE + \ |
936 |
+ (einode)->i_extra_isize)) \ |
937 |
+ |
938 |
++/* |
939 |
++ * We use an encoding that preserves the times for extra epoch "00": |
940 |
++ * |
941 |
++ * extra msb of adjust for signed |
942 |
++ * epoch 32-bit 32-bit tv_sec to |
943 |
++ * bits time decoded 64-bit tv_sec 64-bit tv_sec valid time range |
944 |
++ * 0 0 1 -0x80000000..-0x00000001 0x000000000 1901-12-13..1969-12-31 |
945 |
++ * 0 0 0 0x000000000..0x07fffffff 0x000000000 1970-01-01..2038-01-19 |
946 |
++ * 0 1 1 0x080000000..0x0ffffffff 0x100000000 2038-01-19..2106-02-07 |
947 |
++ * 0 1 0 0x100000000..0x17fffffff 0x100000000 2106-02-07..2174-02-25 |
948 |
++ * 1 0 1 0x180000000..0x1ffffffff 0x200000000 2174-02-25..2242-03-16 |
949 |
++ * 1 0 0 0x200000000..0x27fffffff 0x200000000 2242-03-16..2310-04-04 |
950 |
++ * 1 1 1 0x280000000..0x2ffffffff 0x300000000 2310-04-04..2378-04-22 |
951 |
++ * 1 1 0 0x300000000..0x37fffffff 0x300000000 2378-04-22..2446-05-10 |
952 |
++ * |
953 |
++ * Note that previous versions of the kernel on 64-bit systems would |
954 |
++ * incorrectly use extra epoch bits 1,1 for dates between 1901 and |
955 |
++ * 1970. e2fsck will correct this, assuming that it is run on the |
956 |
++ * affected filesystem before 2242. |
957 |
++ */ |
958 |
++ |
959 |
+ static inline __le32 ext4_encode_extra_time(struct timespec *time) |
960 |
+ { |
961 |
+- return cpu_to_le32((sizeof(time->tv_sec) > 4 ? |
962 |
+- (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | |
963 |
+- ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); |
964 |
++ u32 extra = sizeof(time->tv_sec) > 4 ? |
965 |
++ ((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK : 0; |
966 |
++ return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); |
967 |
+ } |
968 |
+ |
969 |
+ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) |
970 |
+ { |
971 |
+- if (sizeof(time->tv_sec) > 4) |
972 |
+- time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) |
973 |
+- << 32; |
974 |
+- time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
975 |
++ if (unlikely(sizeof(time->tv_sec) > 4 && |
976 |
++ (extra & cpu_to_le32(EXT4_EPOCH_MASK)))) { |
977 |
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) |
978 |
++ /* Handle legacy encoding of pre-1970 dates with epoch |
979 |
++ * bits 1,1. We assume that by kernel version 4.20, |
980 |
++ * everyone will have run fsck over the affected |
981 |
++ * filesystems to correct the problem. (This |
982 |
++ * backwards compatibility may be removed before this |
983 |
++ * time, at the discretion of the ext4 developers.) |
984 |
++ */ |
985 |
++ u64 extra_bits = le32_to_cpu(extra) & EXT4_EPOCH_MASK; |
986 |
++ if (extra_bits == 3 && ((time->tv_sec) & 0x80000000) != 0) |
987 |
++ extra_bits = 0; |
988 |
++ time->tv_sec += extra_bits << 32; |
989 |
++#else |
990 |
++ time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; |
991 |
++#endif |
992 |
++ } |
993 |
++ time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
994 |
+ } |
995 |
+ |
996 |
+ #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |
997 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
998 |
+index a69bd74ed390..fa7d2e668c3a 100644 |
999 |
+--- a/fs/ext4/resize.c |
1000 |
++++ b/fs/ext4/resize.c |
1001 |
+@@ -1025,7 +1025,7 @@ exit_free: |
1002 |
+ * do not copy the full number of backups at this time. The resize |
1003 |
+ * which changed s_groups_count will backup again. |
1004 |
+ */ |
1005 |
+-static void update_backups(struct super_block *sb, int blk_off, char *data, |
1006 |
++static void update_backups(struct super_block *sb, sector_t blk_off, char *data, |
1007 |
+ int size, int meta_bg) |
1008 |
+ { |
1009 |
+ struct ext4_sb_info *sbi = EXT4_SB(sb); |
1010 |
+@@ -1050,7 +1050,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, |
1011 |
+ group = ext4_list_backups(sb, &three, &five, &seven); |
1012 |
+ last = sbi->s_groups_count; |
1013 |
+ } else { |
1014 |
+- group = ext4_meta_bg_first_group(sb, group) + 1; |
1015 |
++ group = ext4_get_group_number(sb, blk_off) + 1; |
1016 |
+ last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2); |
1017 |
+ } |
1018 |
+ |
1019 |
+diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c |
1020 |
+index e028b8eb1c40..0912b90e05bc 100644 |
1021 |
+--- a/fs/fscache/netfs.c |
1022 |
++++ b/fs/fscache/netfs.c |
1023 |
+@@ -45,9 +45,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) |
1024 |
+ netfs->primary_index->parent = &fscache_fsdef_index; |
1025 |
+ netfs->primary_index->netfs_data = netfs; |
1026 |
+ |
1027 |
+- atomic_inc(&netfs->primary_index->parent->usage); |
1028 |
+- atomic_inc(&netfs->primary_index->parent->n_children); |
1029 |
+- |
1030 |
+ spin_lock_init(&netfs->primary_index->lock); |
1031 |
+ INIT_HLIST_HEAD(&netfs->primary_index->backing_objects); |
1032 |
+ |
1033 |
+@@ -60,6 +57,9 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) |
1034 |
+ goto already_registered; |
1035 |
+ } |
1036 |
+ |
1037 |
++ atomic_inc(&netfs->primary_index->parent->usage); |
1038 |
++ atomic_inc(&netfs->primary_index->parent->n_children); |
1039 |
++ |
1040 |
+ list_add(&netfs->link, &fscache_netfs_list); |
1041 |
+ ret = 0; |
1042 |
+ |
1043 |
+@@ -70,8 +70,7 @@ already_registered: |
1044 |
+ up_write(&fscache_addremove_sem); |
1045 |
+ |
1046 |
+ if (ret < 0) { |
1047 |
+- netfs->primary_index->parent = NULL; |
1048 |
+- __fscache_cookie_put(netfs->primary_index); |
1049 |
++ kmem_cache_free(fscache_cookie_jar, netfs->primary_index); |
1050 |
+ netfs->primary_index = NULL; |
1051 |
+ } |
1052 |
+ |
1053 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
1054 |
+index ec34e11d6854..21b828c713cc 100644 |
1055 |
+--- a/fs/jbd2/transaction.c |
1056 |
++++ b/fs/jbd2/transaction.c |
1057 |
+@@ -1936,6 +1936,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, |
1058 |
+ |
1059 |
+ if (!buffer_dirty(bh)) { |
1060 |
+ /* bdflush has written it. We can drop it now */ |
1061 |
++ __jbd2_journal_remove_checkpoint(jh); |
1062 |
+ goto zap_buffer; |
1063 |
+ } |
1064 |
+ |
1065 |
+@@ -1965,6 +1966,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, |
1066 |
+ /* The orphan record's transaction has |
1067 |
+ * committed. We can cleanse this buffer */ |
1068 |
+ clear_buffer_jbddirty(bh); |
1069 |
++ __jbd2_journal_remove_checkpoint(jh); |
1070 |
+ goto zap_buffer; |
1071 |
+ } |
1072 |
+ } |
1073 |
+diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c |
1074 |
+index 2c119d5d04c9..d084200dbc4e 100644 |
1075 |
+--- a/fs/ocfs2/dlm/dlmmaster.c |
1076 |
++++ b/fs/ocfs2/dlm/dlmmaster.c |
1077 |
+@@ -2456,6 +2456,11 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, |
1078 |
+ spin_lock(&dlm->master_lock); |
1079 |
+ ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name, |
1080 |
+ namelen, target, dlm->node_num); |
1081 |
++ /* get an extra reference on the mle. |
1082 |
++ * otherwise the assert_master from the new |
1083 |
++ * master will destroy this. |
1084 |
++ */ |
1085 |
++ dlm_get_mle_inuse(mle); |
1086 |
+ spin_unlock(&dlm->master_lock); |
1087 |
+ spin_unlock(&dlm->spinlock); |
1088 |
+ |
1089 |
+@@ -2491,6 +2496,7 @@ fail: |
1090 |
+ if (mle_added) { |
1091 |
+ dlm_mle_detach_hb_events(dlm, mle); |
1092 |
+ dlm_put_mle(mle); |
1093 |
++ dlm_put_mle_inuse(mle); |
1094 |
+ } else if (mle) { |
1095 |
+ kmem_cache_free(dlm_mle_cache, mle); |
1096 |
+ mle = NULL; |
1097 |
+@@ -2508,17 +2514,6 @@ fail: |
1098 |
+ * ensure that all assert_master work is flushed. */ |
1099 |
+ flush_workqueue(dlm->dlm_worker); |
1100 |
+ |
1101 |
+- /* get an extra reference on the mle. |
1102 |
+- * otherwise the assert_master from the new |
1103 |
+- * master will destroy this. |
1104 |
+- * also, make sure that all callers of dlm_get_mle |
1105 |
+- * take both dlm->spinlock and dlm->master_lock */ |
1106 |
+- spin_lock(&dlm->spinlock); |
1107 |
+- spin_lock(&dlm->master_lock); |
1108 |
+- dlm_get_mle_inuse(mle); |
1109 |
+- spin_unlock(&dlm->master_lock); |
1110 |
+- spin_unlock(&dlm->spinlock); |
1111 |
+- |
1112 |
+ /* notify new node and send all lock state */ |
1113 |
+ /* call send_one_lockres with migration flag. |
1114 |
+ * this serves as notice to the target node that a |
1115 |
+@@ -3246,6 +3241,15 @@ top: |
1116 |
+ mle->new_master != dead_node) |
1117 |
+ continue; |
1118 |
+ |
1119 |
++ if (mle->new_master == dead_node && mle->inuse) { |
1120 |
++ mlog(ML_NOTICE, "%s: target %u died during " |
1121 |
++ "migration from %u, the MLE is " |
1122 |
++ "still keep used, ignore it!\n", |
1123 |
++ dlm->name, dead_node, |
1124 |
++ mle->master); |
1125 |
++ continue; |
1126 |
++ } |
1127 |
++ |
1128 |
+ /* If we have reached this point, this mle needs to be |
1129 |
+ * removed from the list and freed. */ |
1130 |
+ dlm_clean_migration_mle(dlm, mle); |
1131 |
+diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c |
1132 |
+index 9bd981cd3142..01c69f24e416 100644 |
1133 |
+--- a/fs/ocfs2/dlm/dlmrecovery.c |
1134 |
++++ b/fs/ocfs2/dlm/dlmrecovery.c |
1135 |
+@@ -2326,6 +2326,8 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node) |
1136 |
+ break; |
1137 |
+ } |
1138 |
+ } |
1139 |
++ dlm_lockres_clear_refmap_bit(dlm, res, |
1140 |
++ dead_node); |
1141 |
+ spin_unlock(&res->spinlock); |
1142 |
+ continue; |
1143 |
+ } |
1144 |
+diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c |
1145 |
+index c327d4ee1235..7b3792e5844a 100644 |
1146 |
+--- a/fs/sysv/inode.c |
1147 |
++++ b/fs/sysv/inode.c |
1148 |
+@@ -161,14 +161,8 @@ void sysv_set_inode(struct inode *inode, dev_t rdev) |
1149 |
+ inode->i_fop = &sysv_dir_operations; |
1150 |
+ inode->i_mapping->a_ops = &sysv_aops; |
1151 |
+ } else if (S_ISLNK(inode->i_mode)) { |
1152 |
+- if (inode->i_blocks) { |
1153 |
+- inode->i_op = &sysv_symlink_inode_operations; |
1154 |
+- inode->i_mapping->a_ops = &sysv_aops; |
1155 |
+- } else { |
1156 |
+- inode->i_op = &sysv_fast_symlink_inode_operations; |
1157 |
+- nd_terminate_link(SYSV_I(inode)->i_data, inode->i_size, |
1158 |
+- sizeof(SYSV_I(inode)->i_data) - 1); |
1159 |
+- } |
1160 |
++ inode->i_op = &sysv_symlink_inode_operations; |
1161 |
++ inode->i_mapping->a_ops = &sysv_aops; |
1162 |
+ } else |
1163 |
+ init_special_inode(inode, inode->i_mode, rdev); |
1164 |
+ } |
1165 |
+diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h |
1166 |
+index d61c11170213..2f38daaab3d7 100644 |
1167 |
+--- a/include/crypto/if_alg.h |
1168 |
++++ b/include/crypto/if_alg.h |
1169 |
+@@ -30,6 +30,8 @@ struct alg_sock { |
1170 |
+ |
1171 |
+ struct sock *parent; |
1172 |
+ |
1173 |
++ unsigned int refcnt; |
1174 |
++ |
1175 |
+ const struct af_alg_type *type; |
1176 |
+ void *private; |
1177 |
+ }; |
1178 |
+@@ -64,6 +66,7 @@ int af_alg_register_type(const struct af_alg_type *type); |
1179 |
+ int af_alg_unregister_type(const struct af_alg_type *type); |
1180 |
+ |
1181 |
+ int af_alg_release(struct socket *sock); |
1182 |
++void af_alg_release_parent(struct sock *sk); |
1183 |
+ int af_alg_accept(struct sock *sk, struct socket *newsock); |
1184 |
+ |
1185 |
+ int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, |
1186 |
+@@ -80,11 +83,6 @@ static inline struct alg_sock *alg_sk(struct sock *sk) |
1187 |
+ return (struct alg_sock *)sk; |
1188 |
+ } |
1189 |
+ |
1190 |
+-static inline void af_alg_release_parent(struct sock *sk) |
1191 |
+-{ |
1192 |
+- sock_put(alg_sk(sk)->parent); |
1193 |
+-} |
1194 |
+- |
1195 |
+ static inline void af_alg_init_completion(struct af_alg_completion *completion) |
1196 |
+ { |
1197 |
+ init_completion(&completion->completion); |
1198 |
+diff --git a/include/linux/signal.h b/include/linux/signal.h |
1199 |
+index 2ac423bdb676..53944e50e421 100644 |
1200 |
+--- a/include/linux/signal.h |
1201 |
++++ b/include/linux/signal.h |
1202 |
+@@ -247,7 +247,6 @@ extern int sigprocmask(int, sigset_t *, sigset_t *); |
1203 |
+ extern void set_current_blocked(sigset_t *); |
1204 |
+ extern void __set_current_blocked(const sigset_t *); |
1205 |
+ extern int show_unhandled_signals; |
1206 |
+-extern int sigsuspend(sigset_t *); |
1207 |
+ |
1208 |
+ struct sigaction { |
1209 |
+ #ifndef __ARCH_HAS_IRIX_SIGACTION |
1210 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
1211 |
+index 2e51bcbea1e3..4d1f7fa3138d 100644 |
1212 |
+--- a/kernel/signal.c |
1213 |
++++ b/kernel/signal.c |
1214 |
+@@ -3551,7 +3551,7 @@ SYSCALL_DEFINE0(pause) |
1215 |
+ |
1216 |
+ #endif |
1217 |
+ |
1218 |
+-int sigsuspend(sigset_t *set) |
1219 |
++static int sigsuspend(sigset_t *set) |
1220 |
+ { |
1221 |
+ current->saved_sigmask = current->blocked; |
1222 |
+ set_current_blocked(set); |
1223 |
+diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h |
1224 |
+index 49b582a225b0..b9897e2be404 100644 |
1225 |
+--- a/scripts/recordmcount.h |
1226 |
++++ b/scripts/recordmcount.h |
1227 |
+@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr, |
1228 |
+ |
1229 |
+ if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { |
1230 |
+ if (make_nop) |
1231 |
+- ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); |
1232 |
++ ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset)); |
1233 |
+ if (warn_on_notrace_sect && !once) { |
1234 |
+ printf("Section %s has mcount callers being ignored\n", |
1235 |
+ txtname); |
1236 |
+diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c |
1237 |
+index 3fdf998ad057..572f95175e97 100644 |
1238 |
+--- a/sound/core/compress_offload.c |
1239 |
++++ b/sound/core/compress_offload.c |
1240 |
+@@ -44,6 +44,13 @@ |
1241 |
+ #include <sound/compress_offload.h> |
1242 |
+ #include <sound/compress_driver.h> |
1243 |
+ |
1244 |
++/* struct snd_compr_codec_caps overflows the ioctl bit size for some |
1245 |
++ * architectures, so we need to disable the relevant ioctls. |
1246 |
++ */ |
1247 |
++#if _IOC_SIZEBITS < 14 |
1248 |
++#define COMPR_CODEC_CAPS_OVERFLOW |
1249 |
++#endif |
1250 |
++ |
1251 |
+ /* TODO: |
1252 |
+ * - add substream support for multiple devices in case of |
1253 |
+ * SND_DYNAMIC_MINORS is not used |
1254 |
+@@ -427,6 +434,7 @@ out: |
1255 |
+ return retval; |
1256 |
+ } |
1257 |
+ |
1258 |
++#ifndef COMPR_CODEC_CAPS_OVERFLOW |
1259 |
+ static int |
1260 |
+ snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg) |
1261 |
+ { |
1262 |
+@@ -450,6 +458,7 @@ out: |
1263 |
+ kfree(caps); |
1264 |
+ return retval; |
1265 |
+ } |
1266 |
++#endif /* !COMPR_CODEC_CAPS_OVERFLOW */ |
1267 |
+ |
1268 |
+ /* revisit this with snd_pcm_preallocate_xxx */ |
1269 |
+ static int snd_compr_allocate_buffer(struct snd_compr_stream *stream, |
1270 |
+@@ -791,9 +800,11 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) |
1271 |
+ case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): |
1272 |
+ retval = snd_compr_get_caps(stream, arg); |
1273 |
+ break; |
1274 |
++#ifndef COMPR_CODEC_CAPS_OVERFLOW |
1275 |
+ case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS): |
1276 |
+ retval = snd_compr_get_codec_caps(stream, arg); |
1277 |
+ break; |
1278 |
++#endif |
1279 |
+ case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS): |
1280 |
+ retval = snd_compr_set_params(stream, arg); |
1281 |
+ break; |
1282 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
1283 |
+index 4c1cc51772e6..7417f96cea6e 100644 |
1284 |
+--- a/sound/core/oss/pcm_oss.c |
1285 |
++++ b/sound/core/oss/pcm_oss.c |
1286 |
+@@ -834,7 +834,8 @@ static int choose_rate(struct snd_pcm_substream *substream, |
1287 |
+ return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); |
1288 |
+ } |
1289 |
+ |
1290 |
+-static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) |
1291 |
++static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, |
1292 |
++ bool trylock) |
1293 |
+ { |
1294 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
1295 |
+ struct snd_pcm_hw_params *params, *sparams; |
1296 |
+@@ -848,7 +849,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) |
1297 |
+ struct snd_mask sformat_mask; |
1298 |
+ struct snd_mask mask; |
1299 |
+ |
1300 |
+- if (mutex_lock_interruptible(&runtime->oss.params_lock)) |
1301 |
++ if (trylock) { |
1302 |
++ if (!(mutex_trylock(&runtime->oss.params_lock))) |
1303 |
++ return -EAGAIN; |
1304 |
++ } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) |
1305 |
+ return -EINTR; |
1306 |
+ sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL); |
1307 |
+ params = kmalloc(sizeof(*params), GFP_KERNEL); |
1308 |
+@@ -1091,7 +1095,7 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_fil |
1309 |
+ if (asubstream == NULL) |
1310 |
+ asubstream = substream; |
1311 |
+ if (substream->runtime->oss.params) { |
1312 |
+- err = snd_pcm_oss_change_params(substream); |
1313 |
++ err = snd_pcm_oss_change_params(substream, false); |
1314 |
+ if (err < 0) |
1315 |
+ return err; |
1316 |
+ } |
1317 |
+@@ -1130,7 +1134,7 @@ static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) |
1318 |
+ return 0; |
1319 |
+ runtime = substream->runtime; |
1320 |
+ if (runtime->oss.params) { |
1321 |
+- err = snd_pcm_oss_change_params(substream); |
1322 |
++ err = snd_pcm_oss_change_params(substream, false); |
1323 |
+ if (err < 0) |
1324 |
+ return err; |
1325 |
+ } |
1326 |
+@@ -2168,7 +2172,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre |
1327 |
+ runtime = substream->runtime; |
1328 |
+ |
1329 |
+ if (runtime->oss.params && |
1330 |
+- (err = snd_pcm_oss_change_params(substream)) < 0) |
1331 |
++ (err = snd_pcm_oss_change_params(substream, false)) < 0) |
1332 |
+ return err; |
1333 |
+ |
1334 |
+ info.fragsize = runtime->oss.period_bytes; |
1335 |
+@@ -2804,7 +2808,12 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) |
1336 |
+ return -EIO; |
1337 |
+ |
1338 |
+ if (runtime->oss.params) { |
1339 |
+- if ((err = snd_pcm_oss_change_params(substream)) < 0) |
1340 |
++ /* use mutex_trylock() for params_lock for avoiding a deadlock |
1341 |
++ * between mmap_sem and params_lock taken by |
1342 |
++ * copy_from/to_user() in snd_pcm_oss_write/read() |
1343 |
++ */ |
1344 |
++ err = snd_pcm_oss_change_params(substream, true); |
1345 |
++ if (err < 0) |
1346 |
+ return err; |
1347 |
+ } |
1348 |
+ #ifdef CONFIG_SND_PCM_OSS_PLUGINS |
1349 |
+diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c |
1350 |
+index 7b596b5751db..500765f20843 100644 |
1351 |
+--- a/sound/core/rawmidi.c |
1352 |
++++ b/sound/core/rawmidi.c |
1353 |
+@@ -934,31 +934,36 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, |
1354 |
+ unsigned long flags; |
1355 |
+ long result = 0, count1; |
1356 |
+ struct snd_rawmidi_runtime *runtime = substream->runtime; |
1357 |
++ unsigned long appl_ptr; |
1358 |
+ |
1359 |
++ spin_lock_irqsave(&runtime->lock, flags); |
1360 |
+ while (count > 0 && runtime->avail) { |
1361 |
+ count1 = runtime->buffer_size - runtime->appl_ptr; |
1362 |
+ if (count1 > count) |
1363 |
+ count1 = count; |
1364 |
+- spin_lock_irqsave(&runtime->lock, flags); |
1365 |
+ if (count1 > (int)runtime->avail) |
1366 |
+ count1 = runtime->avail; |
1367 |
++ |
1368 |
++ /* update runtime->appl_ptr before unlocking for userbuf */ |
1369 |
++ appl_ptr = runtime->appl_ptr; |
1370 |
++ runtime->appl_ptr += count1; |
1371 |
++ runtime->appl_ptr %= runtime->buffer_size; |
1372 |
++ runtime->avail -= count1; |
1373 |
++ |
1374 |
+ if (kernelbuf) |
1375 |
+- memcpy(kernelbuf + result, runtime->buffer + runtime->appl_ptr, count1); |
1376 |
++ memcpy(kernelbuf + result, runtime->buffer + appl_ptr, count1); |
1377 |
+ if (userbuf) { |
1378 |
+ spin_unlock_irqrestore(&runtime->lock, flags); |
1379 |
+ if (copy_to_user(userbuf + result, |
1380 |
+- runtime->buffer + runtime->appl_ptr, count1)) { |
1381 |
++ runtime->buffer + appl_ptr, count1)) { |
1382 |
+ return result > 0 ? result : -EFAULT; |
1383 |
+ } |
1384 |
+ spin_lock_irqsave(&runtime->lock, flags); |
1385 |
+ } |
1386 |
+- runtime->appl_ptr += count1; |
1387 |
+- runtime->appl_ptr %= runtime->buffer_size; |
1388 |
+- runtime->avail -= count1; |
1389 |
+- spin_unlock_irqrestore(&runtime->lock, flags); |
1390 |
+ result += count1; |
1391 |
+ count -= count1; |
1392 |
+ } |
1393 |
++ spin_unlock_irqrestore(&runtime->lock, flags); |
1394 |
+ return result; |
1395 |
+ } |
1396 |
+ |
1397 |
+@@ -1161,8 +1166,9 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, |
1398 |
+ unsigned long flags; |
1399 |
+ long count1, result; |
1400 |
+ struct snd_rawmidi_runtime *runtime = substream->runtime; |
1401 |
++ unsigned long appl_ptr; |
1402 |
+ |
1403 |
+- if (snd_BUG_ON(!kernelbuf && !userbuf)) |
1404 |
++ if (!kernelbuf && !userbuf) |
1405 |
+ return -EINVAL; |
1406 |
+ if (snd_BUG_ON(!runtime->buffer)) |
1407 |
+ return -EINVAL; |
1408 |
+@@ -1181,12 +1187,19 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, |
1409 |
+ count1 = count; |
1410 |
+ if (count1 > (long)runtime->avail) |
1411 |
+ count1 = runtime->avail; |
1412 |
++ |
1413 |
++ /* update runtime->appl_ptr before unlocking for userbuf */ |
1414 |
++ appl_ptr = runtime->appl_ptr; |
1415 |
++ runtime->appl_ptr += count1; |
1416 |
++ runtime->appl_ptr %= runtime->buffer_size; |
1417 |
++ runtime->avail -= count1; |
1418 |
++ |
1419 |
+ if (kernelbuf) |
1420 |
+- memcpy(runtime->buffer + runtime->appl_ptr, |
1421 |
++ memcpy(runtime->buffer + appl_ptr, |
1422 |
+ kernelbuf + result, count1); |
1423 |
+ else if (userbuf) { |
1424 |
+ spin_unlock_irqrestore(&runtime->lock, flags); |
1425 |
+- if (copy_from_user(runtime->buffer + runtime->appl_ptr, |
1426 |
++ if (copy_from_user(runtime->buffer + appl_ptr, |
1427 |
+ userbuf + result, count1)) { |
1428 |
+ spin_lock_irqsave(&runtime->lock, flags); |
1429 |
+ result = result > 0 ? result : -EFAULT; |
1430 |
+@@ -1194,9 +1207,6 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, |
1431 |
+ } |
1432 |
+ spin_lock_irqsave(&runtime->lock, flags); |
1433 |
+ } |
1434 |
+- runtime->appl_ptr += count1; |
1435 |
+- runtime->appl_ptr %= runtime->buffer_size; |
1436 |
+- runtime->avail -= count1; |
1437 |
+ result += count1; |
1438 |
+ count -= count1; |
1439 |
+ } |
1440 |
+diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c |
1441 |
+index c5b773a1eea9..4a09c3085ca4 100644 |
1442 |
+--- a/sound/core/seq/oss/seq_oss_synth.c |
1443 |
++++ b/sound/core/seq/oss/seq_oss_synth.c |
1444 |
+@@ -310,7 +310,7 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp) |
1445 |
+ struct seq_oss_synth *rec; |
1446 |
+ struct seq_oss_synthinfo *info; |
1447 |
+ |
1448 |
+- if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS)) |
1449 |
++ if (snd_BUG_ON(dp->max_synthdev > SNDRV_SEQ_OSS_MAX_SYNTH_DEVS)) |
1450 |
+ return; |
1451 |
+ for (i = 0; i < dp->max_synthdev; i++) { |
1452 |
+ info = &dp->synths[i]; |
1453 |
+diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c |
1454 |
+index ecfbf5f39d38..08865dcbf5f1 100644 |
1455 |
+--- a/sound/core/seq/seq_clientmgr.c |
1456 |
++++ b/sound/core/seq/seq_clientmgr.c |
1457 |
+@@ -678,6 +678,9 @@ static int deliver_to_subscribers(struct snd_seq_client *client, |
1458 |
+ else |
1459 |
+ down_read(&grp->list_mutex); |
1460 |
+ list_for_each_entry(subs, &grp->list_head, src_list) { |
1461 |
++ /* both ports ready? */ |
1462 |
++ if (atomic_read(&subs->ref_count) != 2) |
1463 |
++ continue; |
1464 |
+ event->dest = subs->info.dest; |
1465 |
+ if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) |
1466 |
+ /* convert time according to flag with subscription */ |
1467 |
+diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c |
1468 |
+index 9516e5ce3aad..67c91d226552 100644 |
1469 |
+--- a/sound/core/seq/seq_ports.c |
1470 |
++++ b/sound/core/seq/seq_ports.c |
1471 |
+@@ -175,10 +175,6 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, |
1472 |
+ } |
1473 |
+ |
1474 |
+ /* */ |
1475 |
+-enum group_type { |
1476 |
+- SRC_LIST, DEST_LIST |
1477 |
+-}; |
1478 |
+- |
1479 |
+ static int subscribe_port(struct snd_seq_client *client, |
1480 |
+ struct snd_seq_client_port *port, |
1481 |
+ struct snd_seq_port_subs_info *grp, |
1482 |
+@@ -205,6 +201,20 @@ static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr, |
1483 |
+ return NULL; |
1484 |
+ } |
1485 |
+ |
1486 |
++static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
1487 |
++ struct snd_seq_client_port *port, |
1488 |
++ struct snd_seq_subscribers *subs, |
1489 |
++ bool is_src, bool ack); |
1490 |
++ |
1491 |
++static inline struct snd_seq_subscribers * |
1492 |
++get_subscriber(struct list_head *p, bool is_src) |
1493 |
++{ |
1494 |
++ if (is_src) |
1495 |
++ return list_entry(p, struct snd_seq_subscribers, src_list); |
1496 |
++ else |
1497 |
++ return list_entry(p, struct snd_seq_subscribers, dest_list); |
1498 |
++} |
1499 |
++ |
1500 |
+ /* |
1501 |
+ * remove all subscribers on the list |
1502 |
+ * this is called from port_delete, for each src and dest list. |
1503 |
+@@ -212,7 +222,7 @@ static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr, |
1504 |
+ static void clear_subscriber_list(struct snd_seq_client *client, |
1505 |
+ struct snd_seq_client_port *port, |
1506 |
+ struct snd_seq_port_subs_info *grp, |
1507 |
+- int grptype) |
1508 |
++ int is_src) |
1509 |
+ { |
1510 |
+ struct list_head *p, *n; |
1511 |
+ |
1512 |
+@@ -221,15 +231,13 @@ static void clear_subscriber_list(struct snd_seq_client *client, |
1513 |
+ struct snd_seq_client *c; |
1514 |
+ struct snd_seq_client_port *aport; |
1515 |
+ |
1516 |
+- if (grptype == SRC_LIST) { |
1517 |
+- subs = list_entry(p, struct snd_seq_subscribers, src_list); |
1518 |
++ subs = get_subscriber(p, is_src); |
1519 |
++ if (is_src) |
1520 |
+ aport = get_client_port(&subs->info.dest, &c); |
1521 |
+- } else { |
1522 |
+- subs = list_entry(p, struct snd_seq_subscribers, dest_list); |
1523 |
++ else |
1524 |
+ aport = get_client_port(&subs->info.sender, &c); |
1525 |
+- } |
1526 |
+- list_del(p); |
1527 |
+- unsubscribe_port(client, port, grp, &subs->info, 0); |
1528 |
++ delete_and_unsubscribe_port(client, port, subs, is_src, false); |
1529 |
++ |
1530 |
+ if (!aport) { |
1531 |
+ /* looks like the connected port is being deleted. |
1532 |
+ * we decrease the counter, and when both ports are deleted |
1533 |
+@@ -237,21 +245,14 @@ static void clear_subscriber_list(struct snd_seq_client *client, |
1534 |
+ */ |
1535 |
+ if (atomic_dec_and_test(&subs->ref_count)) |
1536 |
+ kfree(subs); |
1537 |
+- } else { |
1538 |
+- /* ok we got the connected port */ |
1539 |
+- struct snd_seq_port_subs_info *agrp; |
1540 |
+- agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src; |
1541 |
+- down_write(&agrp->list_mutex); |
1542 |
+- if (grptype == SRC_LIST) |
1543 |
+- list_del(&subs->dest_list); |
1544 |
+- else |
1545 |
+- list_del(&subs->src_list); |
1546 |
+- up_write(&agrp->list_mutex); |
1547 |
+- unsubscribe_port(c, aport, agrp, &subs->info, 1); |
1548 |
+- kfree(subs); |
1549 |
+- snd_seq_port_unlock(aport); |
1550 |
+- snd_seq_client_unlock(c); |
1551 |
++ continue; |
1552 |
+ } |
1553 |
++ |
1554 |
++ /* ok we got the connected port */ |
1555 |
++ delete_and_unsubscribe_port(c, aport, subs, !is_src, true); |
1556 |
++ kfree(subs); |
1557 |
++ snd_seq_port_unlock(aport); |
1558 |
++ snd_seq_client_unlock(c); |
1559 |
+ } |
1560 |
+ } |
1561 |
+ |
1562 |
+@@ -264,8 +265,8 @@ static int port_delete(struct snd_seq_client *client, |
1563 |
+ snd_use_lock_sync(&port->use_lock); |
1564 |
+ |
1565 |
+ /* clear subscribers info */ |
1566 |
+- clear_subscriber_list(client, port, &port->c_src, SRC_LIST); |
1567 |
+- clear_subscriber_list(client, port, &port->c_dest, DEST_LIST); |
1568 |
++ clear_subscriber_list(client, port, &port->c_src, true); |
1569 |
++ clear_subscriber_list(client, port, &port->c_dest, false); |
1570 |
+ |
1571 |
+ if (port->private_free) |
1572 |
+ port->private_free(port->private_data); |
1573 |
+@@ -484,85 +485,120 @@ static int match_subs_info(struct snd_seq_port_subscribe *r, |
1574 |
+ return 0; |
1575 |
+ } |
1576 |
+ |
1577 |
+- |
1578 |
+-/* connect two ports */ |
1579 |
+-int snd_seq_port_connect(struct snd_seq_client *connector, |
1580 |
+- struct snd_seq_client *src_client, |
1581 |
+- struct snd_seq_client_port *src_port, |
1582 |
+- struct snd_seq_client *dest_client, |
1583 |
+- struct snd_seq_client_port *dest_port, |
1584 |
+- struct snd_seq_port_subscribe *info) |
1585 |
++static int check_and_subscribe_port(struct snd_seq_client *client, |
1586 |
++ struct snd_seq_client_port *port, |
1587 |
++ struct snd_seq_subscribers *subs, |
1588 |
++ bool is_src, bool exclusive, bool ack) |
1589 |
+ { |
1590 |
+- struct snd_seq_port_subs_info *src = &src_port->c_src; |
1591 |
+- struct snd_seq_port_subs_info *dest = &dest_port->c_dest; |
1592 |
+- struct snd_seq_subscribers *subs, *s; |
1593 |
+- int err, src_called = 0; |
1594 |
+- unsigned long flags; |
1595 |
+- int exclusive; |
1596 |
++ struct snd_seq_port_subs_info *grp; |
1597 |
++ struct list_head *p; |
1598 |
++ struct snd_seq_subscribers *s; |
1599 |
++ int err; |
1600 |
+ |
1601 |
+- subs = kzalloc(sizeof(*subs), GFP_KERNEL); |
1602 |
+- if (! subs) |
1603 |
+- return -ENOMEM; |
1604 |
+- |
1605 |
+- subs->info = *info; |
1606 |
+- atomic_set(&subs->ref_count, 2); |
1607 |
+- |
1608 |
+- down_write(&src->list_mutex); |
1609 |
+- down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING); |
1610 |
+- |
1611 |
+- exclusive = info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE ? 1 : 0; |
1612 |
++ grp = is_src ? &port->c_src : &port->c_dest; |
1613 |
+ err = -EBUSY; |
1614 |
++ down_write(&grp->list_mutex); |
1615 |
+ if (exclusive) { |
1616 |
+- if (! list_empty(&src->list_head) || ! list_empty(&dest->list_head)) |
1617 |
++ if (!list_empty(&grp->list_head)) |
1618 |
+ goto __error; |
1619 |
+ } else { |
1620 |
+- if (src->exclusive || dest->exclusive) |
1621 |
++ if (grp->exclusive) |
1622 |
+ goto __error; |
1623 |
+ /* check whether already exists */ |
1624 |
+- list_for_each_entry(s, &src->list_head, src_list) { |
1625 |
+- if (match_subs_info(info, &s->info)) |
1626 |
+- goto __error; |
1627 |
+- } |
1628 |
+- list_for_each_entry(s, &dest->list_head, dest_list) { |
1629 |
+- if (match_subs_info(info, &s->info)) |
1630 |
++ list_for_each(p, &grp->list_head) { |
1631 |
++ s = get_subscriber(p, is_src); |
1632 |
++ if (match_subs_info(&subs->info, &s->info)) |
1633 |
+ goto __error; |
1634 |
+ } |
1635 |
+ } |
1636 |
+ |
1637 |
+- if ((err = subscribe_port(src_client, src_port, src, info, |
1638 |
+- connector->number != src_client->number)) < 0) |
1639 |
+- goto __error; |
1640 |
+- src_called = 1; |
1641 |
+- |
1642 |
+- if ((err = subscribe_port(dest_client, dest_port, dest, info, |
1643 |
+- connector->number != dest_client->number)) < 0) |
1644 |
++ err = subscribe_port(client, port, grp, &subs->info, ack); |
1645 |
++ if (err < 0) { |
1646 |
++ grp->exclusive = 0; |
1647 |
+ goto __error; |
1648 |
++ } |
1649 |
+ |
1650 |
+ /* add to list */ |
1651 |
+- write_lock_irqsave(&src->list_lock, flags); |
1652 |
+- // write_lock(&dest->list_lock); // no other lock yet |
1653 |
+- list_add_tail(&subs->src_list, &src->list_head); |
1654 |
+- list_add_tail(&subs->dest_list, &dest->list_head); |
1655 |
+- // write_unlock(&dest->list_lock); // no other lock yet |
1656 |
+- write_unlock_irqrestore(&src->list_lock, flags); |
1657 |
++ write_lock_irq(&grp->list_lock); |
1658 |
++ if (is_src) |
1659 |
++ list_add_tail(&subs->src_list, &grp->list_head); |
1660 |
++ else |
1661 |
++ list_add_tail(&subs->dest_list, &grp->list_head); |
1662 |
++ grp->exclusive = exclusive; |
1663 |
++ atomic_inc(&subs->ref_count); |
1664 |
++ write_unlock_irq(&grp->list_lock); |
1665 |
++ err = 0; |
1666 |
++ |
1667 |
++ __error: |
1668 |
++ up_write(&grp->list_mutex); |
1669 |
++ return err; |
1670 |
++} |
1671 |
+ |
1672 |
+- src->exclusive = dest->exclusive = exclusive; |
1673 |
++static void delete_and_unsubscribe_port(struct snd_seq_client *client, |
1674 |
++ struct snd_seq_client_port *port, |
1675 |
++ struct snd_seq_subscribers *subs, |
1676 |
++ bool is_src, bool ack) |
1677 |
++{ |
1678 |
++ struct snd_seq_port_subs_info *grp; |
1679 |
++ |
1680 |
++ grp = is_src ? &port->c_src : &port->c_dest; |
1681 |
++ down_write(&grp->list_mutex); |
1682 |
++ write_lock_irq(&grp->list_lock); |
1683 |
++ if (is_src) |
1684 |
++ list_del(&subs->src_list); |
1685 |
++ else |
1686 |
++ list_del(&subs->dest_list); |
1687 |
++ grp->exclusive = 0; |
1688 |
++ write_unlock_irq(&grp->list_lock); |
1689 |
++ up_write(&grp->list_mutex); |
1690 |
++ |
1691 |
++ unsubscribe_port(client, port, grp, &subs->info, ack); |
1692 |
++} |
1693 |
++ |
1694 |
++/* connect two ports */ |
1695 |
++int snd_seq_port_connect(struct snd_seq_client *connector, |
1696 |
++ struct snd_seq_client *src_client, |
1697 |
++ struct snd_seq_client_port *src_port, |
1698 |
++ struct snd_seq_client *dest_client, |
1699 |
++ struct snd_seq_client_port *dest_port, |
1700 |
++ struct snd_seq_port_subscribe *info) |
1701 |
++{ |
1702 |
++ struct snd_seq_subscribers *subs; |
1703 |
++ bool exclusive; |
1704 |
++ int err; |
1705 |
++ |
1706 |
++ subs = kzalloc(sizeof(*subs), GFP_KERNEL); |
1707 |
++ if (!subs) |
1708 |
++ return -ENOMEM; |
1709 |
++ |
1710 |
++ subs->info = *info; |
1711 |
++ atomic_set(&subs->ref_count, 0); |
1712 |
++ INIT_LIST_HEAD(&subs->src_list); |
1713 |
++ INIT_LIST_HEAD(&subs->dest_list); |
1714 |
++ |
1715 |
++ exclusive = !!(info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE); |
1716 |
++ |
1717 |
++ err = check_and_subscribe_port(src_client, src_port, subs, true, |
1718 |
++ exclusive, |
1719 |
++ connector->number != src_client->number); |
1720 |
++ if (err < 0) |
1721 |
++ goto error; |
1722 |
++ err = check_and_subscribe_port(dest_client, dest_port, subs, false, |
1723 |
++ exclusive, |
1724 |
++ connector->number != dest_client->number); |
1725 |
++ if (err < 0) |
1726 |
++ goto error_dest; |
1727 |
+ |
1728 |
+- up_write(&dest->list_mutex); |
1729 |
+- up_write(&src->list_mutex); |
1730 |
+ return 0; |
1731 |
+ |
1732 |
+- __error: |
1733 |
+- if (src_called) |
1734 |
+- unsubscribe_port(src_client, src_port, src, info, |
1735 |
+- connector->number != src_client->number); |
1736 |
++ error_dest: |
1737 |
++ delete_and_unsubscribe_port(src_client, src_port, subs, true, |
1738 |
++ connector->number != src_client->number); |
1739 |
++ error: |
1740 |
+ kfree(subs); |
1741 |
+- up_write(&dest->list_mutex); |
1742 |
+- up_write(&src->list_mutex); |
1743 |
+ return err; |
1744 |
+ } |
1745 |
+ |
1746 |
+- |
1747 |
+ /* remove the connection */ |
1748 |
+ int snd_seq_port_disconnect(struct snd_seq_client *connector, |
1749 |
+ struct snd_seq_client *src_client, |
1750 |
+@@ -572,37 +608,28 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, |
1751 |
+ struct snd_seq_port_subscribe *info) |
1752 |
+ { |
1753 |
+ struct snd_seq_port_subs_info *src = &src_port->c_src; |
1754 |
+- struct snd_seq_port_subs_info *dest = &dest_port->c_dest; |
1755 |
+ struct snd_seq_subscribers *subs; |
1756 |
+ int err = -ENOENT; |
1757 |
+- unsigned long flags; |
1758 |
+ |
1759 |
+ down_write(&src->list_mutex); |
1760 |
+- down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING); |
1761 |
+- |
1762 |
+ /* look for the connection */ |
1763 |
+ list_for_each_entry(subs, &src->list_head, src_list) { |
1764 |
+ if (match_subs_info(info, &subs->info)) { |
1765 |
+- write_lock_irqsave(&src->list_lock, flags); |
1766 |
+- // write_lock(&dest->list_lock); // no lock yet |
1767 |
+- list_del(&subs->src_list); |
1768 |
+- list_del(&subs->dest_list); |
1769 |
+- // write_unlock(&dest->list_lock); |
1770 |
+- write_unlock_irqrestore(&src->list_lock, flags); |
1771 |
+- src->exclusive = dest->exclusive = 0; |
1772 |
+- unsubscribe_port(src_client, src_port, src, info, |
1773 |
+- connector->number != src_client->number); |
1774 |
+- unsubscribe_port(dest_client, dest_port, dest, info, |
1775 |
+- connector->number != dest_client->number); |
1776 |
+- kfree(subs); |
1777 |
++ atomic_dec(&subs->ref_count); /* mark as not ready */ |
1778 |
+ err = 0; |
1779 |
+ break; |
1780 |
+ } |
1781 |
+ } |
1782 |
+- |
1783 |
+- up_write(&dest->list_mutex); |
1784 |
+ up_write(&src->list_mutex); |
1785 |
+- return err; |
1786 |
++ if (err < 0) |
1787 |
++ return err; |
1788 |
++ |
1789 |
++ delete_and_unsubscribe_port(src_client, src_port, subs, true, |
1790 |
++ connector->number != src_client->number); |
1791 |
++ delete_and_unsubscribe_port(dest_client, dest_port, subs, false, |
1792 |
++ connector->number != dest_client->number); |
1793 |
++ kfree(subs); |
1794 |
++ return 0; |
1795 |
+ } |
1796 |
+ |
1797 |
+ |
1798 |
+diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c |
1799 |
+index 24d44b2f61ac..6ec30a98a92a 100644 |
1800 |
+--- a/sound/core/seq/seq_timer.c |
1801 |
++++ b/sound/core/seq/seq_timer.c |
1802 |
+@@ -92,6 +92,9 @@ void snd_seq_timer_delete(struct snd_seq_timer **tmr) |
1803 |
+ |
1804 |
+ void snd_seq_timer_defaults(struct snd_seq_timer * tmr) |
1805 |
+ { |
1806 |
++ unsigned long flags; |
1807 |
++ |
1808 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1809 |
+ /* setup defaults */ |
1810 |
+ tmr->ppq = 96; /* 96 PPQ */ |
1811 |
+ tmr->tempo = 500000; /* 120 BPM */ |
1812 |
+@@ -107,21 +110,25 @@ void snd_seq_timer_defaults(struct snd_seq_timer * tmr) |
1813 |
+ tmr->preferred_resolution = seq_default_timer_resolution; |
1814 |
+ |
1815 |
+ tmr->skew = tmr->skew_base = SKEW_BASE; |
1816 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1817 |
+ } |
1818 |
+ |
1819 |
+-void snd_seq_timer_reset(struct snd_seq_timer * tmr) |
1820 |
++static void seq_timer_reset(struct snd_seq_timer *tmr) |
1821 |
+ { |
1822 |
+- unsigned long flags; |
1823 |
+- |
1824 |
+- spin_lock_irqsave(&tmr->lock, flags); |
1825 |
+- |
1826 |
+ /* reset time & songposition */ |
1827 |
+ tmr->cur_time.tv_sec = 0; |
1828 |
+ tmr->cur_time.tv_nsec = 0; |
1829 |
+ |
1830 |
+ tmr->tick.cur_tick = 0; |
1831 |
+ tmr->tick.fraction = 0; |
1832 |
++} |
1833 |
++ |
1834 |
++void snd_seq_timer_reset(struct snd_seq_timer *tmr) |
1835 |
++{ |
1836 |
++ unsigned long flags; |
1837 |
+ |
1838 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1839 |
++ seq_timer_reset(tmr); |
1840 |
+ spin_unlock_irqrestore(&tmr->lock, flags); |
1841 |
+ } |
1842 |
+ |
1843 |
+@@ -140,8 +147,11 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, |
1844 |
+ tmr = q->timer; |
1845 |
+ if (tmr == NULL) |
1846 |
+ return; |
1847 |
+- if (!tmr->running) |
1848 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1849 |
++ if (!tmr->running) { |
1850 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1851 |
+ return; |
1852 |
++ } |
1853 |
+ |
1854 |
+ resolution *= ticks; |
1855 |
+ if (tmr->skew != tmr->skew_base) { |
1856 |
+@@ -150,8 +160,6 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, |
1857 |
+ (((resolution & 0xffff) * tmr->skew) >> 16); |
1858 |
+ } |
1859 |
+ |
1860 |
+- spin_lock_irqsave(&tmr->lock, flags); |
1861 |
+- |
1862 |
+ /* update timer */ |
1863 |
+ snd_seq_inc_time_nsec(&tmr->cur_time, resolution); |
1864 |
+ |
1865 |
+@@ -298,26 +306,30 @@ int snd_seq_timer_open(struct snd_seq_queue *q) |
1866 |
+ t->callback = snd_seq_timer_interrupt; |
1867 |
+ t->callback_data = q; |
1868 |
+ t->flags |= SNDRV_TIMER_IFLG_AUTO; |
1869 |
++ spin_lock_irq(&tmr->lock); |
1870 |
+ tmr->timeri = t; |
1871 |
++ spin_unlock_irq(&tmr->lock); |
1872 |
+ return 0; |
1873 |
+ } |
1874 |
+ |
1875 |
+ int snd_seq_timer_close(struct snd_seq_queue *q) |
1876 |
+ { |
1877 |
+ struct snd_seq_timer *tmr; |
1878 |
++ struct snd_timer_instance *t; |
1879 |
+ |
1880 |
+ tmr = q->timer; |
1881 |
+ if (snd_BUG_ON(!tmr)) |
1882 |
+ return -EINVAL; |
1883 |
+- if (tmr->timeri) { |
1884 |
+- snd_timer_stop(tmr->timeri); |
1885 |
+- snd_timer_close(tmr->timeri); |
1886 |
+- tmr->timeri = NULL; |
1887 |
+- } |
1888 |
++ spin_lock_irq(&tmr->lock); |
1889 |
++ t = tmr->timeri; |
1890 |
++ tmr->timeri = NULL; |
1891 |
++ spin_unlock_irq(&tmr->lock); |
1892 |
++ if (t) |
1893 |
++ snd_timer_close(t); |
1894 |
+ return 0; |
1895 |
+ } |
1896 |
+ |
1897 |
+-int snd_seq_timer_stop(struct snd_seq_timer * tmr) |
1898 |
++static int seq_timer_stop(struct snd_seq_timer *tmr) |
1899 |
+ { |
1900 |
+ if (! tmr->timeri) |
1901 |
+ return -EINVAL; |
1902 |
+@@ -328,6 +340,17 @@ int snd_seq_timer_stop(struct snd_seq_timer * tmr) |
1903 |
+ return 0; |
1904 |
+ } |
1905 |
+ |
1906 |
++int snd_seq_timer_stop(struct snd_seq_timer *tmr) |
1907 |
++{ |
1908 |
++ unsigned long flags; |
1909 |
++ int err; |
1910 |
++ |
1911 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1912 |
++ err = seq_timer_stop(tmr); |
1913 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1914 |
++ return err; |
1915 |
++} |
1916 |
++ |
1917 |
+ static int initialize_timer(struct snd_seq_timer *tmr) |
1918 |
+ { |
1919 |
+ struct snd_timer *t; |
1920 |
+@@ -360,13 +383,13 @@ static int initialize_timer(struct snd_seq_timer *tmr) |
1921 |
+ return 0; |
1922 |
+ } |
1923 |
+ |
1924 |
+-int snd_seq_timer_start(struct snd_seq_timer * tmr) |
1925 |
++static int seq_timer_start(struct snd_seq_timer *tmr) |
1926 |
+ { |
1927 |
+ if (! tmr->timeri) |
1928 |
+ return -EINVAL; |
1929 |
+ if (tmr->running) |
1930 |
+- snd_seq_timer_stop(tmr); |
1931 |
+- snd_seq_timer_reset(tmr); |
1932 |
++ seq_timer_stop(tmr); |
1933 |
++ seq_timer_reset(tmr); |
1934 |
+ if (initialize_timer(tmr) < 0) |
1935 |
+ return -EINVAL; |
1936 |
+ snd_timer_start(tmr->timeri, tmr->ticks); |
1937 |
+@@ -375,14 +398,25 @@ int snd_seq_timer_start(struct snd_seq_timer * tmr) |
1938 |
+ return 0; |
1939 |
+ } |
1940 |
+ |
1941 |
+-int snd_seq_timer_continue(struct snd_seq_timer * tmr) |
1942 |
++int snd_seq_timer_start(struct snd_seq_timer *tmr) |
1943 |
++{ |
1944 |
++ unsigned long flags; |
1945 |
++ int err; |
1946 |
++ |
1947 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1948 |
++ err = seq_timer_start(tmr); |
1949 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1950 |
++ return err; |
1951 |
++} |
1952 |
++ |
1953 |
++static int seq_timer_continue(struct snd_seq_timer *tmr) |
1954 |
+ { |
1955 |
+ if (! tmr->timeri) |
1956 |
+ return -EINVAL; |
1957 |
+ if (tmr->running) |
1958 |
+ return -EBUSY; |
1959 |
+ if (! tmr->initialized) { |
1960 |
+- snd_seq_timer_reset(tmr); |
1961 |
++ seq_timer_reset(tmr); |
1962 |
+ if (initialize_timer(tmr) < 0) |
1963 |
+ return -EINVAL; |
1964 |
+ } |
1965 |
+@@ -392,11 +426,24 @@ int snd_seq_timer_continue(struct snd_seq_timer * tmr) |
1966 |
+ return 0; |
1967 |
+ } |
1968 |
+ |
1969 |
++int snd_seq_timer_continue(struct snd_seq_timer *tmr) |
1970 |
++{ |
1971 |
++ unsigned long flags; |
1972 |
++ int err; |
1973 |
++ |
1974 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1975 |
++ err = seq_timer_continue(tmr); |
1976 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1977 |
++ return err; |
1978 |
++} |
1979 |
++ |
1980 |
+ /* return current 'real' time. use timeofday() to get better granularity. */ |
1981 |
+ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) |
1982 |
+ { |
1983 |
+ snd_seq_real_time_t cur_time; |
1984 |
++ unsigned long flags; |
1985 |
+ |
1986 |
++ spin_lock_irqsave(&tmr->lock, flags); |
1987 |
+ cur_time = tmr->cur_time; |
1988 |
+ if (tmr->running) { |
1989 |
+ struct timeval tm; |
1990 |
+@@ -412,7 +459,7 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) |
1991 |
+ } |
1992 |
+ snd_seq_sanity_real_time(&cur_time); |
1993 |
+ } |
1994 |
+- |
1995 |
++ spin_unlock_irqrestore(&tmr->lock, flags); |
1996 |
+ return cur_time; |
1997 |
+ } |
1998 |
+ |
1999 |
+diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c |
2000 |
+index 4b50e604276d..0fa691e01384 100644 |
2001 |
+--- a/sound/core/seq/seq_virmidi.c |
2002 |
++++ b/sound/core/seq/seq_virmidi.c |
2003 |
+@@ -254,9 +254,13 @@ static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream) |
2004 |
+ */ |
2005 |
+ static int snd_virmidi_input_close(struct snd_rawmidi_substream *substream) |
2006 |
+ { |
2007 |
++ struct snd_virmidi_dev *rdev = substream->rmidi->private_data; |
2008 |
+ struct snd_virmidi *vmidi = substream->runtime->private_data; |
2009 |
+- snd_midi_event_free(vmidi->parser); |
2010 |
++ |
2011 |
++ write_lock_irq(&rdev->filelist_lock); |
2012 |
+ list_del(&vmidi->list); |
2013 |
++ write_unlock_irq(&rdev->filelist_lock); |
2014 |
++ snd_midi_event_free(vmidi->parser); |
2015 |
+ substream->runtime->private_data = NULL; |
2016 |
+ kfree(vmidi); |
2017 |
+ return 0; |
2018 |
+diff --git a/sound/core/timer.c b/sound/core/timer.c |
2019 |
+index 4e436fe53afa..d90d8f4b85fe 100644 |
2020 |
+--- a/sound/core/timer.c |
2021 |
++++ b/sound/core/timer.c |
2022 |
+@@ -300,8 +300,7 @@ int snd_timer_open(struct snd_timer_instance **ti, |
2023 |
+ return 0; |
2024 |
+ } |
2025 |
+ |
2026 |
+-static int _snd_timer_stop(struct snd_timer_instance *timeri, |
2027 |
+- int keep_flag, int event); |
2028 |
++static int _snd_timer_stop(struct snd_timer_instance *timeri, int event); |
2029 |
+ |
2030 |
+ /* |
2031 |
+ * close a timer instance |
2032 |
+@@ -343,7 +342,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) |
2033 |
+ spin_unlock_irq(&timer->lock); |
2034 |
+ mutex_lock(®ister_mutex); |
2035 |
+ list_del(&timeri->open_list); |
2036 |
+- if (timer && list_empty(&timer->open_list_head) && |
2037 |
++ if (list_empty(&timer->open_list_head) && |
2038 |
+ timer->hw.close) |
2039 |
+ timer->hw.close(timer); |
2040 |
+ /* remove slave links */ |
2041 |
+@@ -415,7 +414,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) |
2042 |
+ spin_lock_irqsave(&timer->lock, flags); |
2043 |
+ list_for_each_entry(ts, &ti->slave_active_head, active_list) |
2044 |
+ if (ts->ccallback) |
2045 |
+- ts->ccallback(ti, event + 100, &tstamp, resolution); |
2046 |
++ ts->ccallback(ts, event + 100, &tstamp, resolution); |
2047 |
+ spin_unlock_irqrestore(&timer->lock, flags); |
2048 |
+ } |
2049 |
+ |
2050 |
+@@ -444,6 +443,10 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri) |
2051 |
+ unsigned long flags; |
2052 |
+ |
2053 |
+ spin_lock_irqsave(&slave_active_lock, flags); |
2054 |
++ if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { |
2055 |
++ spin_unlock_irqrestore(&slave_active_lock, flags); |
2056 |
++ return -EBUSY; |
2057 |
++ } |
2058 |
+ timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; |
2059 |
+ if (timeri->master && timeri->timer) { |
2060 |
+ spin_lock(&timeri->timer->lock); |
2061 |
+@@ -468,23 +471,30 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) |
2062 |
+ return -EINVAL; |
2063 |
+ if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { |
2064 |
+ result = snd_timer_start_slave(timeri); |
2065 |
+- snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); |
2066 |
++ if (result >= 0) |
2067 |
++ snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); |
2068 |
+ return result; |
2069 |
+ } |
2070 |
+ timer = timeri->timer; |
2071 |
+ if (timer == NULL) |
2072 |
+ return -EINVAL; |
2073 |
+ spin_lock_irqsave(&timer->lock, flags); |
2074 |
++ if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | |
2075 |
++ SNDRV_TIMER_IFLG_START)) { |
2076 |
++ result = -EBUSY; |
2077 |
++ goto unlock; |
2078 |
++ } |
2079 |
+ timeri->ticks = timeri->cticks = ticks; |
2080 |
+ timeri->pticks = 0; |
2081 |
+ result = snd_timer_start1(timer, timeri, ticks); |
2082 |
++ unlock: |
2083 |
+ spin_unlock_irqrestore(&timer->lock, flags); |
2084 |
+- snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); |
2085 |
++ if (result >= 0) |
2086 |
++ snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); |
2087 |
+ return result; |
2088 |
+ } |
2089 |
+ |
2090 |
+-static int _snd_timer_stop(struct snd_timer_instance * timeri, |
2091 |
+- int keep_flag, int event) |
2092 |
++static int _snd_timer_stop(struct snd_timer_instance *timeri, int event) |
2093 |
+ { |
2094 |
+ struct snd_timer *timer; |
2095 |
+ unsigned long flags; |
2096 |
+@@ -493,19 +503,30 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, |
2097 |
+ return -ENXIO; |
2098 |
+ |
2099 |
+ if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { |
2100 |
+- if (!keep_flag) { |
2101 |
+- spin_lock_irqsave(&slave_active_lock, flags); |
2102 |
+- timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; |
2103 |
+- list_del_init(&timeri->ack_list); |
2104 |
+- list_del_init(&timeri->active_list); |
2105 |
++ spin_lock_irqsave(&slave_active_lock, flags); |
2106 |
++ if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) { |
2107 |
+ spin_unlock_irqrestore(&slave_active_lock, flags); |
2108 |
++ return -EBUSY; |
2109 |
+ } |
2110 |
++ if (timeri->timer) |
2111 |
++ spin_lock(&timeri->timer->lock); |
2112 |
++ timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; |
2113 |
++ list_del_init(&timeri->ack_list); |
2114 |
++ list_del_init(&timeri->active_list); |
2115 |
++ if (timeri->timer) |
2116 |
++ spin_unlock(&timeri->timer->lock); |
2117 |
++ spin_unlock_irqrestore(&slave_active_lock, flags); |
2118 |
+ goto __end; |
2119 |
+ } |
2120 |
+ timer = timeri->timer; |
2121 |
+ if (!timer) |
2122 |
+ return -EINVAL; |
2123 |
+ spin_lock_irqsave(&timer->lock, flags); |
2124 |
++ if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | |
2125 |
++ SNDRV_TIMER_IFLG_START))) { |
2126 |
++ spin_unlock_irqrestore(&timer->lock, flags); |
2127 |
++ return -EBUSY; |
2128 |
++ } |
2129 |
+ list_del_init(&timeri->ack_list); |
2130 |
+ list_del_init(&timeri->active_list); |
2131 |
+ if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && |
2132 |
+@@ -520,9 +541,7 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, |
2133 |
+ } |
2134 |
+ } |
2135 |
+ } |
2136 |
+- if (!keep_flag) |
2137 |
+- timeri->flags &= |
2138 |
+- ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); |
2139 |
++ timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); |
2140 |
+ spin_unlock_irqrestore(&timer->lock, flags); |
2141 |
+ __end: |
2142 |
+ if (event != SNDRV_TIMER_EVENT_RESOLUTION) |
2143 |
+@@ -541,7 +560,7 @@ int snd_timer_stop(struct snd_timer_instance *timeri) |
2144 |
+ unsigned long flags; |
2145 |
+ int err; |
2146 |
+ |
2147 |
+- err = _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_STOP); |
2148 |
++ err = _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_STOP); |
2149 |
+ if (err < 0) |
2150 |
+ return err; |
2151 |
+ timer = timeri->timer; |
2152 |
+@@ -571,10 +590,15 @@ int snd_timer_continue(struct snd_timer_instance *timeri) |
2153 |
+ if (! timer) |
2154 |
+ return -EINVAL; |
2155 |
+ spin_lock_irqsave(&timer->lock, flags); |
2156 |
++ if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { |
2157 |
++ result = -EBUSY; |
2158 |
++ goto unlock; |
2159 |
++ } |
2160 |
+ if (!timeri->cticks) |
2161 |
+ timeri->cticks = 1; |
2162 |
+ timeri->pticks = 0; |
2163 |
+ result = snd_timer_start1(timer, timeri, timer->sticks); |
2164 |
++ unlock: |
2165 |
+ spin_unlock_irqrestore(&timer->lock, flags); |
2166 |
+ snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_CONTINUE); |
2167 |
+ return result; |
2168 |
+@@ -585,7 +609,7 @@ int snd_timer_continue(struct snd_timer_instance *timeri) |
2169 |
+ */ |
2170 |
+ int snd_timer_pause(struct snd_timer_instance * timeri) |
2171 |
+ { |
2172 |
+- return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE); |
2173 |
++ return _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_PAUSE); |
2174 |
+ } |
2175 |
+ |
2176 |
+ /* |
2177 |
+@@ -702,8 +726,8 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) |
2178 |
+ ti->cticks = ti->ticks; |
2179 |
+ } else { |
2180 |
+ ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING; |
2181 |
+- if (--timer->running) |
2182 |
+- list_del_init(&ti->active_list); |
2183 |
++ --timer->running; |
2184 |
++ list_del_init(&ti->active_list); |
2185 |
+ } |
2186 |
+ if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || |
2187 |
+ (ti->flags & SNDRV_TIMER_IFLG_FAST)) |
2188 |
+diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c |
2189 |
+index fd798f753609..982a2c2faf24 100644 |
2190 |
+--- a/sound/drivers/dummy.c |
2191 |
++++ b/sound/drivers/dummy.c |
2192 |
+@@ -109,6 +109,9 @@ struct dummy_timer_ops { |
2193 |
+ snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); |
2194 |
+ }; |
2195 |
+ |
2196 |
++#define get_dummy_ops(substream) \ |
2197 |
++ (*(const struct dummy_timer_ops **)(substream)->runtime->private_data) |
2198 |
++ |
2199 |
+ struct dummy_model { |
2200 |
+ const char *name; |
2201 |
+ int (*playback_constraints)(struct snd_pcm_runtime *runtime); |
2202 |
+@@ -137,7 +140,6 @@ struct snd_dummy { |
2203 |
+ int iobox; |
2204 |
+ struct snd_kcontrol *cd_volume_ctl; |
2205 |
+ struct snd_kcontrol *cd_switch_ctl; |
2206 |
+- const struct dummy_timer_ops *timer_ops; |
2207 |
+ }; |
2208 |
+ |
2209 |
+ /* |
2210 |
+@@ -231,6 +233,8 @@ struct dummy_model *dummy_models[] = { |
2211 |
+ */ |
2212 |
+ |
2213 |
+ struct dummy_systimer_pcm { |
2214 |
++ /* ops must be the first item */ |
2215 |
++ const struct dummy_timer_ops *timer_ops; |
2216 |
+ spinlock_t lock; |
2217 |
+ struct timer_list timer; |
2218 |
+ unsigned long base_time; |
2219 |
+@@ -368,6 +372,8 @@ static struct dummy_timer_ops dummy_systimer_ops = { |
2220 |
+ */ |
2221 |
+ |
2222 |
+ struct dummy_hrtimer_pcm { |
2223 |
++ /* ops must be the first item */ |
2224 |
++ const struct dummy_timer_ops *timer_ops; |
2225 |
+ ktime_t base_time; |
2226 |
+ ktime_t period_time; |
2227 |
+ atomic_t running; |
2228 |
+@@ -494,31 +500,25 @@ static struct dummy_timer_ops dummy_hrtimer_ops = { |
2229 |
+ |
2230 |
+ static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
2231 |
+ { |
2232 |
+- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
2233 |
+- |
2234 |
+ switch (cmd) { |
2235 |
+ case SNDRV_PCM_TRIGGER_START: |
2236 |
+ case SNDRV_PCM_TRIGGER_RESUME: |
2237 |
+- return dummy->timer_ops->start(substream); |
2238 |
++ return get_dummy_ops(substream)->start(substream); |
2239 |
+ case SNDRV_PCM_TRIGGER_STOP: |
2240 |
+ case SNDRV_PCM_TRIGGER_SUSPEND: |
2241 |
+- return dummy->timer_ops->stop(substream); |
2242 |
++ return get_dummy_ops(substream)->stop(substream); |
2243 |
+ } |
2244 |
+ return -EINVAL; |
2245 |
+ } |
2246 |
+ |
2247 |
+ static int dummy_pcm_prepare(struct snd_pcm_substream *substream) |
2248 |
+ { |
2249 |
+- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
2250 |
+- |
2251 |
+- return dummy->timer_ops->prepare(substream); |
2252 |
++ return get_dummy_ops(substream)->prepare(substream); |
2253 |
+ } |
2254 |
+ |
2255 |
+ static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream) |
2256 |
+ { |
2257 |
+- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
2258 |
+- |
2259 |
+- return dummy->timer_ops->pointer(substream); |
2260 |
++ return get_dummy_ops(substream)->pointer(substream); |
2261 |
+ } |
2262 |
+ |
2263 |
+ static struct snd_pcm_hardware dummy_pcm_hardware = { |
2264 |
+@@ -564,17 +564,19 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) |
2265 |
+ struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
2266 |
+ struct dummy_model *model = dummy->model; |
2267 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2268 |
++ const struct dummy_timer_ops *ops; |
2269 |
+ int err; |
2270 |
+ |
2271 |
+- dummy->timer_ops = &dummy_systimer_ops; |
2272 |
++ ops = &dummy_systimer_ops; |
2273 |
+ #ifdef CONFIG_HIGH_RES_TIMERS |
2274 |
+ if (hrtimer) |
2275 |
+- dummy->timer_ops = &dummy_hrtimer_ops; |
2276 |
++ ops = &dummy_hrtimer_ops; |
2277 |
+ #endif |
2278 |
+ |
2279 |
+- err = dummy->timer_ops->create(substream); |
2280 |
++ err = ops->create(substream); |
2281 |
+ if (err < 0) |
2282 |
+ return err; |
2283 |
++ get_dummy_ops(substream) = ops; |
2284 |
+ |
2285 |
+ runtime->hw = dummy->pcm_hw; |
2286 |
+ if (substream->pcm->device & 1) { |
2287 |
+@@ -596,7 +598,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) |
2288 |
+ err = model->capture_constraints(substream->runtime); |
2289 |
+ } |
2290 |
+ if (err < 0) { |
2291 |
+- dummy->timer_ops->free(substream); |
2292 |
++ get_dummy_ops(substream)->free(substream); |
2293 |
+ return err; |
2294 |
+ } |
2295 |
+ return 0; |
2296 |
+@@ -604,8 +606,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) |
2297 |
+ |
2298 |
+ static int dummy_pcm_close(struct snd_pcm_substream *substream) |
2299 |
+ { |
2300 |
+- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
2301 |
+- dummy->timer_ops->free(substream); |
2302 |
++ get_dummy_ops(substream)->free(substream); |
2303 |
+ return 0; |
2304 |
+ } |
2305 |
+ |
2306 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2307 |
+index 69a2aafb0b0f..babbf238a648 100644 |
2308 |
+--- a/sound/pci/hda/patch_realtek.c |
2309 |
++++ b/sound/pci/hda/patch_realtek.c |
2310 |
+@@ -2188,6 +2188,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
2311 |
+ SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
2312 |
+ SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
2313 |
+ SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
2314 |
++ SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), |
2315 |
+ |
2316 |
+ /* All Apple entries are in codec SSIDs */ |
2317 |
+ SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
2318 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
2319 |
+index 02d26915b61d..c6d408c819b1 100644 |
2320 |
+--- a/sound/soc/soc-pcm.c |
2321 |
++++ b/sound/soc/soc-pcm.c |
2322 |
+@@ -1248,7 +1248,8 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) |
2323 |
+ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && |
2324 |
+ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && |
2325 |
+ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && |
2326 |
+- (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) |
2327 |
++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && |
2328 |
++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) |
2329 |
+ continue; |
2330 |
+ |
2331 |
+ dev_dbg(be->dev, "ASoC: hw_free BE %s\n", |
2332 |
+diff --git a/sound/usb/midi.c b/sound/usb/midi.c |
2333 |
+index dabbe05d17f5..37ecba340876 100644 |
2334 |
+--- a/sound/usb/midi.c |
2335 |
++++ b/sound/usb/midi.c |
2336 |
+@@ -2291,7 +2291,6 @@ int snd_usbmidi_create(struct snd_card *card, |
2337 |
+ else |
2338 |
+ err = snd_usbmidi_create_endpoints(umidi, endpoints); |
2339 |
+ if (err < 0) { |
2340 |
+- snd_usbmidi_free(umidi); |
2341 |
+ return err; |
2342 |
+ } |
2343 |
+ |
2344 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
2345 |
+index 94cd28c2bd8d..44550a4cf893 100644 |
2346 |
+--- a/sound/usb/quirks.c |
2347 |
++++ b/sound/usb/quirks.c |
2348 |
+@@ -900,8 +900,12 @@ void snd_usb_set_interface_quirk(struct usb_device *dev) |
2349 |
+ * "Playback Design" products need a 50ms delay after setting the |
2350 |
+ * USB interface. |
2351 |
+ */ |
2352 |
+- if (le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) |
2353 |
++ switch (le16_to_cpu(dev->descriptor.idVendor)) { |
2354 |
++ case 0x23ba: /* Playback Design */ |
2355 |
++ case 0x0644: /* TEAC Corp. */ |
2356 |
+ mdelay(50); |
2357 |
++ break; |
2358 |
++ } |
2359 |
+ } |
2360 |
+ |
2361 |
+ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, |
2362 |
+@@ -916,6 +920,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, |
2363 |
+ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
2364 |
+ mdelay(20); |
2365 |
+ |
2366 |
++ /* |
2367 |
++ * "TEAC Corp." products need a 20ms delay after each |
2368 |
++ * class compliant request |
2369 |
++ */ |
2370 |
++ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x0644) && |
2371 |
++ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
2372 |
++ mdelay(20); |
2373 |
++ |
2374 |
+ /* Marantz/Denon devices with USB DAC functionality need a delay |
2375 |
+ * after each class compliant request |
2376 |
+ */ |