diff options
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 68e510b88457..3cb7cda3d780 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -373,6 +373,8 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
373 | return -ENXIO; | 373 | return -ENXIO; |
374 | new = container_of(kobj, struct cdev, kobj); | 374 | new = container_of(kobj, struct cdev, kobj); |
375 | spin_lock(&cdev_lock); | 375 | spin_lock(&cdev_lock); |
376 | /* Check i_cdev again in case somebody beat us to it while | ||
377 | we dropped the lock. */ | ||
376 | p = inode->i_cdev; | 378 | p = inode->i_cdev; |
377 | if (!p) { | 379 | if (!p) { |
378 | inode->i_cdev = p = new; | 380 | inode->i_cdev = p = new; |
@@ -392,11 +394,8 @@ static int chrdev_open(struct inode *inode, struct file *filp) | |||
392 | cdev_put(p); | 394 | cdev_put(p); |
393 | return -ENXIO; | 395 | return -ENXIO; |
394 | } | 396 | } |
395 | if (filp->f_op->open) { | 397 | if (filp->f_op->open) |
396 | lock_kernel(); | ||
397 | ret = filp->f_op->open(inode,filp); | 398 | ret = filp->f_op->open(inode,filp); |
398 | unlock_kernel(); | ||
399 | } | ||
400 | if (ret) | 399 | if (ret) |
401 | cdev_put(p); | 400 | cdev_put(p); |
402 | return ret; | 401 | return ret; |