This paper presents a linear stability analysis of a rapidly sheared layer of granular material confined between two parallel solid plates. The form of the steady base-state solution depends on the nature of the interaction between the material and the bounding plates and three cases are considered, in which the boundaries act as sources or sinks of pseudo-thermal energy, or merely confine the material while leaving the velocity profile linear, as in unbounded shear. The stability analysis is conventional, though complicated, and the results are similar in all cases. For given physical properties of the particles and the bounding plates it is found that the condition of marginal stability depends only on the separation between the plates and the mean bulk density of the particulate material contained between them. The system is stable when the thickness of the layer is sufficiently small, but if the thickness is increased it becomes unstable, and initially the fastest growing mode is analogous to modes of the corresponding unbounded problem. However, with a further increase in thickness a new mode becomes dominant and this is of an unusual type, with no analogue in the case of unbounded shear. The growth rate of this mode passes through a maximum at a certain value of the thickness of the sheared layer, at which point it grows much faster than any mode that could be shared with the unbounded problem. The growth rate of the dominant mode also depends on the bulk density of the material, and is greatest when this is neither very large nor very small.