[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1315372100.3400.76.camel@edumazet-laptop>
Date:	Wed, 07 Sep 2011 07:08:20 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	"Yan, Zheng" <yanzheng@...n.com>
Cc:	Tim Chen <tim.c.chen@...ux.intel.com>,
	"Yan, Zheng" <zheng.z.yan@...el.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>,
	"jirislaby@...il.com" <jirislaby@...il.com>,
	"sedat.dilek@...il.com" <sedat.dilek@...il.com>, alex.shi@...el.com
Subject: Re: [PATCH -next v2] unix stream: Fix use-after-free crashes
Le mercredi 07 septembre 2011 à 12:36 +0800, Yan, Zheng a écrit :
> I guess you misunderstood this code. Set scm_ref to false means skb will inherit
> sender's reference. Then we call unix_scm_to_skb() with parameter
> 'ref' == false.
> So it doesn't get additional reference. I admit my patch is confusing,
> but I think
> Tim's new patch is OK. (even in the case of fail skb allocation or
> user->kernel copy)
> 
I want to be able to review the code now, and in two or three years too,
without spending hours and hours.
Could you _please_ guys send a patch, with :
1) A good changelog : In this confusing area, this is probably more
important than actual code.
2) right logic and right variable names
I am sorry, but this is not good :
+               /* encode scm in skb and use the scm ref */
+               ref_avail = false;
+               if (sent + size < len) { 
+                       /* Only send the fds in the first buffer */
+                       /* get additional ref if more skbs will be created */
+                       err = unix_scm_to_skb(siocb->scm, skb, !fds_sent, true);
+                       ref_avail = true;
+               } else
+                       err = unix_scm_to_skb(siocb->scm, skb, !fds_sent, false);
--
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
 
