Skip to contentSkip to conversation

tipc: fix potential bug in function tipc_backlog_rcv

PATCH Applied Jon Maloy 2 participants 2 messages Jun 9, 2014 – Jun 11, 2014

Subsystems (3)
lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: fix potential bug in function tipc_backlog_rcv

In commit 4f4482dcd9a0606a30541ff165ddaca64748299b ("tipc: compensate for double accounting in socket rcv buffer") we access 'truesize' of a received buffer after it might have been released by the function filter_rcv().

In this commit we correct this by reading the value of 'truesize' to the stack before delivering the buffer to filter_rcv().

---
 net/tipc/socket.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/tipc/socket.c +3 -2
index 08d87fc..ef04755 100644
@@ -1,5 +1,5 @@
 /*
-* net/tipc/socket.c: TIPC socket API
+ * net/tipc/socket.c: TIPC socket API
  *
  * Copyright (c) 2001-2007, 2012-2014, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2013, Wind River Systems
@@ -1431,13 +1431,14 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *buf)
 {
 	u32 res;
 	struct tipc_sock *tsk = tipc_sk(sk);
+	uint truesize = buf->truesize;
 
 	res = filter_rcv(sk, buf);
 	if (unlikely(res))
 		tipc_reject_msg(buf, res);
 
 	if (atomic_read(&tsk->dupl_rcvcnt) < TIPC_CONN_OVERLOAD_LIMIT)
-		atomic_add(buf->truesize, &tsk->dupl_rcvcnt);
+		atomic_add(truesize, &tsk->dupl_rcvcnt);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Mon, 9 Jun 2014 11:08:18 -0500

Quoted 9 lines

In commit 4f4482dcd9a0606a30541ff165ddaca64748299b ("tipc: compensate for double accounting in socket rcv buffer") we access 'truesize' of a received buffer after it might have been released by the function filter_rcv().

In this commit we correct this by reading the value of 'truesize' to the stack before delivering the buffer to filter_rcv().

Applied.