]> git.baikalelectronics.ru Git - kernel.git/commit
xen/gntalloc: safely delete grefs in add_grefs() undo path
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 2 Sep 2014 14:21:30 +0000 (15:21 +0100)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 4 Sep 2014 12:14:05 +0000 (13:14 +0100)
commit63f336eb41c89cf0e7022b290c1ddde5d2dc1a2c
treef9e12fe0547957d77ca1c803da954999741794ae
parent4063a56a972270a4a2a5560669840cf8083cba3f
xen/gntalloc: safely delete grefs in add_grefs() undo path

If a gref could not be added (perhaps because the limit has been
reached or there are no more grant references available), the undo
path may crash because __del_gref() frees the gref while it is being
used for a list iteration.

A comment suggests that using list_for_each_entry() is safe since the
gref isn't removed from the list being iterated over, but it is freed
and thus list_for_each_entry_safe() must be used.

Also, explicitly delete the gref from the local per-file list, even
though this is not strictly necessary.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/gntalloc.c