linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sctp: make sctp_setsockopt_events() less strict about the option length
@ 2019-02-06 20:14 Julien Gomes
  2019-02-06 20:37 ` Marcelo Ricardo Leitner
  2019-02-06 20:49 ` Neil Horman
  0 siblings, 2 replies; 26+ messages in thread
From: Julien Gomes @ 2019-02-06 20:14 UTC (permalink / raw)
  To: netdev, linux-sctp, linux-kernel
  Cc: davem, marcelo.leitner, nhorman, vyasevich, lucien.xin, Julien Gomes

Make sctp_setsockopt_events() able to accept sctp_event_subscribe
structures longer than the current definitions.

This should prevent unjustified setsockopt() failures due to struct
sctp_event_subscribe extensions (as in 4.11 and 4.12) when using
binaries that should be compatible, but were built with later kernel
uapi headers.

Signed-off-by: Julien Gomes <julien@arista.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 9644bdc8e85c..f9717e2789da 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2311,7 +2311,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
 	int i;
 
 	if (optlen > sizeof(struct sctp_event_subscribe))
-		return -EINVAL;
+		optlen = sizeof(struct sctp_event_subscribe);
 
 	if (copy_from_user(&subscribe, optval, optlen))
 		return -EFAULT;
-- 
2.20.1


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

end of thread, other threads:[~2019-02-13 17:23 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 20:14 [PATCH net] sctp: make sctp_setsockopt_events() less strict about the option length Julien Gomes
2019-02-06 20:37 ` Marcelo Ricardo Leitner
2019-02-06 20:48   ` Julien Gomes
2019-02-06 21:07     ` Marcelo Ricardo Leitner
2019-02-06 21:23       ` Neil Horman
2019-02-06 21:48         ` Julien Gomes
2019-02-07 14:44           ` Neil Horman
2019-02-06 21:26       ` Julien Gomes
2019-02-06 21:39         ` Neil Horman
2019-02-06 21:48           ` Julien Gomes
2019-02-06 21:53             ` Julien Gomes
2019-02-07 14:48             ` Neil Horman
2019-02-07 17:33       ` David Laight
2019-02-07 17:47         ` 'Marcelo Ricardo Leitner'
2019-02-08  9:53           ` David Laight
2019-02-08 12:36             ` Neil Horman
2019-02-06 21:08     ` Neil Horman
2019-02-06 21:18       ` Marcelo Ricardo Leitner
2019-02-09 23:12   ` David Miller
2019-02-10 12:46     ` Marcelo Ricardo Leitner
2019-02-10 20:15       ` Marcelo Ricardo Leitner
2019-02-13 16:17         ` David Laight
2019-02-13 17:23           ` 'Marcelo Ricardo Leitner'
2019-02-11 15:04       ` Neil Horman
2019-02-11 17:05         ` Marcelo Ricardo Leitner
2019-02-06 20:49 ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).