Re: [PATCH] memcg: fix mutex not unlocked on memcg_create_kmem_cachefail path

From: David Rientjes
Date: Thu Jan 30 2014 - 16:10:05 EST


On Thu, 30 Jan 2014, Vladimir Davydov wrote:

> Signed-off-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>

Some changelog would be helpful since this fixes an issue already in
Linus's tree.

Commit 842e2873697e ("memcg: get rid of kmem_cache_dup()") introduced a
mutex for memcg_create_kmem_cache() to protect the tmp_name buffer that
holds the memcg name. It failed to unlock the mutex if this buffer could
not be allocated.

This patch fixes the issue by appropriately unlocking the mutex if the
allocation fails.

Acked-by: David Rientjes <rientjes@xxxxxxxxxx>


That said, this tmp_name stuff seems totally unnecessary.
kmem_cache_create_memcg() already does the kstrdup() so why not just pass
in a pointer to already allocated memory for s->name rather than having
this mutex or global buffer at all?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/