[bug report] net: wwan: t7xx: Add control DMA interface

Dan Carpenter dan.carpenter at oracle.com
Tue May 17 04:49:36 PDT 2022


Hello Haijun Liu,

The patch 39d439047f1d: "net: wwan: t7xx: Add control DMA interface"
from May 6, 2022, leads to the following Smatch static checker
warning:

	drivers/net/wwan/t7xx/t7xx_hif_cldma.c:805 t7xx_cldma_clear_rxq()
	warn: sleeping in atomic context

drivers/net/wwan/t7xx/t7xx_hif_cldma.c
    780 static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
    781 {
    782         struct cldma_queue *rxq = &md_ctrl->rxq[qnum];
    783         struct cldma_request *req;
    784         struct cldma_gpd *gpd;
    785         unsigned long flags;
    786         int ret = 0;
    787 
    788         spin_lock_irqsave(&rxq->ring_lock, flags);
                ^^^^^^^^^
Holding a spin lock

    789         t7xx_cldma_q_reset(rxq);
    790         list_for_each_entry(req, &rxq->tr_ring->gpd_ring, entry) {
    791                 gpd = req->gpd;
    792                 gpd->flags = GPD_FLAGS_IOC | GPD_FLAGS_HWO;
    793                 gpd->data_buff_len = 0;
    794 
    795                 if (req->skb) {
    796                         req->skb->len = 0;
    797                         skb_reset_tail_pointer(req->skb);
    798                 }
    799         }
    800 
    801         list_for_each_entry(req, &rxq->tr_ring->gpd_ring, entry) {
    802                 if (req->skb)
    803                         continue;
    804 
--> 805                 ret = t7xx_cldma_alloc_and_map_skb(md_ctrl, req, rxq->tr_ring->pkt_size);
                                         ^^^^^
Doing a sleeping allocation.  This is a bug.  Will trigger a stack trace
depending on the CONFIG_ debug options enabled.

    806                 if (ret)
    807                         break;
    808 
    809                 t7xx_cldma_gpd_set_data_ptr(req->gpd, req->mapped_buff);
    810         }
    811         spin_unlock_irqrestore(&rxq->ring_lock, flags);
    812 
    813         return ret;
    814 }

regards,
dan carpenter



More information about the Linux-mediatek mailing list