From 64973795a9f5436825db2b469e98b9aaa3479b3a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 17 Oct 2015 12:37:26 -0700 Subject: [PATCH] 3.14-stable patches added patches: dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch dm-raid-fix-round-up-of-default-region-size.patch staging-ion-fix-corruption-of-ion_import_dma_buf.patch usb-option-add-zte-pids.patch --- ...s-for-the-leaves-of-top-level-btrees.patch | 135 ++++++++++++++++++ ...-fix-round-up-of-default-region-size.patch | 39 +++++ queue-3.14/series | 4 + ...fix-corruption-of-ion_import_dma_buf.patch | 71 +++++++++ queue-3.14/usb-option-add-zte-pids.patch | 67 +++++++++ 5 files changed, 316 insertions(+) create mode 100644 queue-3.14/dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch create mode 100644 queue-3.14/dm-raid-fix-round-up-of-default-region-size.patch create mode 100644 queue-3.14/staging-ion-fix-corruption-of-ion_import_dma_buf.patch create mode 100644 queue-3.14/usb-option-add-zte-pids.patch diff --git a/queue-3.14/dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch b/queue-3.14/dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch new file mode 100644 index 00000000000..5bd41a36e13 --- /dev/null +++ b/queue-3.14/dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch @@ -0,0 +1,135 @@ +From b0dc3c8bc157c60b1d470163882be8c13e1950af Mon Sep 17 00:00:00 2001 +From: Joe Thornber +Date: Wed, 12 Aug 2015 15:12:09 +0100 +Subject: dm btree: add ref counting ops for the leaves of top level btrees + +From: Joe Thornber + +commit b0dc3c8bc157c60b1d470163882be8c13e1950af upstream. + +When using nested btrees, the top leaves of the top levels contain +block addresses for the root of the next tree down. If we shadow a +shared leaf node the leaf values (sub tree roots) should be incremented +accordingly. + +This is only an issue if there is metadata sharing in the top levels. +Which only occurs if metadata snapshots are being used (as is possible +with dm-thinp). And could result in a block from the thinp metadata +snap being reused early, thus corrupting the thinp metadata snap. + +Signed-off-by: Joe Thornber +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/persistent-data/dm-btree-internal.h | 6 ++++ + drivers/md/persistent-data/dm-btree-remove.c | 12 ++------ + drivers/md/persistent-data/dm-btree-spine.c | 37 +++++++++++++++++++++++++ + drivers/md/persistent-data/dm-btree.c | 7 ---- + 4 files changed, 47 insertions(+), 15 deletions(-) + +--- a/drivers/md/persistent-data/dm-btree-internal.h ++++ b/drivers/md/persistent-data/dm-btree-internal.h +@@ -138,4 +138,10 @@ int lower_bound(struct btree_node *n, ui + + extern struct dm_block_validator btree_node_validator; + ++/* ++ * Value type for upper levels of multi-level btrees. ++ */ ++extern void init_le64_type(struct dm_transaction_manager *tm, ++ struct dm_btree_value_type *vt); ++ + #endif /* DM_BTREE_INTERNAL_H */ +--- a/drivers/md/persistent-data/dm-btree-remove.c ++++ b/drivers/md/persistent-data/dm-btree-remove.c +@@ -544,14 +544,6 @@ static int remove_raw(struct shadow_spin + return r; + } + +-static struct dm_btree_value_type le64_type = { +- .context = NULL, +- .size = sizeof(__le64), +- .inc = NULL, +- .dec = NULL, +- .equal = NULL +-}; +- + int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, + uint64_t *keys, dm_block_t *new_root) + { +@@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_info + int index = 0, r = 0; + struct shadow_spine spine; + struct btree_node *n; ++ struct dm_btree_value_type le64_vt; + ++ init_le64_type(info->tm, &le64_vt); + init_shadow_spine(&spine, info); + for (level = 0; level < info->levels; level++) { + r = remove_raw(&spine, info, + (level == last_level ? +- &info->value_type : &le64_type), ++ &info->value_type : &le64_vt), + root, keys[level], (unsigned *)&index); + if (r < 0) + break; +--- a/drivers/md/persistent-data/dm-btree-spine.c ++++ b/drivers/md/persistent-data/dm-btree-spine.c +@@ -249,3 +249,40 @@ int shadow_root(struct shadow_spine *s) + { + return s->root; + } ++ ++static void le64_inc(void *context, const void *value_le) ++{ ++ struct dm_transaction_manager *tm = context; ++ __le64 v_le; ++ ++ memcpy(&v_le, value_le, sizeof(v_le)); ++ dm_tm_inc(tm, le64_to_cpu(v_le)); ++} ++ ++static void le64_dec(void *context, const void *value_le) ++{ ++ struct dm_transaction_manager *tm = context; ++ __le64 v_le; ++ ++ memcpy(&v_le, value_le, sizeof(v_le)); ++ dm_tm_dec(tm, le64_to_cpu(v_le)); ++} ++ ++static int le64_equal(void *context, const void *value1_le, const void *value2_le) ++{ ++ __le64 v1_le, v2_le; ++ ++ memcpy(&v1_le, value1_le, sizeof(v1_le)); ++ memcpy(&v2_le, value2_le, sizeof(v2_le)); ++ return v1_le == v2_le; ++} ++ ++void init_le64_type(struct dm_transaction_manager *tm, ++ struct dm_btree_value_type *vt) ++{ ++ vt->context = tm; ++ vt->size = sizeof(__le64); ++ vt->inc = le64_inc; ++ vt->dec = le64_dec; ++ vt->equal = le64_equal; ++} +--- a/drivers/md/persistent-data/dm-btree.c ++++ b/drivers/md/persistent-data/dm-btree.c +@@ -667,12 +667,7 @@ static int insert(struct dm_btree_info * + struct btree_node *n; + struct dm_btree_value_type le64_type; + +- le64_type.context = NULL; +- le64_type.size = sizeof(__le64); +- le64_type.inc = NULL; +- le64_type.dec = NULL; +- le64_type.equal = NULL; +- ++ init_le64_type(info->tm, &le64_type); + init_shadow_spine(&spine, info); + + for (level = 0; level < (info->levels - 1); level++) { diff --git a/queue-3.14/dm-raid-fix-round-up-of-default-region-size.patch b/queue-3.14/dm-raid-fix-round-up-of-default-region-size.patch new file mode 100644 index 00000000000..63000b7a20a --- /dev/null +++ b/queue-3.14/dm-raid-fix-round-up-of-default-region-size.patch @@ -0,0 +1,39 @@ +From 042745ee53a0a7c1f5aff191a4a24213c6dcfb52 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Fri, 2 Oct 2015 11:17:37 -0400 +Subject: dm raid: fix round up of default region size + +From: Mikulas Patocka + +commit 042745ee53a0a7c1f5aff191a4a24213c6dcfb52 upstream. + +Commit 3a0f9aaee028 ("dm raid: round region_size to power of two") +intended to make sure that the default region size is a power of two. +However, the logic in that commit is incorrect and sets the variable +region_size to 0 or 1, depending on whether min_region_size is a power +of two. + +Fix this logic, using roundup_pow_of_two(), so that region_size is +properly rounded up to the next power of two. + +Signed-off-by: Mikulas Patocka +Fixes: 3a0f9aaee028 ("dm raid: round region_size to power of two") +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-raid.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/md/dm-raid.c ++++ b/drivers/md/dm-raid.c +@@ -325,8 +325,7 @@ static int validate_region_size(struct r + */ + if (min_region_size > (1 << 13)) { + /* If not a power of 2, make it the next power of 2 */ +- if (min_region_size & (min_region_size - 1)) +- region_size = 1 << fls(region_size); ++ region_size = roundup_pow_of_two(min_region_size); + DMINFO("Choosing default region size of %lu sectors", + region_size); + } else { diff --git a/queue-3.14/series b/queue-3.14/series index 299c0a594ba..c2ec0dea527 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -31,3 +31,7 @@ asoc-dwc-correct-irq-clear-method.patch btrfs-skip-waiting-on-ordered-range-for-special-files.patch btrfs-fix-read-corruption-of-compressed-and-shared-extents.patch btrfs-update-fix-for-read-corruption-of-compressed-and-shared-extents.patch +dm-btree-add-ref-counting-ops-for-the-leaves-of-top-level-btrees.patch +staging-ion-fix-corruption-of-ion_import_dma_buf.patch +usb-option-add-zte-pids.patch +dm-raid-fix-round-up-of-default-region-size.patch diff --git a/queue-3.14/staging-ion-fix-corruption-of-ion_import_dma_buf.patch b/queue-3.14/staging-ion-fix-corruption-of-ion_import_dma_buf.patch new file mode 100644 index 00000000000..4e9617a4127 --- /dev/null +++ b/queue-3.14/staging-ion-fix-corruption-of-ion_import_dma_buf.patch @@ -0,0 +1,71 @@ +From 6fa92e2bcf6390e64895b12761e851c452d87bd8 Mon Sep 17 00:00:00 2001 +From: Shawn Lin +Date: Wed, 9 Sep 2015 15:41:52 +0800 +Subject: staging: ion: fix corruption of ion_import_dma_buf + +From: Shawn Lin + +commit 6fa92e2bcf6390e64895b12761e851c452d87bd8 upstream. + +we found this issue but still exit in lastest kernel. Simply +keep ion_handle_create under mutex_lock to avoid this race. + +WARNING: CPU: 2 PID: 2648 at drivers/staging/android/ion/ion.c:512 ion_handle_add+0xb4/0xc0() +ion_handle_add: buffer already found. +Modules linked in: iwlmvm iwlwifi mac80211 cfg80211 compat +CPU: 2 PID: 2648 Comm: TimedEventQueue Tainted: G W 3.14.0 #7 + 00000000 00000000 9a3efd2c 80faf273 9a3efd6c 9a3efd5c 80935dc9 811d7fd3 + 9a3efd88 00000a58 812208a0 00000200 80e128d4 80e128d4 8d4ae00c a8cd8600 + a8cd8094 9a3efd74 80935e0e 00000009 9a3efd6c 811d7fd3 9a3efd88 9a3efd9c +Call Trace: + [<80faf273>] dump_stack+0x48/0x69 + [<80935dc9>] warn_slowpath_common+0x79/0x90 + [<80e128d4>] ? ion_handle_add+0xb4/0xc0 + [<80e128d4>] ? ion_handle_add+0xb4/0xc0 + [<80935e0e>] warn_slowpath_fmt+0x2e/0x30 + [<80e128d4>] ion_handle_add+0xb4/0xc0 + [<80e144cc>] ion_import_dma_buf+0x8c/0x110 + [<80c517c4>] reg_init+0x364/0x7d0 + [<80993363>] ? futex_wait+0x123/0x210 + [<80992e0e>] ? get_futex_key+0x16e/0x1e0 + [<8099308f>] ? futex_wake+0x5f/0x120 + [<80c51e19>] vpu_service_ioctl+0x1e9/0x500 + [<80994aec>] ? do_futex+0xec/0x8e0 + [<80971080>] ? prepare_to_wait_event+0xc0/0xc0 + [<80c51c30>] ? reg_init+0x7d0/0x7d0 + [<80a22562>] do_vfs_ioctl+0x2d2/0x4c0 + [<80b198ad>] ? inode_has_perm.isra.41+0x2d/0x40 + [<80b199cf>] ? file_has_perm+0x7f/0x90 + [<80b1a5f7>] ? selinux_file_ioctl+0x47/0xf0 + [<80a227a8>] SyS_ioctl+0x58/0x80 + [<80fb45e8>] syscall_call+0x7/0x7 + [<80fb0000>] ? mmc_do_calc_max_discard+0xab/0xe4 + +Fixes: 83271f626 ("ion: hold reference to handle...") +Signed-off-by: Shawn Lin +Reviewed-by: Laura Abbott +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/android/ion/ion.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/staging/android/ion/ion.c ++++ b/drivers/staging/android/ion/ion.c +@@ -1119,13 +1119,13 @@ struct ion_handle *ion_import_dma_buf(st + mutex_unlock(&client->lock); + goto end; + } +- mutex_unlock(&client->lock); + + handle = ion_handle_create(client, buffer); +- if (IS_ERR(handle)) ++ if (IS_ERR(handle)) { ++ mutex_unlock(&client->lock); + goto end; ++ } + +- mutex_lock(&client->lock); + ret = ion_handle_add(client, handle); + mutex_unlock(&client->lock); + if (ret) { diff --git a/queue-3.14/usb-option-add-zte-pids.patch b/queue-3.14/usb-option-add-zte-pids.patch new file mode 100644 index 00000000000..52637856d05 --- /dev/null +++ b/queue-3.14/usb-option-add-zte-pids.patch @@ -0,0 +1,67 @@ +From 19ab6bc5674a30fdb6a2436b068d19a3c17dc73e Mon Sep 17 00:00:00 2001 +From: "Liu.Zhao" +Date: Mon, 24 Aug 2015 08:36:12 -0700 +Subject: USB: option: add ZTE PIDs + +From: "Liu.Zhao" + +commit 19ab6bc5674a30fdb6a2436b068d19a3c17dc73e upstream. + +This is intended to add ZTE device PIDs on kernel. + +Signed-off-by: Liu.Zhao +[johan: sort the new entries ] +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/option.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -276,6 +276,10 @@ static void option_instat_callback(struc + #define ZTE_PRODUCT_MF622 0x0001 + #define ZTE_PRODUCT_MF628 0x0015 + #define ZTE_PRODUCT_MF626 0x0031 ++#define ZTE_PRODUCT_ZM8620_X 0x0396 ++#define ZTE_PRODUCT_ME3620_MBIM 0x0426 ++#define ZTE_PRODUCT_ME3620_X 0x1432 ++#define ZTE_PRODUCT_ME3620_L 0x1433 + #define ZTE_PRODUCT_AC2726 0xfff1 + #define ZTE_PRODUCT_CDMA_TECH 0xfffe + #define ZTE_PRODUCT_AC8710T 0xffff +@@ -549,6 +553,18 @@ static const struct option_blacklist_inf + .sendsetup = BIT(1) | BIT(2) | BIT(3), + }; + ++static const struct option_blacklist_info zte_me3620_mbim_blacklist = { ++ .reserved = BIT(2) | BIT(3) | BIT(4), ++}; ++ ++static const struct option_blacklist_info zte_me3620_xl_blacklist = { ++ .reserved = BIT(3) | BIT(4) | BIT(5), ++}; ++ ++static const struct option_blacklist_info zte_zm8620_x_blacklist = { ++ .reserved = BIT(3) | BIT(4) | BIT(5), ++}; ++ + static const struct option_blacklist_info huawei_cdc12_blacklist = { + .reserved = BIT(1) | BIT(2), + }; +@@ -1579,6 +1595,14 @@ static const struct usb_device_id option + .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, ++ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_L), ++ .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, ++ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_MBIM), ++ .driver_info = (kernel_ulong_t)&zte_me3620_mbim_blacklist }, ++ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_X), ++ .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, ++ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ZM8620_X), ++ .driver_info = (kernel_ulong_t)&zte_zm8620_x_blacklist }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, -- 2.47.3