Netdev List
 help / color / mirror / Atom feed
From: Anton Volkov <avolkov@ispras.ru>
To: isdn@linux-pingi.de, davem@davemloft.net, calle@calle.de
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: Possible race in c4.ko
Date: Tue, 15 Aug 2017 16:22:16 +0300	[thread overview]
Message-ID: <b839c418-9c1d-aba7-4d00-e9c7786870bf@ispras.ru> (raw)

Hello.

While searching for races in the Linux kernel I've come across 
"drivers/isdn/hardware/avm/c4.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:
c4_probe
->c4_add_card
     request_irq()
                            c4_interrupt
                            ->c4_handle_interrupt
                              ->c4_handle_rx
     card->cardnr = ...         cidx = f(card->cardnr)
     (c4.c: line 1227)          (c4.c: line 526)
                                if (cidx >= card->nlogcontr) cidx = 0;
                                ctrl = &card->ctrlinfo[cidx].capi_ctrl

card->cardnr is 0 until it is initialized in c4_add_card(). If at the 
moment of read access in c4_handle_rx() it is still 0, cidx may then be 
assigned an undesirable value and wrong controller may handle messages. 
Is this case 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 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 13:22 Anton Volkov [this message]
2017-08-16  4:55 ` Possible race in c4.ko Carsten Paeth

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=b839c418-9c1d-aba7-4d00-e9c7786870bf@ispras.ru \
    --to=avolkov@ispras.ru \
    --cc=calle@calle.de \
    --cc=davem@davemloft.net \
    --cc=isdn@linux-pingi.de \
    --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