public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: haijun.liu@mediatek.com
Cc: linux-mediatek@lists.infradead.org
Subject: [bug report] net: wwan: t7xx: Add control DMA interface
Date: Tue, 17 May 2022 14:49:36 +0300	[thread overview]
Message-ID: <YoOL0NuzeeV/Fn+9@kili> (raw)

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

                 reply	other threads:[~2022-05-17 11:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoOL0NuzeeV/Fn+9@kili \
    --to=dan.carpenter@oracle.com \
    --cc=haijun.liu@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox