Skip to content

Commit 77cd57e

Browse files
committed
MT#55283 fix stream close race condition
Using the stream object after dropping the reference is unsafe. Change-Id: I58df474272cc7e168d6d65e5f6ace3a42fe22ef1 (cherry picked from commit 9a3f33a)
1 parent d8dd863 commit 77cd57e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

kernel-module/nft_rtpengine.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,12 +1223,12 @@ static void stream_put(struct re_stream *stream) {
12231223
if (!stream)
12241224
return;
12251225

1226-
if (!atomic_dec_and_test(&stream->refcnt)) {
1227-
/* if this is an open file being closed and there's a del_stream()
1228-
* waiting for us, we need to wake up the sleeping del_stream() */
1229-
wake_up_interruptible(&stream->close_wq);
1226+
/* if this is an open file being closed and there's a del_stream()
1227+
* waiting for us, we need to wake up the sleeping del_stream() */
1228+
wake_up_interruptible(&stream->close_wq);
1229+
1230+
if (!atomic_dec_and_test(&stream->refcnt))
12301231
return;
1231-
}
12321232

12331233
DBG("Freeing stream object\n");
12341234

0 commit comments

Comments
 (0)