Flynn, 26, was acquired by Montreal from the Buffalo Sabres on March 2 for a fifth round draft pick.
He had 17 points in 54 games for Buffalo and no points in nine regular season outings for the Canadiens. He added a goal and two assists, all in Game 1 of the first round against Ottawa, in six playoff starts.
Flynn will count $950,000 against the salary cap.
The Lynnfield, Mass., native is a right hand shot who can play centre or wing. He averaged 14:54 of ice time, mostly playing on the fourth line.
He has 17 goals and 24 assists in 168 career NHL games.
"A fast, versatile and reliable player, Brian bought into the team’s philosophy from the very first day," general manager Marc Bergevin said in a statement. "He brings the right attitude to the dressing room day in and day out and has a professional approach to the game."
On June 15, the Canadiens signed a three-year deal with forward Torrey Mitchell, who was acquired on the same day from Buffalo as Flynn.
Flynn had been given a qualifying offer along with Michael Bournival, Alex Galchenyuk, Jarred Tinordi, Christian Thomas and Magnus Nygren.