All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [bug report] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero
@ 2022-07-25  7:04 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-07-25  7:04 UTC (permalink / raw)
  To: piotrx.skajewski; +Cc: intel-wired-lan

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-25  7:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25  7:04 [Intel-wired-lan] [bug report] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero Dan Carpenter

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.