Shepard Fairey got in trouble for his Obama “Hope” painting based on a copyrighted photo.
The courts have sometimes found in favor of artists, sometimes not in cases about art based on photographs or modified images.
Deviant Art, et al, are full of art that violates copyright, but no one is policing it. It is easy to file a takedown notice, but the rights owner has to A) see the work in question, and B) care enough to file the notice.
Safest course is not to post painting from photographs that you do not have permission from the photographer to use. I have had great luck asking photographers if I can use their photos as painting references, most say “Yes, no problem”. There are also many sources of copyright free, public domain or otherwise freely usable photos.
"Let the paint be paint" --John Marin