intel-wired-lan.lists.osuosl.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: shannon.nelson@amd.com
Cc: intel-wired-lan@lists.osuosl.org
Subject: [Intel-wired-lan] [bug report] ixgbe: add VF IPsec management
Date: Fri, 9 Feb 2024 15:59:34 +0300	[thread overview]
Message-ID: <db31a0b0-4d9f-4e6b-aed8-88266eb5665c@moroto.mountain> (raw)

Hello Shannon Nelson,

The patch eda0333ac293: "ixgbe: add VF IPsec management" from Aug 13,
2018 (linux-next), leads to the following Smatch static checker
warning:

	drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c:917 ixgbe_ipsec_vf_add_sa()
	warn: sleeping in IRQ context

drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
    890 int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
    891 {
    892         struct ixgbe_ipsec *ipsec = adapter->ipsec;
    893         struct xfrm_algo_desc *algo;
    894         struct sa_mbx_msg *sam;
    895         struct xfrm_state *xs;
    896         size_t aead_len;
    897         u16 sa_idx;
    898         u32 pfsa;
    899         int err;
    900 
    901         sam = (struct sa_mbx_msg *)(&msgbuf[1]);
    902         if (!adapter->vfinfo[vf].trusted ||
    903             !(adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED)) {
    904                 e_warn(drv, "VF %d attempted to add an IPsec SA\n", vf);
    905                 err = -EACCES;
    906                 goto err_out;
    907         }
    908 
    909         /* Tx IPsec offload doesn't seem to work on this
    910          * device, so block these requests for now.
    911          */
    912         if (sam->dir != XFRM_DEV_OFFLOAD_IN) {
    913                 err = -EOPNOTSUPP;
    914                 goto err_out;
    915         }
    916 
--> 917         xs = kzalloc(sizeof(*xs), GFP_KERNEL);
                                          ^^^^^^^^^^
Sleeping allocation.

The call tree that Smatch is worried about is:

ixgbe_msix_other() <- IRQ handler
-> ixgbe_msg_task()
   -> ixgbe_rcv_msg_from_vf()
      -> ixgbe_ipsec_vf_add_sa()

This is a fairly new warning and those have a higher risk of false
positives.  Plus the longer the call tree the higher the chance of
false positives.  However, I did review it and the warning looks
reasonable.

regards,
dan carpenter

             reply	other threads:[~2024-02-09 12:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 12:59 Dan Carpenter [this message]
2024-02-09 17:57 ` [Intel-wired-lan] [bug report] ixgbe: add VF IPsec management Nelson, Shannon
2024-02-14 13:58   ` Przemek Kitszel
2024-02-14 17:51     ` Nelson, Shannon

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=db31a0b0-4d9f-4e6b-aed8-88266eb5665c@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=shannon.nelson@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).