diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-11-25 13:39:45 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-11-25 13:39:45 +0000 |
commit | 122e6d2a9c1bf8aa1d51409c15809a82621515b1 (patch) | |
tree | 206d0160ee0205abaaa695575cbac7ecb005c82a /hw | |
parent | 2061735ff09f9d5e67c501a96227b470e7de69b1 (diff) | |
parent | 68d654daee4364a0eca589a547d716084d9cb33d (diff) |
Merge remote-tracking branch 'remotes/gkurz/tags/9p-fix-2019-11-23' into staging
9pfs fixes for QEMU 4.2
This fixes a potential QEMU crash if the underlying filesystem returns
a null block size in statfs().
# gpg: Signature made Sat 23 Nov 2019 15:19:36 GMT
# gpg: using RSA key B4828BAF943140CEF2A3491071D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <groug@kaod.org>" [full]
# gpg: aka "Gregory Kurz <gregory.kurz@free.fr>" [full]
# gpg: aka "[jpeg image of size 3330]" [full]
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3 4910 71D4 D5E5 822F 73D6
* remotes/gkurz/tags/9p-fix-2019-11-23:
9pfs: Fix divide by zero bug
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/9pfs/9p.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 37abcdb71e..520177f40c 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1834,8 +1834,10 @@ static int32_t coroutine_fn get_iounit(V9fsPDU *pdu, V9fsPath *path) * and as well as less than (client msize - P9_IOHDRSZ)) */ if (!v9fs_co_statfs(pdu, path, &stbuf)) { - iounit = stbuf.f_bsize; - iounit *= (s->msize - P9_IOHDRSZ)/stbuf.f_bsize; + if (stbuf.f_bsize) { + iounit = stbuf.f_bsize; + iounit *= (s->msize - P9_IOHDRSZ) / stbuf.f_bsize; + } } if (!iounit) { iounit = s->msize - P9_IOHDRSZ; |