]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Mar 2018 14:17:46 +0000 (15:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Mar 2018 14:17:46 +0000 (15:17 +0100)
added patches:
ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch

queue-3.18/series
queue-3.18/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch [new file with mode: 0644]

index 48f35de729e79fc4df98ef97285292ea52479f5f..b4b0c8c477f27038c30c5d34a1423dae0c08aadd 100644 (file)
@@ -10,3 +10,4 @@ netfilter-idletimer-be-syzkaller-friendly.patch
 netfilter-ebtables-config_compat-don-t-trust-userland-offsets.patch
 netfilter-bridge-ebt_among-add-missing-match-size-checks.patch
 netfilter-ipv6-fix-use-after-free-write-in-nf_nat_ipv6_manip_pkt.patch
+ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch
diff --git a/queue-3.18/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch b/queue-3.18/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch
new file mode 100644 (file)
index 0000000..050e649
--- /dev/null
@@ -0,0 +1,60 @@
+From a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 Mon Sep 17 00:00:00 2001
+From: Clay McClure <clay@daemons.net>
+Date: Thu, 21 Sep 2017 19:01:34 -0700
+Subject: ubi: Fix race condition between ubi volume creation and udev
+
+From: Clay McClure <clay@daemons.net>
+
+commit a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 upstream.
+
+Similar to commit 714fb87e8bc0 ("ubi: Fix race condition between ubi
+device creation and udev"), we should make the volume active before
+registering it.
+
+Signed-off-by: Clay McClure <clay@daemons.net>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/vmt.c |   15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/mtd/ubi/vmt.c
++++ b/drivers/mtd/ubi/vmt.c
+@@ -308,6 +308,12 @@ int ubi_create_volume(struct ubi_device
+                       vol->last_eb_bytes = vol->usable_leb_size;
+       }
++      /* Make volume "available" before it becomes accessible via sysfs */
++      spin_lock(&ubi->volumes_lock);
++      ubi->volumes[vol_id] = vol;
++      ubi->vol_count += 1;
++      spin_unlock(&ubi->volumes_lock);
++
+       /* Register character device for the volume */
+       cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
+       vol->cdev.owner = THIS_MODULE;
+@@ -350,11 +356,6 @@ int ubi_create_volume(struct ubi_device
+       if (err)
+               goto out_sysfs;
+-      spin_lock(&ubi->volumes_lock);
+-      ubi->volumes[vol_id] = vol;
+-      ubi->vol_count += 1;
+-      spin_unlock(&ubi->volumes_lock);
+-
+       ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED);
+       self_check_volumes(ubi);
+       return err;
+@@ -374,6 +375,10 @@ out_sysfs:
+ out_cdev:
+       cdev_del(&vol->cdev);
+ out_mapping:
++      spin_lock(&ubi->volumes_lock);
++      ubi->volumes[vol_id] = NULL;
++      ubi->vol_count -= 1;
++      spin_unlock(&ubi->volumes_lock);
+       if (do_free)
+               kfree(vol->eba_tbl);
+ out_acc: