hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/net/sctp/stream_sched_prio.c
....@@ -1,25 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* SCTP kernel implementation
23 * (C) Copyright Red Hat Inc. 2017
34 *
45 * This file is part of the SCTP kernel implementation
56 *
67 * These functions manipulate sctp stream queue/scheduling.
7
- *
8
- * This SCTP implementation is free software;
9
- * you can redistribute it and/or modify it under the terms of
10
- * the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2, or (at your option)
12
- * any later version.
13
- *
14
- * This SCTP implementation is distributed in the hope that it
15
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16
- * ************************
17
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
- * See the GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with GNU CC; see the file COPYING. If not, see
22
- * <http://www.gnu.org/licenses/>.
238 *
249 * Please send any bug reports or fixes you make to the
2510 * email addresched(es):
....@@ -219,6 +204,24 @@
219204 return sctp_sched_prio_set(stream, sid, 0, gfp);
220205 }
221206
207
+static void sctp_sched_prio_free_sid(struct sctp_stream *stream, __u16 sid)
208
+{
209
+ struct sctp_stream_priorities *prio = SCTP_SO(stream, sid)->ext->prio_head;
210
+ int i;
211
+
212
+ if (!prio)
213
+ return;
214
+
215
+ SCTP_SO(stream, sid)->ext->prio_head = NULL;
216
+ for (i = 0; i < stream->outcnt; i++) {
217
+ if (SCTP_SO(stream, i)->ext &&
218
+ SCTP_SO(stream, i)->ext->prio_head == prio)
219
+ return;
220
+ }
221
+
222
+ kfree(prio);
223
+}
224
+
222225 static void sctp_sched_prio_free(struct sctp_stream *stream)
223226 {
224227 struct sctp_stream_priorities *prio, *n;
....@@ -338,6 +341,7 @@
338341 .get = sctp_sched_prio_get,
339342 .init = sctp_sched_prio_init,
340343 .init_sid = sctp_sched_prio_init_sid,
344
+ .free_sid = sctp_sched_prio_free_sid,
341345 .free = sctp_sched_prio_free,
342346 .enqueue = sctp_sched_prio_enqueue,
343347 .dequeue = sctp_sched_prio_dequeue,