Press-and-hold the Command key (PC: Control key) and click on the layer mask thumbnail to make a selection the same size as the mask. Then, switch to the Paths palette (nested behind the Layers palette by default) and from the palette’s flyout menu, choose Make Work Path. In the resulting dialog, enter a Tolerance of 0.5 pixels (the lowest number possible, creating a more accurate path).
A path will now be visible around the edges of the photo. This path is a non-printing element that is used for various purposes such as making a selection, or as we’ll use it here, to apply a stroke.