Two DM target error path cleanup fixes (one for stable in DM thinp and

one for a v4.3-rc5 thinko in DM snapshot).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWIVMAAAoJEMUj8QotnQNaUmQH/3/zAJbGRL7WBdPRMdG1Fq5G
 nM4I3wUcorLWaZZZ6jpN3A4zX+UIOscH/Si6/33pV7+wG3JuvIcOgZQ7CBLW6Ipl
 D8JqpIjG5yfO71CPFIzhM/aHlJCjAj79Ejyj0W9ci2xntbglIxYcipSd55P4LgzU
 7Yu1mA32gHHIN0sghvZEVIpavwYV6RRxhTEwxYP0GeTc3PRpUbSyuYJijlWVPH8T
 orTg5SeqRLDymYLMRrGs8lHlOBhbKipXsZwfLwUq8zXIBYFseKdQpuac1u/HMJlS
 ssnLUooQdOnSxxf8Vn/ozhD8BxKkO0jtVZ8OAb3PKXD4QDQgMXLXwNjxDyOU2DY=
 =VCRB
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2015-10-16 13:03:05 -07:00
commit 045ce74349
2 changed files with 13 additions and 4 deletions

View file

@ -847,6 +847,7 @@ static void persistent_drop_snapshot(struct dm_exception_store *store)
static int persistent_ctr(struct dm_exception_store *store, char *options)
{
struct pstore *ps;
int r;
/* allocate the pstore */
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
@ -868,9 +869,9 @@ static int persistent_ctr(struct dm_exception_store *store, char *options)
ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0);
if (!ps->metadata_wq) {
kfree(ps);
DMERR("couldn't start header metadata update thread");
return -ENOMEM;
r = -ENOMEM;
goto err_workqueue;
}
if (options) {
@ -879,13 +880,21 @@ static int persistent_ctr(struct dm_exception_store *store, char *options)
store->userspace_supports_overflow = true;
else {
DMERR("Unsupported persistent store option: %s", options);
return -EINVAL;
r = -EINVAL;
goto err_options;
}
}
store->context = ps;
return 0;
err_options:
destroy_workqueue(ps->metadata_wq);
err_workqueue:
kfree(ps);
return r;
}
static unsigned persistent_status(struct dm_exception_store *store,

View file

@ -3201,7 +3201,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
metadata_low_callback,
pool);
if (r)
goto out_free_pt;
goto out_flags_changed;
pt->callbacks.congested_fn = pool_is_congested;
dm_table_add_target_callbacks(ti->table, &pt->callbacks);