Counterparty risk: a credit contagion model for a bank loan portfolio