qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] block/blklogwrites: Make sure the log sector si


From: Ari Sundholm
Subject: Re: [Qemu-devel] [PATCH] block/blklogwrites: Make sure the log sector size is not too small
Date: Mon, 9 Jul 2018 18:01:41 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Would there be a chance of getting this included in 3.0?

On 07/06/2018 03:00 PM, Ari Sundholm wrote:
The sector size needs to be large enough to accommodate the data
structures for the log super block and log write entries. This was
previously not properly checked, which made it possible to cause
QEMU to badly misbehave.

Signed-off-by: Ari Sundholm <address@hidden>
---
  block/blklogwrites.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/blklogwrites.c b/block/blklogwrites.c
index 63bf6b3..efa2c7a 100644
--- a/block/blklogwrites.c
+++ b/block/blklogwrites.c
@@ -89,7 +89,10 @@ static inline uint32_t blk_log_writes_log2(uint32_t value)
static inline bool blk_log_writes_sector_size_valid(uint32_t sector_size)
  {
-    return sector_size < (1ull << 24) && is_power_of_2(sector_size);
+    return is_power_of_2(sector_size) &&
+        sector_size >= sizeof(struct log_write_super) &&
+        sector_size >= sizeof(struct log_write_entry) &&
+        sector_size < (1ull << 24);
  }
static uint64_t blk_log_writes_find_cur_log_sector(BdrvChild *log,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]