From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH 1/3] net: hold sock reference while processing tx timestamps Date: Wed, 19 Oct 2011 06:42:10 +0200 Message-ID: <1318999330.19139.19.camel@edumazet-laptop> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: netdev@vger.kernel.org, David Miller , Johannes Berg , stable@kernel.org To: Richard Cochran Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:59022 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998Ab1JSEmT (ORCPT ); Wed, 19 Oct 2011 00:42:19 -0400 Received: by wwe6 with SMTP id 6so1926446wwe.1 for ; Tue, 18 Oct 2011 21:42:17 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Le jeudi 13 octobre 2011 =C3=A0 11:46 +0200, Richard Cochran a =C3=A9cr= it : > The pair of functions, >=20 > * skb_clone_tx_timestamp() > * skb_complete_tx_timestamp() >=20 > were designed to allow timestamping in PHY devices. The first > function, called during the MAC driver's hard_xmit method, identifies > PTP protocol packets, clones them, and gives them to the PHY device > driver. The PHY driver may hold onto the packet and deliver it at a > later time using the second function, which adds the packet to the > socket's error queue. >=20 > As pointed out by Johannes, nothing prevents the socket from > disappearing while the cloned packet is sitting in the PHY driver > awaiting a timestamp. This patch fixes the issue by taking a referenc= e > on the socket for each such packet. In addition, the comments > regarding the usage of these function are expanded to highlight the > rule that PHY drivers must use skb_complete_tx_timestamp() to release > the packet, in order to release the socket reference, too. >=20 > These functions first appeared in v2.6.36. >=20 > Reported-by: Johannes Berg > Signed-off-by: Richard Cochran > Cc: Acked-by: Eric Dumazet