Underlaying device-to-device (D2D) communication links to a cellular network is a promising way to improve spectrum efficiency, for which the cross- link interference should be carefully controlled. Resource allocation has been widely utilized for managing interference in D2D networks. However, most previous works made simple assumptions by either ignoring the reliability requirement of D2D links or not allowing multiple D2D links to share the same channel. In this paper, we propose effective channel assignment algorithms to maximize the weighted sum-rate in a cellular network with underlaying D2D communications, where multiple D2D links are allowed to share the same channel. Meanwhile, the minimum Signal-to- Interference-plus-Noise Ratio (SINR) requirements for both cellular and D2D links are guaranteed. We first provide an optimal algorithm based on dynamic programming (DP) to serve as the performance benchmark, which enjoys much lower complexity compared to exhaustive search. To further reduce complexity, we then propose a cluster-based near-optimal channel assignment algorithm. Simulation results will demonstrate the advantage of allowing multiple D2D links to share the same channel in dense D2D networks, as well as verifying the effectiveness of the proposed algorithms.