Netdev List
 help / color / mirror / Atom feed
* [PATCH net] sctp: fix sockopt size check
@ 2015-07-28 14:16 Marcelo Ricardo Leitner
  2015-07-30  0:07 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-07-28 14:16 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Yasevich

The problem is not on being bigger than what we want, but on being
smaller, as it causes read of invalid memory.

Note that the struct changes on commit 7e8616d8e773 didn't affect
sctp_setsockopt_events one but that's where this check was flipped.

Fixes: 7e8616d8e773 ("[SCTP]: Update AUTH structures to match
declarations in draft-16.")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1425ec2bbd5ae359a8e0408a89a6da6bb60bd87e..6c4f0dac2104d38ba6420ce6740224866a2ece82 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2195,7 +2195,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
 	struct sctp_association *asoc;
 	struct sctp_ulpevent *event;
 
-	if (optlen > sizeof(struct sctp_event_subscribe))
+	if (optlen < sizeof(struct sctp_event_subscribe))
 		return -EINVAL;
 	if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
 		return -EFAULT;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-30 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 14:16 [PATCH net] sctp: fix sockopt size check Marcelo Ricardo Leitner
2015-07-30  0:07 ` David Miller
2015-07-30 12:00   ` Marcelo Ricardo Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox