Skip to content

Commit 4c21daa

Browse files
YueHaibingdavem330
authored andcommitted
tipc: Fix NULL pointer dereference in __tipc_sendstream()
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: [email protected] Fixes: 0a3e060 ("tipc: add test for Nagle algorithm effectiveness") Signed-off-by: YueHaibing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eae9d3c commit 4c21daa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/tipc/socket.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,8 +1588,12 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen)
15881588
tsk->pkt_cnt += skb_queue_len(txq);
15891589
} else {
15901590
skb = skb_peek_tail(txq);
1591-
msg_set_ack_required(buf_msg(skb));
1592-
tsk->expect_ack = true;
1591+
if (skb) {
1592+
msg_set_ack_required(buf_msg(skb));
1593+
tsk->expect_ack = true;
1594+
} else {
1595+
tsk->expect_ack = false;
1596+
}
15931597
tsk->msg_acc = 0;
15941598
tsk->pkt_cnt = 0;
15951599
}

0 commit comments

Comments
 (0)