lkml.org 
[lkml]   [2008]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: BKL still required for what functions?
Date

On Oct 7, 2008, at 10:35 AM, Alan Cox wrote:
>
> Its never so simple - a lot of the functions it depends what data
> you are
> using or passing to them whether they are BKL safe.
>
> Which bits use the BKL and what do you need to know is safe ?

Actually, it looks like I was looking at 2 different places, the
simple removal is in phonedev.c that you authored, as far as I can
tell the only thing the BKL is protecting is a call to request_module,
it may be some nesting rules that I don't understand but I think if it
is still needed there we could push the lock_kernel call down to the
site of the request_module call. See patch below.

Thanks,
Richard Holden

Signed-off-by: Richard Holden <aciddeath@gmail.com>

diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 4d74ba3..fd1424c 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -54,14 +54,16 @@ static int phone_open(struct inode *inode, struct
file *file)
if (minor >= PHONE_NUM_DEVICES)
return -ENODEV;

- lock_kernel();
+
mutex_lock(&phone_lock);
p = phone_device[minor];
if (p)
new_fops = fops_get(p->f_op);
if (!new_fops) {
mutex_unlock(&phone_lock);
+ lock_kernel();
request_module("char-major-%d-%d", PHONE_MAJOR, minor);
+ unlock_kernel();
mutex_lock(&phone_lock);
p = phone_device[minor];
if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
@@ -81,7 +83,6 @@ static int phone_open(struct inode *inode, struct
file *file)
fops_put(old_fops);
end:
mutex_unlock(&phone_lock);
- unlock_kernel();
return err;
}



\
 
 \ /
  Last update: 2008-10-07 19:57    [W:2.079 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site