All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: piotrx.skajewski@intel.com
Cc: intel-wired-lan@lists.osuosl.org
Subject: [Intel-wired-lan] [bug report] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero
Date: Mon, 25 Jul 2022 10:04:56 +0300	[thread overview]
Message-ID: <Yt5AmGA5dx/KjOOF@kili> (raw)

Hello Piotr Skajewski,

The patch 1e53834ce541: "ixgbe: Add locking to prevent panic when
setting sriov_numvfs to zero" from Jul 15, 2022, leads to the
following Smatch static checker warning:

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


drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
  1358  void ixgbe_msg_task(struct ixgbe_adapter *adapter)
  1359  {
  1360          struct ixgbe_hw *hw = &adapter->hw;
  1361          unsigned long flags;
  1362          u32 vf;
  1363  
  1364          spin_lock_irqsave(&adapter->vfs_lock, flags);
                ^^^^^^^^^^^^^^^^^
New locking

  1365          for (vf = 0; vf < adapter->num_vfs; vf++) {
  1366                  /* process any reset requests */
  1367                  if (!ixgbe_check_for_rst(hw, vf))
  1368                          ixgbe_vf_reset_event(adapter, vf);
  1369  
  1370                  /* process any messages pending */
  1371                  if (!ixgbe_check_for_msg(hw, vf))
  1372                          ixgbe_rcv_msg_from_vf(adapter, vf);
  1373  
  1374                  /* process any acks */
  1375                  if (!ixgbe_check_for_ack(hw, vf))
  1376                          ixgbe_rcv_ack_from_vf(adapter, vf);
  1377          }
  1378          spin_unlock_irqrestore(&adapter->vfs_lock, flags);
  1379  }

ixgbe_msg_task() <- disables preempt
-> ixgbe_rcv_msg_from_vf()
   -> ixgbe_ipsec_vf_add_sa() <- sleeps

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

    912         if (unlikely(!xs)) {
    913                 err = -ENOMEM;
    914                 goto err_out;
    915         }
    916 

regards,
dan carpenter
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

                 reply	other threads:[~2022-07-25  7:05 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=Yt5AmGA5dx/KjOOF@kili \
    --to=dan.carpenter@oracle.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=piotrx.skajewski@intel.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.