We characterize norm closed subspaces $B$ of $\linf (\partial D)$ such that $C(\partial D) B \subset B$ and maximal ones in the family of proper closed subspaces $B$ of $L^\infty(\partial D)$ such that $A(D) B \subset B$, where $A(D)$ is the disk algebra. Analogously, we characterize closed subspaces of $H^\infty$ that are simultaneously invariant under $S$ and $S^\ast$, the forward and the backward shift operators, and maximal invariant subspaces of $H^\infty$.