* [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream()
@ 2020-05-28 14:34 YueHaibing
2020-06-01 18:34 ` David Miller
2020-06-01 22:35 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2020-05-28 14:34 UTC (permalink / raw)
To: jmaloy, ying.xue, davem, kuba, tuong.t.lien
Cc: netdev, tipc-discussion, linux-kernel, YueHaibing
tipc_sendstream() may send zero length packet, then tipc_msg_append()
do not alloc skb, skb_peek_tail() will get NULL, msg_set_ack_required
will trigger NULL pointer dereference.
Reported-by: syzbot+8eac6d030e7807c21d32@syzkaller.appspotmail.com
Fixes: 0a3e060f340d ("tipc: add test for Nagle algorithm effectiveness")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
net/tipc/socket.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d6b67d07d22e..2943561399f1 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1588,8 +1588,12 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen)
tsk->pkt_cnt += skb_queue_len(txq);
} else {
skb = skb_peek_tail(txq);
- msg_set_ack_required(buf_msg(skb));
- tsk->expect_ack = true;
+ if (skb) {
+ msg_set_ack_required(buf_msg(skb));
+ tsk->expect_ack = true;
+ } else {
+ tsk->expect_ack = false;
+ }
tsk->msg_acc = 0;
tsk->pkt_cnt = 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream()
2020-05-28 14:34 [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream() YueHaibing
@ 2020-06-01 18:34 ` David Miller
2020-06-01 22:35 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-06-01 18:34 UTC (permalink / raw)
To: yuehaibing
Cc: jmaloy, ying.xue, kuba, tuong.t.lien, netdev, tipc-discussion,
linux-kernel
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 28 May 2020 22:34:07 +0800
> tipc_sendstream() may send zero length packet, then tipc_msg_append()
> do not alloc skb, skb_peek_tail() will get NULL, msg_set_ack_required
> will trigger NULL pointer dereference.
>
> Reported-by: syzbot+8eac6d030e7807c21d32@syzkaller.appspotmail.com
> Fixes: 0a3e060f340d ("tipc: add test for Nagle algorithm effectiveness")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Can a TIPC expert please review this?
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream()
2020-05-28 14:34 [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream() YueHaibing
2020-06-01 18:34 ` David Miller
@ 2020-06-01 22:35 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-06-01 22:35 UTC (permalink / raw)
To: yuehaibing
Cc: jmaloy, ying.xue, kuba, tuong.t.lien, netdev, tipc-discussion,
linux-kernel
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 28 May 2020 22:34:07 +0800
> tipc_sendstream() may send zero length packet, then tipc_msg_append()
> do not alloc skb, skb_peek_tail() will get NULL, msg_set_ack_required
> will trigger NULL pointer dereference.
>
> Reported-by: syzbot+8eac6d030e7807c21d32@syzkaller.appspotmail.com
> Fixes: 0a3e060f340d ("tipc: add test for Nagle algorithm effectiveness")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
I spent some time reading this a few times and the Fixes: commit and
this change looks ok to me so I'm just going to apply this.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-01 22:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 14:34 [PATCH net-next] tipc: Fix NULL pointer dereference in __tipc_sendstream() YueHaibing
2020-06-01 18:34 ` David Miller
2020-06-01 22:35 ` David Miller
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.