* [PATCH] net: deal wrong skb and failure ret from __tcp_retransmit_skb
@ 2018-04-19 11:26 Liu, Changcheng
2018-04-19 13:40 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Liu, Changcheng @ 2018-04-19 11:26 UTC (permalink / raw)
To: davem, kuznet, yoshfuji; +Cc: netdev, akpm
Hit below panic due to skb is NULL, WARN wrong skb first.
if __tcp_retransmit_skb return failure e.g. -EAGAIN, it
needn't do further action in tcp_retransmit_skb.
gdb vmlinux
Reading symbols from vmlinux...done.
(gdb) p &((struct tcp_skb_cb *) \
&(((struct sk_buff *)0)->cb[0]))->tcp_gso_segs
$1 = (u16 *) 0x30 <irq_stack_union+48>
[ 9040.917533] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
[ 9040.926279] IP: tcp_retransmit_skb+0x5c/0xc0
[ 9040.931043] PGD 0 P4D 0
[ 9040.933865] Oops: 0000 [#1] PREEMPT SMP PTI
[ 9040.972151] RIP: 0010:tcp_retransmit_skb+0x5c/0xc0
[ 9040.977496] RSP: 0018:ffff8802bec83e40 EFLAGS: 00010202
[ 9041.062527] Call Trace:
[ 9041.065250] <IRQ>
[ 9041.067489] tcp_retransmit_timer+0x481/0x820
[ 9041.077697] tcp_write_timer_handler+0xe9/0x230
[ 9041.082751] tcp_write_timer+0x75/0x80
[ 9041.086932] call_timer_fn+0x29/0x150
[ 9041.091018] run_timer_softirq+0x411/0x460
[ 9041.105017] __do_softirq+0x115/0x311
[ 9041.109103] irq_exit+0xb0/0xc0
[ 9041.112605] smp_apic_timer_interrupt+0x67/0x140
Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 383cac0..545b9b3 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2920,7 +2920,10 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
{
struct tcp_sock *tp = tcp_sk(sk);
- int err = __tcp_retransmit_skb(sk, skb, segs);
+ int err = 0;
+
+ WARN_ONCE(!skb, "sk_buff is NULL\n");
+ err = __tcp_retransmit_skb(sk, skb, segs);
if (err == 0) {
#if FASTRETRANS_DEBUG > 0
@@ -2935,6 +2938,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
if (!tp->retrans_stamp)
tp->retrans_stamp = tcp_skb_timestamp(skb);
+ } else {
+ return err;
}
if (tp->undo_retrans < 0)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: deal wrong skb and failure ret from __tcp_retransmit_skb
2018-04-19 11:26 [PATCH] net: deal wrong skb and failure ret from __tcp_retransmit_skb Liu, Changcheng
@ 2018-04-19 13:40 ` Eric Dumazet
2018-04-19 14:38 ` Liu, Changcheng
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2018-04-19 13:40 UTC (permalink / raw)
To: Liu, Changcheng, davem, kuznet, yoshfuji; +Cc: netdev, akpm
On 04/19/2018 04:26 AM, Liu, Changcheng wrote:
> Hit below panic due to skb is NULL, WARN wrong skb first.
> if __tcp_retransmit_skb return failure e.g. -EAGAIN, it
> needn't do further action in tcp_retransmit_skb.
>
> gdb vmlinux
> Reading symbols from vmlinux...done.
> (gdb) p &((struct tcp_skb_cb *) \
> &(((struct sk_buff *)0)->cb[0]))->tcp_gso_segs
> $1 = (u16 *) 0x30 <irq_stack_union+48>
>
> [ 9040.917533] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
> [ 9040.926279] IP: tcp_retransmit_skb+0x5c/0xc0
> [ 9040.931043] PGD 0 P4D 0
> [ 9040.933865] Oops: 0000 [#1] PREEMPT SMP PTI
> [ 9040.972151] RIP: 0010:tcp_retransmit_skb+0x5c/0xc0
> [ 9040.977496] RSP: 0018:ffff8802bec83e40 EFLAGS: 00010202
> [ 9041.062527] Call Trace:
> [ 9041.065250] <IRQ>
> [ 9041.067489] tcp_retransmit_timer+0x481/0x820
> [ 9041.077697] tcp_write_timer_handler+0xe9/0x230
> [ 9041.082751] tcp_write_timer+0x75/0x80
> [ 9041.086932] call_timer_fn+0x29/0x150
> [ 9041.091018] run_timer_softirq+0x411/0x460
> [ 9041.105017] __do_softirq+0x115/0x311
> [ 9041.109103] irq_exit+0xb0/0xc0
> [ 9041.112605] smp_apic_timer_interrupt+0x67/0x140
>
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
>
On which kernel have you seen this problem ?
In networking, we want patches with a 'Fixes:' tag to clearly identify which patch
added a regression.
Anyway your patch comes too late I guess
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=bffd168c3fc5cc7d2bad4c668fa90e7a9010db4b
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: deal wrong skb and failure ret from __tcp_retransmit_skb
2018-04-19 13:40 ` Eric Dumazet
@ 2018-04-19 14:38 ` Liu, Changcheng
0 siblings, 0 replies; 3+ messages in thread
From: Liu, Changcheng @ 2018-04-19 14:38 UTC (permalink / raw)
To: Eric Dumazet, davem, kuznet, yoshfuji; +Cc: netdev, akpm
On 06:40 Thu 19 Apr, Eric Dumazet wrote:
>
>
> On 04/19/2018 04:26 AM, Liu, Changcheng wrote:
> > Hit below panic due to skb is NULL, WARN wrong skb first.
> > if __tcp_retransmit_skb return failure e.g. -EAGAIN, it
> > needn't do further action in tcp_retransmit_skb.
> >
> > gdb vmlinux
> > Reading symbols from vmlinux...done.
> > (gdb) p &((struct tcp_skb_cb *) \
> > &(((struct sk_buff *)0)->cb[0]))->tcp_gso_segs
> > $1 = (u16 *) 0x30 <irq_stack_union+48>
> >
> > [ 9040.917533] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
> > [ 9040.926279] IP: tcp_retransmit_skb+0x5c/0xc0
> > [ 9040.931043] PGD 0 P4D 0
> > [ 9040.933865] Oops: 0000 [#1] PREEMPT SMP PTI
> > [ 9040.972151] RIP: 0010:tcp_retransmit_skb+0x5c/0xc0
> > [ 9040.977496] RSP: 0018:ffff8802bec83e40 EFLAGS: 00010202
> > [ 9041.062527] Call Trace:
> > [ 9041.065250] <IRQ>
> > [ 9041.067489] tcp_retransmit_timer+0x481/0x820
> > [ 9041.077697] tcp_write_timer_handler+0xe9/0x230
> > [ 9041.082751] tcp_write_timer+0x75/0x80
> > [ 9041.086932] call_timer_fn+0x29/0x150
> > [ 9041.091018] run_timer_softirq+0x411/0x460
> > [ 9041.105017] __do_softirq+0x115/0x311
> > [ 9041.109103] irq_exit+0xb0/0xc0
> > [ 9041.112605] smp_apic_timer_interrupt+0x67/0x140
> >
> > Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> >
>
> On which kernel have you seen this problem ?
[Changcheng]: My kernel is 4.16.0 Fearless Coyote
>
> In networking, we want patches with a 'Fixes:' tag to clearly identify which patch
> added a regression.
>
>
> Anyway your patch comes too late I guess
>
> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=bffd168c3fc5cc7d2bad4c668fa90e7a9010db4b
[Changcheng]: Check upstream master kernel(head: 87ef12027b9b1), patch
isn't merged yet. I'll check it in my side.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-19 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 11:26 [PATCH] net: deal wrong skb and failure ret from __tcp_retransmit_skb Liu, Changcheng
2018-04-19 13:40 ` Eric Dumazet
2018-04-19 14:38 ` Liu, Changcheng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.