projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sctp: free msg->chunks when sctp_primitive_SEND return err
[cascardo/linux.git]
/
net
/
sctp
/
socket.c
diff --git
a/net/sctp/socket.c
b/net/sctp/socket.c
index
9fc417a
..
6cdc61c
100644
(file)
--- a/
net/sctp/socket.c
+++ b/
net/sctp/socket.c
@@
-1958,6
+1958,8
@@
static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
/* Now send the (possibly) fragmented message. */
list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
/* Now send the (possibly) fragmented message. */
list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
+ sctp_chunk_hold(chunk);
+
/* Do accounting for the write space. */
sctp_set_owner_w(chunk);
/* Do accounting for the write space. */
sctp_set_owner_w(chunk);
@@
-1970,13
+1972,15
@@
static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
* breaks.
*/
err = sctp_primitive_SEND(net, asoc, datamsg);
* breaks.
*/
err = sctp_primitive_SEND(net, asoc, datamsg);
- sctp_datamsg_put(datamsg);
/* Did the lower layer accept the chunk? */
/* Did the lower layer accept the chunk? */
- if (err)
+ if (err) {
+ sctp_datamsg_free(datamsg);
goto out_free;
goto out_free;
+ }
pr_debug("%s: we sent primitively\n", __func__);
pr_debug("%s: we sent primitively\n", __func__);
+ sctp_datamsg_put(datamsg);
err = msg_len;
if (unlikely(wait_connect)) {
err = msg_len;
if (unlikely(wait_connect)) {