lkml.org 
[lkml]   [2016]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 127/346] ubi: Fix race condition between ubi device creation and udev
    3.16.39-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Iosif Harutyunov <iharutyunov@SonicWALL.com>

    commit 714fb87e8bc05ff78255afc0dca981e8c5242785 upstream.

    Install the UBI device object before we arm sysfs.
    Otherwise udev tries to read sysfs attributes before UBI is ready and
    udev rules will not match.

    Signed-off-by: Iosif Harutyunov <iharutyunov@sonicwall.com>
    [rw: massaged commit message]
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/mtd/ubi/build.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    --- a/drivers/mtd/ubi/build.c
    +++ b/drivers/mtd/ubi/build.c
    @@ -999,6 +999,9 @@ int ubi_attach_mtd_dev(struct mtd_info *
    goto out_detach;
    }

    + /* Make device "available" before it becomes accessible via sysfs */
    + ubi_devices[ubi_num] = ubi;
    +
    err = uif_init(ubi, &ref);
    if (err)
    goto out_detach;
    @@ -1043,7 +1046,6 @@ int ubi_attach_mtd_dev(struct mtd_info *
    wake_up_process(ubi->bgt_thread);
    spin_unlock(&ubi->wl_lock);

    - ubi_devices[ubi_num] = ubi;
    ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
    return ubi_num;

    @@ -1054,6 +1056,7 @@ out_uif:
    ubi_assert(ref);
    uif_close(ubi);
    out_detach:
    + ubi_devices[ubi_num] = NULL;
    ubi_wl_close(ubi);
    ubi_free_internal_volumes(ubi);
    vfree(ubi->vtbl);
    \
     
     \ /
      Last update: 2016-11-14 03:46    [W:4.631 / U:0.120 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site