Cognitive relaying is a promising technique to improve spectrum utilization in mobile networks. In this paper, we consider a scenario in which a secondary transmitter communicates with a secondary receiver by the help of a secondary relay. The secondary user should adjust its transmission power in order to not cause any harmful interference to the multiple primary users operating in the licensed spectrum. In this context, we investigate the end-to-end performance of cognitive relay networks in terms of outage probability and ergodic capacity over Nakagami-m fading channels. A closed-form expression for outage probability and an approximation for ergodic capacity are derived. Furthermore, the presented numerical examples illustrate the impact of the number of primary users on the performance of cognitive relay networks.