All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tony@atomide.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] tty: n_gsm: Fix packet data hex dump output
Date: Mon, 23 May 2022 10:01:28 +0300	[thread overview]
Message-ID: <YosxSDXeL9jTCENN@kili> (raw)

Hello Tony Lindgren,

The patch 925ea0fa5277: "tty: n_gsm: Fix packet data hex dump output"
from May 12, 2022, leads to the following Smatch static checker
warning:

	drivers/tty/n_gsm.c:720 gsm_data_kick()
	warn: sleeping in atomic context

drivers/tty/n_gsm.c
    698 static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
    699 {
    700         struct gsm_msg *msg, *nmsg;
    701         int len;
    702 
    703         list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) {
    704                 if (gsm->constipated && msg->addr)
    705                         continue;
    706                 if (gsm->encoding != 0) {
    707                         gsm->txframe[0] = GSM1_SOF;
    708                         len = gsm_stuff_frame(msg->data,
    709                                                 gsm->txframe + 1, msg->len);
    710                         gsm->txframe[len + 1] = GSM1_SOF;
    711                         len += 2;
    712                 } else {
    713                         gsm->txframe[0] = GSM0_SOF;
    714                         memcpy(gsm->txframe + 1 , msg->data, msg->len);
    715                         gsm->txframe[msg->len + 1] = GSM0_SOF;
    716                         len = msg->len + 2;
    717                 }
    718 
    719                 if (debug & 4)
--> 720                         gsm_hex_dump_bytes(__func__, gsm->txframe, len);

gsm_control_message() is holding a spin lock so gsm_hex_dump_bytes()
might need to use GFP_ATOMIC instead of GFP_KERNEL.

    721                 if (gsmld_output(gsm, gsm->txframe, len) <= 0)
    722                         break;
    723                 /* FIXME: Can eliminate one SOF in many more cases */
    724                 gsm->tx_bytes -= msg->len;
    725 
    726                 list_del(&msg->list);
    727                 kfree(msg);
    728 
    729                 if (dlci) {
    730                         tty_port_tty_wakeup(&dlci->port);
    731                 } else {
    732                         int i = 0;
    733 
    734                         for (i = 0; i < NUM_DLCI; i++)
    735                                 if (gsm->dlci[i])
    736                                         tty_port_tty_wakeup(&gsm->dlci[i]->port);
    737                 }
    738         }
    739 }

regards,
dan carpenter

             reply	other threads:[~2022-05-23  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23  7:01 Dan Carpenter [this message]
2022-05-23  7:34 ` [bug report] tty: n_gsm: Fix packet data hex dump output Tony Lindgren

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=YosxSDXeL9jTCENN@kili \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.