netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb()
@ 2011-05-17 23:10 Eric Dumazet
  2011-05-18  6:21 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2011-05-17 23:10 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Witold Baryluk, Stephen Hemminger

Commit 7fee226ad239 (add a noref bit on skb dst) forgot to use
skb_dst_force() on packets queued in sk_error_queue

This triggers following warning, for applications using IP_CMSG_PKTINFO
receiving one error status


------------[ cut here ]------------
WARNING: at include/linux/skbuff.h:457 ip_cmsg_recv_pktinfo+0xa6/0xb0()
Hardware name: 2669UYD
Modules linked in: isofs vboxnetadp vboxnetflt nfsd ebtable_nat ebtables
lib80211_crypt_ccmp uinput xcbc hdaps tp_smapi thinkpad_ec radeonfb fb_ddc
radeon ttm drm_kms_helper drm ipw2200 intel_agp intel_gtt libipw i2c_algo_bit
i2c_i801 agpgart rng_core cfbfillrect cfbcopyarea cfbimgblt video raid10 raid1
raid0 linear md_mod vboxdrv
Pid: 4697, comm: miredo Not tainted 2.6.39-rc6-00569-g5895198-dirty #22
Call Trace:
 [<c17746b6>] ? printk+0x1d/0x1f
 [<c1058302>] warn_slowpath_common+0x72/0xa0
 [<c15bbca6>] ? ip_cmsg_recv_pktinfo+0xa6/0xb0
 [<c15bbca6>] ? ip_cmsg_recv_pktinfo+0xa6/0xb0
 [<c1058350>] warn_slowpath_null+0x20/0x30
 [<c15bbca6>] ip_cmsg_recv_pktinfo+0xa6/0xb0
 [<c15bbdd7>] ip_cmsg_recv+0x127/0x260
 [<c154f82d>] ? skb_dequeue+0x4d/0x70
 [<c1555523>] ? skb_copy_datagram_iovec+0x53/0x300
 [<c178e834>] ? sub_preempt_count+0x24/0x50
 [<c15bdd2d>] ip_recv_error+0x23d/0x270
 [<c15de554>] udp_recvmsg+0x264/0x2b0
 [<c15ea659>] inet_recvmsg+0xd9/0x130
 [<c1547752>] sock_recvmsg+0xf2/0x120
 [<c11179cb>] ? might_fault+0x4b/0xa0
 [<c15546bc>] ? verify_iovec+0x4c/0xc0
 [<c1547660>] ? sock_recvmsg_nosec+0x100/0x100
 [<c1548294>] __sys_recvmsg+0x114/0x1e0
 [<c1093895>] ? __lock_acquire+0x365/0x780
 [<c1148b66>] ? fget_light+0xa6/0x3e0
 [<c1148b7f>] ? fget_light+0xbf/0x3e0
 [<c1148aee>] ? fget_light+0x2e/0x3e0
 [<c1549f29>] sys_recvmsg+0x39/0x60

Close bug https://bugzilla.kernel.org/show_bug.cgi?id=34622


Reported-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Stephen Hemminger <shemminger@vyatta.com>
---
 net/core/skbuff.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7ebeed0..3e934fe 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2993,6 +2993,9 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
 	skb->destructor = sock_rmem_free;
 	atomic_add(skb->truesize, &sk->sk_rmem_alloc);
 
+	/* before exiting rcu section, make sure dst is refcounted */
+	skb_dst_force(skb);
+
 	skb_queue_tail(&sk->sk_error_queue, skb);
 	if (!sock_flag(sk, SOCK_DEAD))
 		sk->sk_data_ready(sk, skb->len);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb()
  2011-05-17 23:10 [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb() Eric Dumazet
@ 2011-05-18  6:21 ` David Miller
  2011-05-18 14:25   ` Witold Baryluk
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-05-18  6:21 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, baryluk, shemminger

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 May 2011 01:10:46 +0200

> Commit 7fee226ad239 (add a noref bit on skb dst) forgot to use
> skb_dst_force() on packets queued in sk_error_queue
> 
> This triggers following warning, for applications using IP_CMSG_PKTINFO
> receiving one error status
 ...
> Close bug https://bugzilla.kernel.org/show_bug.cgi?id=34622
> 
> Reported-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb()
  2011-05-18  6:21 ` David Miller
@ 2011-05-18 14:25   ` Witold Baryluk
  2011-05-18 14:34     ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Witold Baryluk @ 2011-05-18 14:25 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, netdev, shemminger

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On 05-18 02:21, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 18 May 2011 01:10:46 +0200
> 
> > Commit 7fee226ad239 (add a noref bit on skb dst) forgot to use
> > skb_dst_force() on packets queued in sk_error_queue
> > 
> > This triggers following warning, for applications using IP_CMSG_PKTINFO
> > receiving one error status
>  ...
> > Close bug https://bugzilla.kernel.org/show_bug.cgi?id=34622
> > 
> > Reported-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > CC: Stephen Hemminger <shemminger@vyatta.com>
> 
> Applied, thanks.

Patch solves problem for me.

Initial warning was looking harmless anyway to me,
but good it is fixed now.

Thanks.
Witek

-- 
Witold Baryluk

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb()
  2011-05-18 14:25   ` Witold Baryluk
@ 2011-05-18 14:34     ` Eric Dumazet
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2011-05-18 14:34 UTC (permalink / raw)
  To: Witold Baryluk; +Cc: David Miller, netdev, shemminger

Le mercredi 18 mai 2011 à 16:25 +0200, Witold Baryluk a écrit :

> Patch solves problem for me.
> 
> Initial warning was looking harmless anyway to me,
> but good it is fixed now.

It was a real bug, thanks for reporting it and testing the fix.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-18 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-17 23:10 [PATCH net-2.6] net: add skb_dst_force() in sock_queue_err_skb() Eric Dumazet
2011-05-18  6:21 ` David Miller
2011-05-18 14:25   ` Witold Baryluk
2011-05-18 14:34     ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).