Skip to content

Commit

Permalink
[TIPC] Fix for NULL pointer dereference
Browse files Browse the repository at this point in the history
This fixes a bug spotted by the coverity checker, bug id #366. If
(mod(seqno - prev) != 1) we set buf to NULL, dereference it in the for
case, and set it to whatever value happes to be at adress 0+next, if it
happens to be non-zero, we even stay in the loop. It seems that the author
intended to break there.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Sesterhenn authored and David S. Miller committed Jun 26, 2006
1 parent a4e0927 commit 3ac9021
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/tipc/bcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g
for (; buf; buf = buf->next) {
u32 seqno = buf_seqno(buf);

if (mod(seqno - prev) != 1)
if (mod(seqno - prev) != 1) {
buf = NULL;
break;
}
if (seqno == gap_after)
break;
prev = seqno;
Expand Down

0 comments on commit 3ac9021

Please sign in to comment.