Skip to content

Commit 5dc8976

Browse files
gvrose8192PlaidCat
authored andcommitted
Revert "sctp: leave the err path free in sctp_stream_init to sctp_stream_free"
jira SECO-124 This reverts commit 206a79d2791854e8a3e06c44e89cde26361b1da3. Incorrect patch for sctp that depends on underlying changes in sctp_stream_alloc_in(), which are not there in 4.18.x. Causes a regression in sctp streams. Signed-off-by: Greg Rose <[email protected]>
1 parent daae73f commit 5dc8976

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

net/sctp/associola.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ static struct sctp_association *sctp_association_init(
244244
if (!sctp_ulpq_init(&asoc->ulpq, asoc))
245245
goto fail_init;
246246

247-
if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams, 0, gfp))
248-
goto stream_free;
247+
if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams,
248+
0, gfp))
249+
goto fail_init;
249250

250251
/* Initialize default path MTU. */
251252
asoc->pathmtu = sp->pathmtu;

net/sctp/stream.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
170170

171171
ret = sctp_stream_alloc_out(stream, outcnt, gfp);
172172
if (ret)
173-
return ret;
173+
goto out;
174174

175175
stream->outcnt = outcnt;
176176
for (i = 0; i < stream->outcnt; i++)
@@ -179,9 +179,21 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
179179
in:
180180
sctp_stream_interleave_init(stream);
181181
if (!incnt)
182-
return 0;
182+
goto out;
183183

184-
return sctp_stream_alloc_in(stream, incnt, gfp);
184+
ret = sctp_stream_alloc_in(stream, incnt, gfp);
185+
if (ret) {
186+
sched->free(stream);
187+
kfree(stream->out);
188+
stream->out = NULL;
189+
stream->outcnt = 0;
190+
goto out;
191+
}
192+
193+
stream->incnt = incnt;
194+
195+
out:
196+
return ret;
185197
}
186198

187199
int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid)

0 commit comments

Comments
 (0)