Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Manfred Rudigier <manfred.rudigier@omicron.at>
Cc: David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"afleming@freescale.com" <afleming@freescale.com>,
	"avorontsov@mvista.com" <avorontsov@mvista.com>
Subject: RE: [PATCH] gianfar: Fix invalid TX frames returned on error queue when time stamping.
Date: Mon, 09 Jan 2012 08:43:58 +0100	[thread overview]
Message-ID: <1326095038.2627.4.camel@edumazet-laptop> (raw)
In-Reply-To: <95DC1AA8EC908B48939B72CF375AA5E3013A99124D@alice.at.omicron.at>

Le lundi 09 janvier 2012 à 08:16 +0100, Manfred Rudigier a écrit :
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Thursday, January 05, 2012 19:27
> 
> >From: Manfred Rudigier <manfred.rudigier@omicron.at>
> >Date: Thu, 5 Jan 2012 15:50:21 +0100
> >
> >> +
> >> +		/* Keep sock if we must return a time stamp on the err queue */
> >> +		skb_new->sk = skb->sk;
> >
> >When I see something like this without any kind of reference counting or
> >similar, I am gravely concerned.
> 
> The skb_tstamp_tx function called during gfar_clean_tx_ring requires
> the skb->sk pointer to be set. Otherwise no time stamp can be queued
> on the socket error queue. 
> What would be the correct way for doing this?

I really wonder how your code was possibly working...

A correct steal sequence maybe 

	skb_new->sk = skb->sk;
	skb->sk = NULL;
	kfree_skb(skb);

Or else, kfree_skb() releases sk reference and eventually socket is
freed before skb_tstamp_tx()

  reply	other threads:[~2012-01-09  7:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 14:50 [PATCH] gianfar: Fix invalid TX frames returned on error queue when time stamping Manfred Rudigier
2012-01-05 18:26 ` David Miller
2012-01-09  7:16   ` Manfred Rudigier
2012-01-09  7:43     ` Eric Dumazet [this message]
2012-01-09  9:36       ` Manfred Rudigier
2012-01-09  9:58         ` Eric Dumazet
2012-01-09 10:43           ` Manfred Rudigier
2012-01-09 12:41         ` Richard Cochran
2012-01-09 12:50           ` Richard Cochran
2012-01-09 12:49     ` Richard Cochran
2012-01-09 14:45       ` Manfred Rudigier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326095038.2627.4.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=afleming@freescale.com \
    --cc=avorontsov@mvista.com \
    --cc=davem@davemloft.net \
    --cc=manfred.rudigier@omicron.at \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox