Merge tag 'dm-4.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer:
"Two DM target error path cleanup fixes (one for stable in DM thinp and
one for a v4.3-rc5 thinko in DM snapshot)"

* tag 'dm-4.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm thin: fix missing pool reference count decrement in pool_ctr error path
dm snapshot persistent: fix missing cleanup in persistent_ctr error path

Changed files
+13 -4
drivers
+12 -3
drivers/md/dm-snap-persistent.c
··· 847 847 static int persistent_ctr(struct dm_exception_store *store, char *options) 848 848 { 849 849 struct pstore *ps; 850 + int r; 850 851 851 852 /* allocate the pstore */ 852 853 ps = kzalloc(sizeof(*ps), GFP_KERNEL); ··· 869 868 870 869 ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0); 871 870 if (!ps->metadata_wq) { 872 - kfree(ps); 873 871 DMERR("couldn't start header metadata update thread"); 874 - return -ENOMEM; 872 + r = -ENOMEM; 873 + goto err_workqueue; 875 874 } 876 875 877 876 if (options) { ··· 880 879 store->userspace_supports_overflow = true; 881 880 else { 882 881 DMERR("Unsupported persistent store option: %s", options); 883 - return -EINVAL; 882 + r = -EINVAL; 883 + goto err_options; 884 884 } 885 885 } 886 886 887 887 store->context = ps; 888 888 889 889 return 0; 890 + 891 + err_options: 892 + destroy_workqueue(ps->metadata_wq); 893 + err_workqueue: 894 + kfree(ps); 895 + 896 + return r; 890 897 } 891 898 892 899 static unsigned persistent_status(struct dm_exception_store *store,
+1 -1
drivers/md/dm-thin.c
··· 3201 3201 metadata_low_callback, 3202 3202 pool); 3203 3203 if (r) 3204 - goto out_free_pt; 3204 + goto out_flags_changed; 3205 3205 3206 3206 pt->callbacks.congested_fn = pool_is_congested; 3207 3207 dm_table_add_target_callbacks(ti->table, &pt->callbacks);