]> git.proxmox.com Git - qemu.git/commit
qed: fix use-after-free during l2 cache commit
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fri, 30 Sep 2011 10:39:11 +0000 (11:39 +0100)
committerJustin M. Forbes <jforbes@redhat.com>
Wed, 5 Oct 2011 16:33:31 +0000 (11:33 -0500)
commit4a81ab81e4d947a3a0c8408c743ad94e7c1b8a30
tree1ebb1bf863631bd49832d5460adc02f8aab998ab
parent68e3508eafd111c050e0a6f4dc8588dbe75d0e1c
qed: fix use-after-free during l2 cache commit

QED's metadata caching strategy allows two parallel requests to race for
metadata lookup.  The first one to complete will populate the metadata
cache and the second one will drop the data it just read in favor of the
cached data.

There is a use-after-free in qed_read_l2_table_cb() and
qed_commit_l2_update() where l2_table->offset was used after the
l2_table may have been freed due to a metadata lookup race.  Fix this by
keeping the l2_offset in a local variable and not reaching into the
possibly freed l2_table.

Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/qed-table.c
block/qed.c