linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sergio.valverde@hpe.com
Cc: mhei@heimpold.de, dompe@hpe.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix race condition in enc28j60 driver
Date: Sat, 02 Jul 2016 14:49:19 -0400 (EDT)	[thread overview]
Message-ID: <20160702.144919.52232813385388603.davem@davemloft.net> (raw)
In-Reply-To: <1467395070-8632-1-git-send-email-sergio.valverde@hpe.com>

From: Sergio Valverde < sergio.valverde@hpe.com >
Date: Fri,  1 Jul 2016 11:44:30 -0600

> From: Sergio Valverde <sergio.valverde@hpe.com>
> 
> The interrupt worker code for the enc28j60 relies only on the TXIF flag to
> determinate if the packet transmission was completed. However the datasheet
> specifies in section 12.1.3 that TXERIF will clear the TXRTS after a
> transmit abort. Also in section 12.1.4 that TXIF will be set
> when TXRTS transitions from '1' to '0'. Therefore the TXIF flag is enabled
> during transmission errors.
> 
> This causes a race condition, since the worker code will invoke
> enc28j60_tx_clear() -> netif_wake_queue(), potentially invoking the
> ndo_start_xmit function to send a new packet. The enc28j60_send_packet function
> uses a workqueue that invokes enc28j60_hw_tx(). In between this function is
> called, the worker from the interrupt handler will enter the path for error
> handler because of the TXERIF flag, causing to invoke enc28j60_tx_clear() again
> and releasing the packet scheduled for transmission, causing a kernel crash with
> due a NULL pointer.
> 
> These crashes due a NULL pointer were observed under stress conditions of the
> device. A BUG_ON() sequence was used to validate the issue was fixed, and has
> been running without problems for 2 years now.
> 
> Signed-off-by: Diego Dompe <dompe@hpe.com>
> Acked-by: Sergio Valverde <sergio.valverde@hpe.com>

Applied.

      reply	other threads:[~2016-07-02 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 17:44 [PATCH] Fix race condition in enc28j60 driver Sergio Valverde
2016-07-02 18:49 ` David Miller [this message]

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=20160702.144919.52232813385388603.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dompe@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhei@heimpold.de \
    --cc=netdev@vger.kernel.org \
    --cc=sergio.valverde@hpe.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).