Netdev List
 help / color / mirror / Atom feed
From: Anton Volkov <avolkov@ispras.ru>
To: david.choi@micrel.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: Possible race in ks8851_mll.ko
Date: Tue, 15 Aug 2017 18:57:32 +0300	[thread overview]
Message-ID: <49e80d06-531e-178e-1cb0-3293f275847f@ispras.ru> (raw)

Hello.

While searching for races in the Linux kernel I've come across
"drivers/net/ethernet/micrel/ks8851_mll.ko" module. Here is a question 
that I came up with while analyzing results. Lines are given using the 
info from Linux v4.12.

Consider the following case:

Thread 1:                    Thread 2:
ks8851_probe
   ks = netdev_priv(netdev)
   register_netdev
                              ks_start_xmit
->ks_soft_reset              ->ks_tx_fifo_space
   ->ks_wrreg16                 ->ks_rdreg16
       ks->cmd_reg_cache = ...      ks->cmd_reg_cache = ...
       (ks8851_mll.c: line 536)     (ks8851_mll.c: line 505)
       iowrite16(ks->cmd_reg_cache) iowrite16(ks->cmd_reg_cache)

In this case early registration of netdev leads to callback interference 
in the initialization process. Both ks_wrreg16() and ks_rdreg16() use 
the same ks. If one of them changes the ks->cmd_reg_cache it is possible 
that both will use the same value though it should be different. Is this 
race feasible from your point of view?

Thank you for your time.

-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru

                 reply	other threads:[~2017-08-15 15:57 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=49e80d06-531e-178e-1cb0-3293f275847f@ispras.ru \
    --to=avolkov@ispras.ru \
    --cc=davem@davemloft.net \
    --cc=david.choi@micrel.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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