login
Header Space

 
 

Re: nbd: Oops because nbd doesn't prevent NBD_CLEAR_SOCK while sock_xmit() is working on a receive

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Paul Clements <paul.clements@...>
Cc: <nbd-general@...>, <linux-kernel@...>
Date: Thursday, March 27, 2008 - 9:21 am

On Thu, Mar 27, 2008 at 8:35 AM, Paul Clements
<paul.clements@steeleye.com> wrote:

I believe that NBD_CLEAR_SOCK from 'nbd-client -d' sets it to NULL.
lo->sock is already NULL on entry to sock_xmit().

So simply checking if the sock_xmit's 'sock' is NULL _should_ avoid
any possibility of a NULL pointer Oops because sock can't be !NULL
after the negative check (because of the sock = lo->sock assignment).
That is, unless I'm missing somewhere in the rest of the kernel (not
nbd) that would take action to set a socket to NULL?

The attached patch seems reasonable.  I'll be testing today to verify
it fixes the problem.


I'm aware tx_lock can't be held over both; I was suggesting maybe
another lock but that feels like overkill.

I use 'nbd-client -d' and then resort to 'kill -9' IFF 'nbd-client -d'
returned non-zero.
But it sounds like simply using 'kill -9' could be a near-term
workaround, I'll try this as well and will report back.

thanks,
Mike
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: nbd: Oops because nbd doesn't prevent NBD_CLEAR_SOCK whi..., Mike Snitzer, (Thu Mar 27, 9:21 am)
speck-geostationary