[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] af_alg: avoid hangs when reading from streams
From: |
Bruno Haible |
Subject: |
Re: [PATCH] af_alg: avoid hangs when reading from streams |
Date: |
Sun, 24 Jun 2018 23:34:48 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-128-generic; KDE/5.18.0; x86_64; ; ) |
Hi Pádraig,
The patch looks good. Just nitpicking about the comments:
> + /* Either process a partial fread() from this loop,
> + or the fread() in afalg_stream may have gotten EOF.
> + We need to avoid a subsequent fread() due to glibc BZ 1190. */
We need to avoid a subsequent fread(), not only for glibc, but also on
platforms with SystemV heritage. [1]
> + /* Assume EOF is not sticky. See:
> + <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */
> + if (feof (stream))
You can't assume that EOF is not sticky, because per [1]
"BSDs always had sticky EOF". How about
/* Don't assume that EOF is sticky. See:
<https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */
Bruno
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=1190