diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-10-18 12:43:43 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-10-18 12:43:46 -0400 |
| commit | f2f108eb4511f22a6f7568090cfcf4e7b2dc0f62 (patch) | |
| tree | 4b75771ec02543372808c7df31a1a65e37fdb361 /net/sctp/socket.c | |
| parent | 756b0322e50aebc4b9afb4488a2d3f6c802b4e64 (diff) | |
| parent | 2b666ca4a68cbc22483b0f2e1ba3c0e59b01ae9e (diff) | |
Merge branch 'linus' into core/locking
Merge reason: Update to almost-final-.36
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'net/sctp/socket.c')
| -rw-r--r-- | net/sctp/socket.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index ca44917872d2..fbb70770ad05 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -916,6 +916,11 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, | |||
| 916 | /* Walk through the addrs buffer and count the number of addresses. */ | 916 | /* Walk through the addrs buffer and count the number of addresses. */ |
| 917 | addr_buf = kaddrs; | 917 | addr_buf = kaddrs; |
| 918 | while (walk_size < addrs_size) { | 918 | while (walk_size < addrs_size) { |
| 919 | if (walk_size + sizeof(sa_family_t) > addrs_size) { | ||
| 920 | kfree(kaddrs); | ||
| 921 | return -EINVAL; | ||
| 922 | } | ||
| 923 | |||
| 919 | sa_addr = (struct sockaddr *)addr_buf; | 924 | sa_addr = (struct sockaddr *)addr_buf; |
| 920 | af = sctp_get_af_specific(sa_addr->sa_family); | 925 | af = sctp_get_af_specific(sa_addr->sa_family); |
| 921 | 926 | ||
| @@ -1002,9 +1007,13 @@ static int __sctp_connect(struct sock* sk, | |||
| 1002 | /* Walk through the addrs buffer and count the number of addresses. */ | 1007 | /* Walk through the addrs buffer and count the number of addresses. */ |
| 1003 | addr_buf = kaddrs; | 1008 | addr_buf = kaddrs; |
| 1004 | while (walk_size < addrs_size) { | 1009 | while (walk_size < addrs_size) { |
| 1010 | if (walk_size + sizeof(sa_family_t) > addrs_size) { | ||
| 1011 | err = -EINVAL; | ||
| 1012 | goto out_free; | ||
| 1013 | } | ||
| 1014 | |||
| 1005 | sa_addr = (union sctp_addr *)addr_buf; | 1015 | sa_addr = (union sctp_addr *)addr_buf; |
| 1006 | af = sctp_get_af_specific(sa_addr->sa.sa_family); | 1016 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
| 1007 | port = ntohs(sa_addr->v4.sin_port); | ||
| 1008 | 1017 | ||
| 1009 | /* If the address family is not supported or if this address | 1018 | /* If the address family is not supported or if this address |
| 1010 | * causes the address buffer to overflow return EINVAL. | 1019 | * causes the address buffer to overflow return EINVAL. |
| @@ -1014,6 +1023,8 @@ static int __sctp_connect(struct sock* sk, | |||
| 1014 | goto out_free; | 1023 | goto out_free; |
| 1015 | } | 1024 | } |
| 1016 | 1025 | ||
| 1026 | port = ntohs(sa_addr->v4.sin_port); | ||
| 1027 | |||
| 1017 | /* Save current address so we can work with it */ | 1028 | /* Save current address so we can work with it */ |
| 1018 | memcpy(&to, sa_addr, af->sockaddr_len); | 1029 | memcpy(&to, sa_addr, af->sockaddr_len); |
| 1019 | 1030 | ||
