diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 634a2abb5f3a..2625eccb77d5 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -162,7 +162,7 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk) | |||
162 | 162 | ||
163 | chunk->skb->destructor = sctp_wfree; | 163 | chunk->skb->destructor = sctp_wfree; |
164 | /* Save the chunk pointer in skb for sctp_wfree to use later. */ | 164 | /* Save the chunk pointer in skb for sctp_wfree to use later. */ |
165 | *((struct sctp_chunk **)(chunk->skb->cb)) = chunk; | 165 | skb_shinfo(chunk->skb)->destructor_arg = chunk; |
166 | 166 | ||
167 | asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk) + | 167 | asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk) + |
168 | sizeof(struct sk_buff) + | 168 | sizeof(struct sk_buff) + |
@@ -1947,7 +1947,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | /* Break the message into multiple chunks of maximum size. */ | 1949 | /* Break the message into multiple chunks of maximum size. */ |
1950 | datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len); | 1950 | datamsg = sctp_datamsg_from_user(asoc, sinfo, &msg->msg_iter); |
1951 | if (IS_ERR(datamsg)) { | 1951 | if (IS_ERR(datamsg)) { |
1952 | err = PTR_ERR(datamsg); | 1952 | err = PTR_ERR(datamsg); |
1953 | goto out_free; | 1953 | goto out_free; |
@@ -2095,7 +2095,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
2095 | if (copied > len) | 2095 | if (copied > len) |
2096 | copied = len; | 2096 | copied = len; |
2097 | 2097 | ||
2098 | err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); | 2098 | err = skb_copy_datagram_msg(skb, 0, msg, copied); |
2099 | 2099 | ||
2100 | event = sctp_skb2event(skb); | 2100 | event = sctp_skb2event(skb); |
2101 | 2101 | ||
@@ -6592,8 +6592,7 @@ static int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs) | |||
6592 | struct cmsghdr *cmsg; | 6592 | struct cmsghdr *cmsg; |
6593 | struct msghdr *my_msg = (struct msghdr *)msg; | 6593 | struct msghdr *my_msg = (struct msghdr *)msg; |
6594 | 6594 | ||
6595 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; | 6595 | for_each_cmsghdr(cmsg, my_msg) { |
6596 | cmsg = CMSG_NXTHDR(my_msg, cmsg)) { | ||
6597 | if (!CMSG_OK(my_msg, cmsg)) | 6596 | if (!CMSG_OK(my_msg, cmsg)) |
6598 | return -EINVAL; | 6597 | return -EINVAL; |
6599 | 6598 | ||
@@ -6870,14 +6869,10 @@ static void sctp_wake_up_waiters(struct sock *sk, | |||
6870 | */ | 6869 | */ |
6871 | static void sctp_wfree(struct sk_buff *skb) | 6870 | static void sctp_wfree(struct sk_buff *skb) |
6872 | { | 6871 | { |
6873 | struct sctp_association *asoc; | 6872 | struct sctp_chunk *chunk = skb_shinfo(skb)->destructor_arg; |
6874 | struct sctp_chunk *chunk; | 6873 | struct sctp_association *asoc = chunk->asoc; |
6875 | struct sock *sk; | 6874 | struct sock *sk = asoc->base.sk; |
6876 | 6875 | ||
6877 | /* Get the saved chunk pointer. */ | ||
6878 | chunk = *((struct sctp_chunk **)(skb->cb)); | ||
6879 | asoc = chunk->asoc; | ||
6880 | sk = asoc->base.sk; | ||
6881 | asoc->sndbuf_used -= SCTP_DATA_SNDSIZE(chunk) + | 6876 | asoc->sndbuf_used -= SCTP_DATA_SNDSIZE(chunk) + |
6882 | sizeof(struct sk_buff) + | 6877 | sizeof(struct sk_buff) + |
6883 | sizeof(struct sctp_chunk); | 6878 | sizeof(struct sctp_chunk); |