|
@@ -1958,6 +1958,8 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
|
|
|
|
|
|
/* Now send the (possibly) fragmented message. */
|
|
/* Now send the (possibly) fragmented message. */
|
|
list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
|
|
list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
|
|
|
|
+ sctp_chunk_hold(chunk);
|
|
|
|
+
|
|
/* Do accounting for the write space. */
|
|
/* Do accounting for the write space. */
|
|
sctp_set_owner_w(chunk);
|
|
sctp_set_owner_w(chunk);
|
|
|
|
|
|
@@ -1970,13 +1972,15 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
|
|
* breaks.
|
|
* breaks.
|
|
*/
|
|
*/
|
|
err = sctp_primitive_SEND(net, asoc, datamsg);
|
|
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;
|
|
err = msg_len;
|
|
|
|
|
|
if (unlikely(wait_connect)) {
|
|
if (unlikely(wait_connect)) {
|