Commit 78a3c3d7c6b89085610edfe86f7790144afc737e
1 parent
fc7f687a68
Exists in
master
and in
4 other branches
sound: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Showing 2 changed files with 19 additions and 1 deletions Side-by-side Diff
sound/core/sound.c
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | |
22 | 22 | #include <linux/init.h> |
23 | 23 | #include <linux/slab.h> |
24 | +#include <linux/smp_lock.h> | |
24 | 25 | #include <linux/time.h> |
25 | 26 | #include <linux/device.h> |
26 | 27 | #include <linux/moduleparam.h> |
... | ... | @@ -121,7 +122,7 @@ |
121 | 122 | |
122 | 123 | EXPORT_SYMBOL(snd_lookup_minor_data); |
123 | 124 | |
124 | -static int snd_open(struct inode *inode, struct file *file) | |
125 | +static int __snd_open(struct inode *inode, struct file *file) | |
125 | 126 | { |
126 | 127 | unsigned int minor = iminor(inode); |
127 | 128 | struct snd_minor *mptr = NULL; |
... | ... | @@ -161,6 +162,18 @@ |
161 | 162 | } |
162 | 163 | fops_put(old_fops); |
163 | 164 | return err; |
165 | +} | |
166 | + | |
167 | + | |
168 | +/* BKL pushdown: nasty #ifdef avoidance wrapper */ | |
169 | +static int snd_open(struct inode *inode, struct file *file) | |
170 | +{ | |
171 | + int ret; | |
172 | + | |
173 | + lock_kernel(); | |
174 | + ret = __snd_open(inode, file); | |
175 | + unlock_kernel(); | |
176 | + return ret; | |
164 | 177 | } |
165 | 178 | |
166 | 179 | static const struct file_operations snd_fops = |
sound/sound_core.c
... | ... | @@ -37,6 +37,7 @@ |
37 | 37 | #include <linux/module.h> |
38 | 38 | #include <linux/init.h> |
39 | 39 | #include <linux/slab.h> |
40 | +#include <linux/smp_lock.h> | |
40 | 41 | #include <linux/types.h> |
41 | 42 | #include <linux/kernel.h> |
42 | 43 | #include <linux/fs.h> |
... | ... | @@ -464,6 +465,8 @@ |
464 | 465 | struct sound_unit *s; |
465 | 466 | const struct file_operations *new_fops = NULL; |
466 | 467 | |
468 | + lock_kernel (); | |
469 | + | |
467 | 470 | chain=unit&0x0F; |
468 | 471 | if(chain==4 || chain==5) /* dsp/audio/dsp16 */ |
469 | 472 | { |
470 | 473 | |
... | ... | @@ -511,9 +514,11 @@ |
511 | 514 | file->f_op = fops_get(old_fops); |
512 | 515 | } |
513 | 516 | fops_put(old_fops); |
517 | + unlock_kernel(); | |
514 | 518 | return err; |
515 | 519 | } |
516 | 520 | spin_unlock(&sound_loader_lock); |
521 | + unlock_kernel(); | |
517 | 522 | return -ENODEV; |
518 | 523 | } |
519 | 524 |