Police are investigating a knife attack in which the suspected attacker injured two men before turning the knife on himself and dying by suicide.