Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2db61c95c03d08bb885c87a816540e75190c924a
Commit:     2db61c95c03d08bb885c87a816540e75190c924a
Parent:     d08c3b78b8c46a01b8fa59037a0d9fbb777fb465
Author:     Fernando Luis Vázquez Cao <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 17:11:45 2007 +0900
Committer:  Artem Bityutskiy <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 16:58:45 2007 +0300

    UBI: cleanup usage of try_module_get
    
    The use of try_module_get(THIS_MODULE) in ubi_get_device_info does not
    offer real protection against unexpected driver unloads, since we could
    be preempted before try_modules_get gets executed. It is the caller who
    should manipulate the refcounts. Besides, ubi_get_device_info is an
    exported symbol which guarantees protection when accessed through
    symbol_get.
    
    Signed-off-by: Fernando Luis Vazquez Cao <[EMAIL PROTECTED]>
    Signed-off-by: Artem Bityutskiy <[EMAIL PROTECTED]>
---
 drivers/mtd/ubi/kapi.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 14c66b4..78cae49 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -37,12 +37,8 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info 
*di)
 {
        const struct ubi_device *ubi;
 
-       if (!try_module_get(THIS_MODULE))
-               return -ENODEV;
-
        if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES ||
            !ubi_devices[ubi_num]) {
-               module_put(THIS_MODULE);
                return -ENODEV;
        }
 
@@ -52,7 +48,6 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info 
*di)
        di->min_io_size = ubi->min_io_size;
        di->ro_mode = ubi->ro_mode;
        di->cdev = MKDEV(ubi->major, 0);
-       module_put(THIS_MODULE);
        return 0;
 }
 EXPORT_SYMBOL_GPL(ubi_get_device_info);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to