For years now, prominent Canadian financial pundits have been warning people about the massive bubble forming in the housing market, especially in Toronto and Vancouver.

And for the most part, these people have been colossally wrong. Home values in both Toronto and Vancouver continue to keep chugging steadily higher, seemingly defying all odds. All sorts of things are working in real estate’s favour, including low interest rates, lacklustre results from the stock market, and demand from foreign investors.

Real estate has been on a bull run lasting more than 20 years–at least in Toronto and Vancouver. Other markets are beginning to show some weakness. Both Calgary and Edmonton have been affected by oil’s decline. Montreal’s real estate market is creeping higher, but that’s after some weakness in prior years. Other markets are actually showing year-over-year declines.

It’s only a matter of time until Toronto and Vancouver start getting a little weaker. After all, bull markets can’t continue forever, especially at current price-to-rent and price-to-income ratios. And interest rates can’t get much lower either.

Many investors might be thinking that Canada’s real estate bubble is an interesting sideshow, but it won’t be something that will affect their portfolios. They’re wrong. Here’s why every investor needs to be paying attention to our housing market.

The effect on the overall economy

A tremendous amount of money has been invested in real estate by investors buying physical property and by other investors financing those homeowners that banks won’t touch. Most mortgage brokers have several investors they can tap when a traditional lender says no.

It’s easy to see how this can turn out badly when the value of the underlying real estate starts to decline. Sure, the majority of homeowners are making wise financial decisions. But all it takes is a small minority taking on too much debt to turn a housing correction into a major event. The homeowners who have to get out at any cost are the ones that really bring prices down.

On the other hand, there’s actually the argument to be made that a real estate correction might be good for the stock market. Capital that was going to real estate can be redirected towards stocks, which could help push the overall market higher.

Effect on banks

There isn’t a Canadian bank without significant exposure to the housing markets in Toronto and Vancouver. A big decline in those markets will hurt every lender in the country.

The good news is the banks have unloaded much of the risk to mortgage insurers like CMHC and Genworth MI Canada Inc. (TSX:MIC). Since every loan with less than 20% down requires mortgage default insurance, the banks aren’t in bad shape overall.

And remember, most of our banks now have significant international exposure, with the exception of Canadian Imperial Bank of Commerce (TSX:CM)(NYSE:CM), that is. I believe that CIBC’s almost singular focus on Canada is the main reason why its shares trade hands at just over 11 times earnings, a discount of between 10% and 20% compared with its rivals.

If Canada’s housing market falls, investors will assume CIBC is more exposed to the potential damage than its rivals. Thus, investors will likely be better protected if they choose another bank–or avoid the sector completely.

Effect on mortgage insurers

Genworth Canada is prepared for a housing meltdown–at least according to its management team.

Remember, Genworth has been operating in Canada for more than a decade. Many of the mortgages it guaranteed have been paid down pretty aggressively since they were first insured. It’s just the last few years’ worth of loans that could be in jeopardy.

Genworth has some other things going for it as well. Shares pay a dividend of more than 5% annually. The company trades at less than eight times trailing earnings. And shares trade under book value, which is unusual for any insurer.

The bottom line? Nobody really knows how this massive real estate bubble will end. We might get a soft landing or a devastating crash. Whatever happens, I know I don’t want to put my money into a company that could potentially be damaged severely by the fallout.

Motley Fool issues rare "double down" stock alert

Not to alarm you but you recently missed an important and rare event. Stock Advisor Canada issued a "double down"... and history suggests it pays to listen. Because 10 of the most lucrative "double downs" in one of the Motley Fool's premier services skyrocketed an average of 434%! So, simply click here to discover why Motley Fool "double downs" have some investors rocking with excitement. Five years from now, you'll wish you'd grabbed this stock. Click here to learn more.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Nelson Smith has no position in any stocks mentioned.