Skip to content

Commit f137711

Browse files
committed
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing: uml: Pushdown the bkl from harddog_kern ioctl sunrpc: Pushdown the bkl from sunrpc cache ioctl sunrpc: Pushdown the bkl from ioctl autofs4: Pushdown the bkl from ioctl uml: Convert to unlocked_ioctls to remove implicit BKL ncpfs: BKL ioctl pushdown coda: Clean-up whitespace problems in pioctl.c coda: BKL ioctl pushdown drivers: Push down BKL into various drivers isdn: Push down BKL into ioctl functions scsi: Push down BKL into ioctl functions dvb: Push down BKL into ioctl functions smbfs: Push down BKL into ioctl function coda/psdev: Remove BKL from ioctl function um/mmapper: Remove BKL usage sn_hwperf: Kill BKL usage hfsplus: Push down BKL into ioctl function
2 parents 1595365 + 9f37af6 commit f137711

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+669
-312
lines changed

arch/ia64/sn/kernel/sn2/sn_hwperf.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <linux/miscdevice.h>
3131
#include <linux/utsname.h>
3232
#include <linux/cpumask.h>
33-
#include <linux/smp_lock.h>
3433
#include <linux/nodemask.h>
3534
#include <linux/smp.h>
3635
#include <linux/mutex.h>
@@ -682,8 +681,7 @@ static int sn_hwperf_map_err(int hwperf_err)
682681
/*
683682
* ioctl for "sn_hwperf" misc device
684683
*/
685-
static int
686-
sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
684+
static long sn_hwperf_ioctl(struct file *fp, u32 op, unsigned long arg)
687685
{
688686
struct sn_hwperf_ioctl_args a;
689687
struct cpuinfo_ia64 *cdata;
@@ -699,8 +697,6 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
699697
int i;
700698
int j;
701699

702-
unlock_kernel();
703-
704700
/* only user requests are allowed here */
705701
if ((op & SN_HWPERF_OP_MASK) < 10) {
706702
r = -EINVAL;
@@ -859,12 +855,11 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
859855
error:
860856
vfree(p);
861857

862-
lock_kernel();
863858
return r;
864859
}
865860

866861
static const struct file_operations sn_hwperf_fops = {
867-
.ioctl = sn_hwperf_ioctl,
862+
.unlocked_ioctl = sn_hwperf_ioctl,
868863
};
869864

870865
static struct miscdevice sn_hwperf_dev = {

arch/um/drivers/harddog_kern.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ static ssize_t harddog_write(struct file *file, const char __user *data, size_t
124124
return 0;
125125
}
126126

127-
static int harddog_ioctl(struct inode *inode, struct file *file,
128-
unsigned int cmd, unsigned long arg)
127+
static int harddog_ioctl_unlocked(struct file *file,
128+
unsigned int cmd, unsigned long arg)
129129
{
130130
void __user *argp= (void __user *)arg;
131131
static struct watchdog_info ident = {
@@ -148,10 +148,22 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
148148
}
149149
}
150150

151+
static long harddog_ioctl(struct file *file,
152+
unsigned int cmd, unsigned long arg)
153+
{
154+
long ret;
155+
156+
lock_kernel();
157+
ret = harddog_ioctl_unlocked(file, cmd, arg);
158+
unlock_kernel();
159+
160+
return ret;
161+
}
162+
151163
static const struct file_operations harddog_fops = {
152164
.owner = THIS_MODULE,
153165
.write = harddog_write,
154-
.ioctl = harddog_ioctl,
166+
.unlocked_ioctl = harddog_ioctl,
155167
.open = harddog_open,
156168
.release = harddog_release,
157169
};

arch/um/drivers/hostaudio_kern.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static unsigned int hostaudio_poll(struct file *file,
136136
return mask;
137137
}
138138

139-
static int hostaudio_ioctl(struct inode *inode, struct file *file,
139+
static long hostaudio_ioctl(struct file *file,
140140
unsigned int cmd, unsigned long arg)
141141
{
142142
struct hostaudio_state *state = file->private_data;
@@ -223,7 +223,7 @@ static int hostaudio_release(struct inode *inode, struct file *file)
223223

224224
/* /dev/mixer file operations */
225225

226-
static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file,
226+
static long hostmixer_ioctl_mixdev(struct file *file,
227227
unsigned int cmd, unsigned long arg)
228228
{
229229
struct hostmixer_state *state = file->private_data;
@@ -289,7 +289,7 @@ static const struct file_operations hostaudio_fops = {
289289
.read = hostaudio_read,
290290
.write = hostaudio_write,
291291
.poll = hostaudio_poll,
292-
.ioctl = hostaudio_ioctl,
292+
.unlocked_ioctl = hostaudio_ioctl,
293293
.mmap = NULL,
294294
.open = hostaudio_open,
295295
.release = hostaudio_release,
@@ -298,7 +298,7 @@ static const struct file_operations hostaudio_fops = {
298298
static const struct file_operations hostmixer_fops = {
299299
.owner = THIS_MODULE,
300300
.llseek = no_llseek,
301-
.ioctl = hostmixer_ioctl_mixdev,
301+
.unlocked_ioctl = hostmixer_ioctl_mixdev,
302302
.open = hostmixer_open_mixdev,
303303
.release = hostmixer_release,
304304
};

arch/um/drivers/mmapper_kern.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,
4646
return count;
4747
}
4848

49-
static int mmapper_ioctl(struct inode *inode, struct file *file,
50-
unsigned int cmd, unsigned long arg)
49+
static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
5150
{
5251
return -ENOIOCTLCMD;
5352
}
@@ -90,7 +89,7 @@ static const struct file_operations mmapper_fops = {
9089
.owner = THIS_MODULE,
9190
.read = mmapper_read,
9291
.write = mmapper_write,
93-
.ioctl = mmapper_ioctl,
92+
.unlocked_ioctl = mmapper_ioctl,
9493
.mmap = mmapper_mmap,
9594
.open = mmapper_open,
9695
.release = mmapper_release,

drivers/char/apm-emulation.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,16 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)
265265
* Only when everyone who has opened /dev/apm_bios with write permission
266266
* has acknowledge does the actual suspend happen.
267267
*/
268-
static int
269-
apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
268+
static long
269+
apm_ioctl(struct file *filp, u_int cmd, u_long arg)
270270
{
271271
struct apm_user *as = filp->private_data;
272272
int err = -EINVAL;
273273

274274
if (!as->suser || !as->writer)
275275
return -EPERM;
276276

277+
lock_kernel();
277278
switch (cmd) {
278279
case APM_IOC_SUSPEND:
279280
mutex_lock(&state_lock);
@@ -334,6 +335,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
334335
mutex_unlock(&state_lock);
335336
break;
336337
}
338+
unlock_kernel();
337339

338340
return err;
339341
}
@@ -397,7 +399,7 @@ static const struct file_operations apm_bios_fops = {
397399
.owner = THIS_MODULE,
398400
.read = apm_read,
399401
.poll = apm_poll,
400-
.ioctl = apm_ioctl,
402+
.unlocked_ioctl = apm_ioctl,
401403
.open = apm_open,
402404
.release = apm_release,
403405
};

drivers/char/applicom.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/sched.h>
2727
#include <linux/slab.h>
2828
#include <linux/errno.h>
29+
#include <linux/smp_lock.h>
2930
#include <linux/miscdevice.h>
3031
#include <linux/pci.h>
3132
#include <linux/wait.h>
@@ -106,16 +107,15 @@ static unsigned int DeviceErrorCount; /* number of device error */
106107

107108
static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *);
108109
static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);
109-
static int ac_ioctl(struct inode *, struct file *, unsigned int,
110-
unsigned long);
110+
static long ac_ioctl(struct file *, unsigned int, unsigned long);
111111
static irqreturn_t ac_interrupt(int, void *);
112112

113113
static const struct file_operations ac_fops = {
114114
.owner = THIS_MODULE,
115115
.llseek = no_llseek,
116116
.read = ac_read,
117117
.write = ac_write,
118-
.ioctl = ac_ioctl,
118+
.unlocked_ioctl = ac_ioctl,
119119
};
120120

121121
static struct miscdevice ac_miscdev = {
@@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance)
689689

690690

691691

692-
static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
692+
static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
693693

694694
{ /* @ ADG ou ATO selon le cas */
695695
int i;
@@ -711,7 +711,8 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
711711
kfree(adgl);
712712
return -EFAULT;
713713
}
714-
714+
715+
lock_kernel();
715716
IndexCard = adgl->num_card-1;
716717

717718
if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
@@ -721,6 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
721722
warncount--;
722723
}
723724
kfree(adgl);
725+
unlock_kernel();
724726
return -EINVAL;
725727
}
726728

@@ -838,6 +840,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
838840
}
839841
Dummy = readb(apbs[IndexCard].RamIO + VERS);
840842
kfree(adgl);
843+
unlock_kernel();
841844
return 0;
842845
}
843846

drivers/char/ds1620.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
232232
}
233233

234234
static int
235-
ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
235+
ds1620_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
236236
{
237237
struct therm therm;
238238
union {
@@ -316,6 +316,18 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
316316
return 0;
317317
}
318318

319+
static long
320+
ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
321+
{
322+
int ret;
323+
324+
lock_kernel();
325+
ret = ds1620_ioctl(file, cmd, arg);
326+
unlock_kernel();
327+
328+
return ret;
329+
}
330+
319331
#ifdef THERM_USE_PROC
320332
static int
321333
proc_therm_ds1620_read(char *buf, char **start, off_t offset,
@@ -344,7 +356,7 @@ static const struct file_operations ds1620_fops = {
344356
.owner = THIS_MODULE,
345357
.open = ds1620_open,
346358
.read = ds1620_read,
347-
.ioctl = ds1620_ioctl,
359+
.unlocked_ioctl = ds1620_unlocked_ioctl,
348360
};
349361

350362
static struct miscdevice ds1620_miscdev = {

drivers/char/dtlk.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ static ssize_t dtlk_write(struct file *, const char __user *,
9393
static unsigned int dtlk_poll(struct file *, poll_table *);
9494
static int dtlk_open(struct inode *, struct file *);
9595
static int dtlk_release(struct inode *, struct file *);
96-
static int dtlk_ioctl(struct inode *inode, struct file *file,
97-
unsigned int cmd, unsigned long arg);
96+
static long dtlk_ioctl(struct file *file,
97+
unsigned int cmd, unsigned long arg);
9898

9999
static const struct file_operations dtlk_fops =
100100
{
101101
.owner = THIS_MODULE,
102102
.read = dtlk_read,
103103
.write = dtlk_write,
104104
.poll = dtlk_poll,
105-
.ioctl = dtlk_ioctl,
105+
.unlocked_ioctl = dtlk_ioctl,
106106
.open = dtlk_open,
107107
.release = dtlk_release,
108108
};
@@ -263,10 +263,9 @@ static void dtlk_timer_tick(unsigned long data)
263263
wake_up_interruptible(&dtlk_process_list);
264264
}
265265

266-
static int dtlk_ioctl(struct inode *inode,
267-
struct file *file,
268-
unsigned int cmd,
269-
unsigned long arg)
266+
static long dtlk_ioctl(struct file *file,
267+
unsigned int cmd,
268+
unsigned long arg)
270269
{
271270
char __user *argp = (char __user *)arg;
272271
struct dtlk_settings *sp;
@@ -276,7 +275,9 @@ static int dtlk_ioctl(struct inode *inode,
276275
switch (cmd) {
277276

278277
case DTLK_INTERROGATE:
278+
lock_kernel();
279279
sp = dtlk_interrogate();
280+
unlock_kernel();
280281
if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
281282
return -EINVAL;
282283
return 0;

drivers/char/generic_nvram.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/miscdevice.h>
2020
#include <linux/fcntl.h>
2121
#include <linux/init.h>
22+
#include <linux/smp_lock.h>
2223
#include <asm/uaccess.h>
2324
#include <asm/nvram.h>
2425
#ifdef CONFIG_PPC_PMAC
@@ -84,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
8485
return p - buf;
8586
}
8687

87-
static int nvram_ioctl(struct inode *inode, struct file *file,
88-
unsigned int cmd, unsigned long arg)
88+
static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
8989
{
9090
switch(cmd) {
9191
#ifdef CONFIG_PPC_PMAC
@@ -116,12 +116,23 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
116116
return 0;
117117
}
118118

119+
static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
120+
{
121+
int ret;
122+
123+
lock_kernel();
124+
ret = nvram_ioctl(file, cmd, arg);
125+
unlock_kernel();
126+
127+
return ret;
128+
}
129+
119130
const struct file_operations nvram_fops = {
120131
.owner = THIS_MODULE,
121132
.llseek = nvram_llseek,
122133
.read = read_nvram,
123134
.write = write_nvram,
124-
.ioctl = nvram_ioctl,
135+
.unlocked_ioctl = nvram_unlocked_ioctl,
125136
};
126137

127138
static struct miscdevice nvram_dev = {

drivers/char/genrtc.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static inline int gen_set_rtc_irq_bit(unsigned char bit)
262262
#endif
263263
}
264264

265-
static int gen_rtc_ioctl(struct inode *inode, struct file *file,
265+
static int gen_rtc_ioctl(struct file *file,
266266
unsigned int cmd, unsigned long arg)
267267
{
268268
struct rtc_time wtime;
@@ -332,6 +332,18 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
332332
return -EINVAL;
333333
}
334334

335+
static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd,
336+
unsigned long arg)
337+
{
338+
int ret;
339+
340+
lock_kernel();
341+
ret = gen_rtc_ioctl(file, cmd, arg);
342+
unlock_kernel();
343+
344+
return ret;
345+
}
346+
335347
/*
336348
* We enforce only one user at a time here with the open/close.
337349
* Also clear the previous interrupt data on an open, and clean
@@ -482,7 +494,7 @@ static const struct file_operations gen_rtc_fops = {
482494
.read = gen_rtc_read,
483495
.poll = gen_rtc_poll,
484496
#endif
485-
.ioctl = gen_rtc_ioctl,
497+
.unlocked_ioctl = gen_rtc_unlocked_ioctl,
486498
.open = gen_rtc_open,
487499
.release = gen_rtc_release,
488500
};

0 commit comments

Comments
 (0)