Dogs, with ears like a Lab's, are succesptible to such infections. I am not a vet and I don't know this for certain but I think it has to do with the internal construction of their "flappy" ears (another unintended consequence of imposed breeding).
Note canine ancestors like the wolf and fox have ears that stand up straight from their heads.
There is an ointment you can get from your Vet (Otiox I think its called) that will clear the infection up if you stick to the regimen long enough.
You can help prevent future infections by regularly clearning your dog's ears with q-tips dipped in warm salt water or vinegar. Obviously be gentle and don't stick the q-tip all the way up the canal.