Deadlock Detection in Linear Recursive Programs