]> git.karo-electronics.de Git - karo-tx-linux.git/commit
xen-blkback: do not leak mode property
authorJan Beulich <JBeulich@suse.com>
Thu, 20 Dec 2012 10:31:11 +0000 (10:31 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2013 22:03:35 +0000 (06:03 +0800)
commit55782573e878c563a9a8e080be353e6e963327dc
tree97374e789a4fe946cb0e9a4c43f440218805d12b
parentc5799187ac9e45170a0ddfe1df074227b9a0b8f6
xen-blkback: do not leak mode property

commit 9d092603cc306ee6edfe917bf9ab8beb5f32d7bc upstream.

"be->mode" is obtained from xenbus_read(), which does a kmalloc() for
the message body. The short string is never released, so do it along
with freeing "be" itself, and make sure the string isn't kept when
backend_changed() doesn't complete successfully (which made it
desirable to slightly re-structure that function, so that the error
cleanup can be done in one place).

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/xen-blkback/xenbus.c