Skip to contentSkip to conversation

9p fixes for QEMU 4.2-rc3

GIT PULL Applied Greg Kurz 2 participants 3 messages Nov 23, 2019 – Nov 25, 2019

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

The following changes since commit 2061735ff09f9d5e67c501a96227b470e7de69b1:

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2019-11-21 17:18:40 +0000)

are available in the Git repository at:

https://github.com/gkurz/qemu.git tags/9p-fix-2019-11-23

for you to fetch changes up to 68d654daee4364a0eca589a547d716084d9cb33d:

9pfs: Fix divide by zero bug (2019-11-23 15:51:48 +0100)

----------------------------------------------------------------
9pfs fixes for QEMU 4.2

This fixes a potential QEMU crash if the underlying filesystem returns a null block size in statfs().

----------------------------------------------------------------
Dan Schatzberg (1):
9pfs: Fix divide by zero bug

 hw/9pfs/9p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.0
author
#1 lore raw

[PULL 1/1] 9pfs: Fix divide by zero bug

From: Dan Schatzberg <[email protected]>

Some filesystems may return 0s in statfs (trivially, a FUSE filesystem can do so). QEMU should handle this gracefully and just behave the same as if statfs failed.

---
 hw/9pfs/9p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/9pfs/9p.c +4 -2
index 37abcdb71ec0..520177f40c17 100644
@@ -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;
Signature · 1 line
2.21.0
#2 lore raw
In reply to Greg Kurz
Quoted 19 lines · Greg Kurz

The following changes since commit 2061735ff09f9d5e67c501a96227b470e7de69b1:

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2019-11-21 17:18:40 +0000)

are available in the Git repository at:

https://github.com/gkurz/qemu.git tags/9p-fix-2019-11-23

for you to fetch changes up to 68d654daee4364a0eca589a547d716084d9cb33d:

9pfs: Fix divide by zero bug (2019-11-23 15:51:48 +0100)

----------------------------------------------------------------
9pfs fixes for QEMU 4.2

This fixes a potential QEMU crash if the underlying filesystem returns a null block size in statfs().

Quoted 8 lines

----------------------------------------------------------------
Dan Schatzberg (1):
9pfs: Fix divide by zero bug

 hw/9pfs/9p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--
2.21.0

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM