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]
Date:	Thu, 14 Jul 2011 18:15:02 -0300
From:	Flavio Leitner <fbl@...hat.com>
To:	netdev <netdev@...r.kernel.org>
Subject: preempting while holding rtnl_lock


Hi,

I was reviewing driver sources and found that
ethtool ops holds rtnl_lock() and there are few
drivers (for example: tg3, bnx2) that use napi_disable()
in this context.

/**     
 *      napi_disable - prevent NAPI from scheduling
 *      @n: napi context
 *              
 * Stop NAPI from being scheduled on this context.
 * Waits till any outstanding processing completes.
 */
static inline void napi_disable(struct napi_struct *n)
{
        set_bit(NAPI_STATE_DISABLE, &n->state);
        while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
                msleep(1);
        clear_bit(NAPI_STATE_DISABLE, &n->state);
}

The msleep() above will preempt.  I believe this is wrong.
See the functions below as examples:
bnx2_set_ringparam()
+ bnx2_change_ring_size()
  + bnx2_netif_stop()
    + bnx2_napi_disable()
      + napi_disable()


+ tg3_change_mtu() = ndo_change_mtu
  + tg3_netif_stop()
    + tg3_napi_disable()
      + napi_disable()

What am I missing?
thanks,
fbl
--
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