MT#55283 fix stream close race condition

Using the stream object after dropping the reference is unsafe.

Change-Id: I58df474272cc7e168d6d65e5f6ace3a42fe22ef1
(cherry picked from commit 9a3f33a703)
(cherry picked from commit efade36308)
mr14.0.1
Richard Fuchs 2 months ago
parent 51859e2fb7
commit 47405c3a16

@ -1215,12 +1215,12 @@ static void stream_put(struct re_stream *stream) {
if (!stream)
return;
if (!atomic_dec_and_test(&stream->refcnt)) {
/* if this is an open file being closed and there's a del_stream()
* waiting for us, we need to wake up the sleeping del_stream() */
wake_up_interruptible(&stream->close_wq);
/* if this is an open file being closed and there's a del_stream()
* waiting for us, we need to wake up the sleeping del_stream() */
wake_up_interruptible(&stream->close_wq);
if (!atomic_dec_and_test(&stream->refcnt))
return;
}
DBG("Freeing stream object\n");

Loading…
Cancel
Save