[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d34nhk4e.fsf@nemi.mork.no>
Date: Mon, 25 Jun 2012 10:27:13 +0200
From: Bjørn Mork <bjorn@...k.no>
To: Ming Lei <tom.leiming@...il.com>
Cc: Oliver Neukum <oliver@...kum.org>, netdev@...r.kernel.org,
linux-usb@...r.kernel.org,
Marius Bjørnstad Kotsbak
<marius.kotsbak@...il.com>
Subject: Re: [PATCH net] net: qmi_wwan: fix Oops while disconnecting
Ming Lei <tom.leiming@...il.com> writes:
> On Mon, Jun 25, 2012 at 3:24 PM, Bjørn Mork <bjorn@...k.no> wrote:
>
>> There is no problem wrt qmi_wwan and intfdata as long as the NULL test
>> is added to .manage_power.
>
> It depends on the ARCH or compiler.
>
> Considered there is not any locking/memory barrier between the set to NULL
> and read the pointer, also no ACCESS_ONCE on read or store the pointer,
> reading in .manage_power may see a invalid pointer if the CPU doesn't
> support Store Atomicity or the compiler does a byte-at-a-time optimization
> on the store[1].
>
> So why not take the correct way in theory? also it is a general solution,
> and we can document its usage.
>
>
> [1], Paul mentioned it in the previous discussion
> http://lkml.org/lkml/2012/6/6/280
I don't believe that is valid for pointers, which hopefully either have
native word size or are protected by the compiler.
In any case, I'm not prepared to deal with the situation that changing a
pointer from valid to NULL can cause intermediate invalid pointers. If
such an architecture/compiler exists, then I believe the sanest thing to
do is to let it fail randomly.
Bjørn
--
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