]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
xen/grants: fix deadlocks in the free callbacks
authorroyger <royger@FreeBSD.org>
Mon, 30 Jul 2018 11:41:51 +0000 (11:41 +0000)
committerroyger <royger@FreeBSD.org>
Mon, 30 Jul 2018 11:41:51 +0000 (11:41 +0000)
commit1925815039ea7019b79b9f38484115b31e1abab7
treea8f47ac7bdc65ef44ab5a61fcc2bb66acb5b9399
parent13fa38d951463f48d8ef4e89790f8ccd0481a81a
xen/grants: fix deadlocks in the free callbacks

This fixes the panic caused by deadlocking when grant-table free
callbacks are used.

The cause of the recursion is: check_free_callbacks() is always called
with the lock gnttab_list_lock held. In turn the callback function is
also called with the lock held. Then when the client uses any of the grant
reference methods which also attempt the lock the gnttab_list_lock
mutex from within the free callback a deadlock happens.

Fix this by making the gnttab_list_lock recursive.

Submitted by: Pratyush Yadav <pratyush@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D16505
sys/dev/xen/grant_table/grant_table.c