[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080401174759.GB28217@2ka.mipt.ru>
Date: Tue, 1 Apr 2008 21:47:59 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: David Miller <davem@...emloft.net>, axboe@...nel.dk,
netdev@...r.kernel.org
Subject: Re: Fix for the fundamental network/block layer race in sendfile().
Hi.
On Tue, Apr 01, 2008 at 07:19:39PM +0200, Eric Dumazet (dada1@...mosbay.com) wrote:
> >@@ -762,6 +765,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd,
> >loff_t *ppos,
> > count = max - pos;
> > }
> >
> >+ sock = out_file->private_data;
> >+ sk = sock->sk;
> >+
> >+ sk->sk_user_data = &skb_splice_destructor;
> >+ sk->sk_flags |= SO_PRIVATE_CALLBACK;
>
> Ouch...
>
> this seems very ugly (sorry).
>
> 1) Is out_file garanted to be a socket ?
Yep.
> 2) SO_PRIVATE_CALLBACK is defined to be 37 later on your patch. Is ORing 37
> to sk_flags really working ???
Kind of... Not as supposed to be, since sk_flags is a long.
Will put that flag into socket instead.
> 3) So, once a socket has been used for a sendfile(), all subsequent
> sendmsg() will call skb_splice_destructor ? (I see no clearing of
> SO_PRIVATE_CALLBACK)
> This will probably crash.
Yep, need to clear.
> 4) god_blessed_us name ... Oh I got it, its April the first !!!!
But it still works :)
--
Evgeniy Polyakov
--
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