lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5040AD1F.9080702@redhat.com>
Date:	Fri, 31 Aug 2012 09:25:03 -0300
From:	Marcelo Ricardo Leitner <mleitner@...hat.com>
To:	netdev@...r.kernel.org
CC:	dledford@...hat.com
Subject: Possible issue with Mellanox be2net/port handling

Hi,

Commit 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4c41b3673759d096106e68bce586f103c51d4119 
inserted changes like:

@@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
         int err;
         struct mlx4_priv *priv = mlx4_priv(dev);

-       s_steer = &mlx4_priv(dev)->steer[0];
+       s_steer = &mlx4_priv(dev)->steer[port - 1];

         mutex_lock(&priv->mcg_table.mutex);

But I fear we missed one part of the deal. Concept patch:

@@ -365,7 +365,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,

         mutex_lock(&priv->mcg_table.mutex);

-       if (get_promisc_qp(dev, 0, steer, qpn)) {
+       if (get_promisc_qp(dev, port - 1, steer, qpn)) {
                 err = 0;  /* Noting to do, already exists */
                 goto out_mutex;
         }

Because:

static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
               enum mlx4_steer_type steer, u32 qpn)
{
...
A)  s_steer = &mlx4_priv(dev)->steer[port - 1];

     mutex_lock(&priv->mcg_table.mutex);

     if (get_promisc_qp(dev, 0, steer, qpn)) {
         err = 0;  /* Noting to do, already exists */
         goto out_mutex;
     }
...
     /* add the new qpn to list of promisc qps */
C)  list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
...
}

static struct mlx4_promisc_qp *get_promisc_qp(struct mlx4_dev *dev, u8 
pf_num,
                           enum mlx4_steer_type steer,
                           u32 qpn)
{
B)  struct mlx4_steer *s_steer = &mlx4_priv(dev)->steer[pf_num];
     struct mlx4_promisc_qp *pqp;

     list_for_each_entry(pqp, &s_steer->promisc_qps[steer], list) {
         if (pqp->qpn == qpn)
             return pqp;
     }
     /* not found */
     return NULL;
}

As far as I can understand, we are changing a list for a port and 
checking for duplicates on the other list. Points marked as A, B and C 
for highlighting. Am I missing something? What do you think?

FWIW, this call get_promisc_qp(dev, 0, ...) happens in other places too.

Thank you,
Marcelo.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ