Yes it was legal, johnson had Green wobbled on multiple occasions, Green knew he was done and he wanted to go out with a little controversy to try and save face. Green was getting KO'd one way or the other.
Yes, particularly the second punch that iced the cake, it was fine. If you don't want to get punched in questionable places, don't fold over in the middle of an exchange.