* [BUG] net: tg3: two possible data races
@ 2018-06-27 1:47 Jia-Ju Bai
0 siblings, 0 replies; 2+ messages in thread
From: Jia-Ju Bai @ 2018-06-27 1:47 UTC (permalink / raw)
To: siva.kallam, prashant, mchan; +Cc: netdev, Linux Kernel Mailing List
The call paths in Linux 4.16.7 that may raise the first data race:
CPU0:
tg3_open
tg3_start
line 11611: spin_lock_bh()
tg3_enable_ints
line 1023: tp->tnapi->last_tag [READ]
CPU1:
tg3_poll
line 7341: tnapi->last_tag [WRITE]
The READ operation in CPU0 is performed with holding a spinlock (line
11611), but the WRITE operation in CPU1 is performed without holding
this spinlock, so it may cause a data race here.
A possible fix may be to add spin_lock_bh() in tg3_poll().
-----------------------------------------------------------------------
The call paths in Linux 4.16.7 that may raise the second data race:
CPU0:
tg3_open
tg3_start
line 11611: spin_lock_bh()
tg3_enable_ints
line 1023: tp->irq_sync [WRITE]
CPU1:
tg3_interrupt_tagged
tg3_irq_sync
line 7341: tp->irq_sync [READ]
The WRITE operation in CPU0 is performed with holding a spinlock (line
11611), but the READ operation in CPU1 is performed without holding this
spinlock, so it may cause a data race here.
A possible fix may be to add spin_lock_bh() in tg3_irq_sync().
I am not sure that whether the possible fixes are correct, so I only
report the data races.
Best wishes,
Jia-Ju Bai
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [BUG] net: tg3: two possible data races
@ 2018-06-27 14:46 Siva Reddy Kallam
0 siblings, 0 replies; 2+ messages in thread
From: Siva Reddy Kallam @ 2018-06-27 14:46 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: Prashant Sreedharan, Michael Chan, Linux Netdev List,
Linux Kernel Mailing List
On Wed, Jun 27, 2018 at 7:17 AM, Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
> The call paths in Linux 4.16.7 that may raise the first data race:
>
> CPU0:
> tg3_open
> tg3_start
> line 11611: spin_lock_bh()
> tg3_enable_ints
> line 1023: tp->tnapi->last_tag [READ]
>
> CPU1:
> tg3_poll
> line 7341: tnapi->last_tag [WRITE]
>
> The READ operation in CPU0 is performed with holding a spinlock (line
> 11611), but the WRITE operation in CPU1 is performed without holding this
> spinlock, so it may cause a data race here.
> A possible fix may be to add spin_lock_bh() in tg3_poll().
>
> -----------------------------------------------------------------------
>
> The call paths in Linux 4.16.7 that may raise the second data race:
>
> CPU0:
> tg3_open
> tg3_start
> line 11611: spin_lock_bh()
> tg3_enable_ints
> line 1023: tp->irq_sync [WRITE]
>
> CPU1:
> tg3_interrupt_tagged
> tg3_irq_sync
> line 7341: tp->irq_sync [READ]
>
> The WRITE operation in CPU0 is performed with holding a spinlock (line
> 11611), but the READ operation in CPU1 is performed without holding this
> spinlock, so it may cause a data race here.
> A possible fix may be to add spin_lock_bh() in tg3_irq_sync().
>
> I am not sure that whether the possible fixes are correct, so I only report
> the data races.
>
>
> Best wishes,
> Jia-Ju Bai
>
>
We will evaluate this and provide an update on this.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-27 14:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-27 1:47 [BUG] net: tg3: two possible data races Jia-Ju Bai
-- strict thread matches above, loose matches on Subject: below --
2018-06-27 14:46 Siva Reddy Kallam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox