summaryrefslogtreecommitdiff
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-03-08 10:49:43 +0100
committerTakashi Iwai <tiwai@suse.de>2016-03-08 10:49:43 +0100
commit56d94d70398f0fbb1863a03a145db1a86f009a71 (patch)
tree9e52dc537f8f8359c70b66f5000192bb280b41b9 /net/sctp/socket.c
parentbb63f726f98bec032c7322a9c36eb4167307d856 (diff)
parentfc4f000bf8c0cbf38f44de6bd5e225574e572ed4 (diff)
Merge branch 'topic/hda' into for-next
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 5ca2ebfe0be8..e878da0949db 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5538,6 +5538,7 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
struct sctp_hmac_algo_param *hmacs;
__u16 data_len = 0;
u32 num_idents;
+ int i;
if (!ep->auth_enable)
return -EACCES;
@@ -5555,8 +5556,12 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
return -EFAULT;
if (put_user(num_idents, &p->shmac_num_idents))
return -EFAULT;
- if (copy_to_user(p->shmac_idents, hmacs->hmac_ids, data_len))
- return -EFAULT;
+ for (i = 0; i < num_idents; i++) {
+ __u16 hmacid = ntohs(hmacs->hmac_ids[i]);
+
+ if (copy_to_user(&p->shmac_idents[i], &hmacid, sizeof(__u16)))
+ return -EFAULT;
+ }
return 0;
}