Skip to content

Commit ab921f3

Browse files
david-laightdavem330
authored andcommitted
net: sctp: Fix negotiation of the number of data streams.
The number of output and input streams was never being reduced, eg when processing received INIT or INIT_ACK chunks. The effect is that DATA chunks can be sent with invalid stream ids and then discarded by the remote system. Fixes: 2075e50 ("sctp: convert to genradix") Signed-off-by: David Laight <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 41506bf commit ab921f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/sctp/stream.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt,
8888
int ret;
8989

9090
if (outcnt <= stream->outcnt)
91-
return 0;
91+
goto out;
9292

9393
ret = genradix_prealloc(&stream->out, outcnt, gfp);
9494
if (ret)
9595
return ret;
9696

97+
out:
9798
stream->outcnt = outcnt;
9899
return 0;
99100
}
@@ -104,12 +105,13 @@ static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt,
104105
int ret;
105106

106107
if (incnt <= stream->incnt)
107-
return 0;
108+
goto out;
108109

109110
ret = genradix_prealloc(&stream->in, incnt, gfp);
110111
if (ret)
111112
return ret;
112113

114+
out:
113115
stream->incnt = incnt;
114116
return 0;
115117
}

0 commit comments

Comments
 (0)