[PATCH] super1: fix truncation check for journal device

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

 



The journal device can be smaller than the component devices.

Fixes: 171e9743881e ("super1: report truncated device")
Signed-off-by: Hristo Venev <hristo@xxxxxxxxxx>
---
 super1.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/super1.c b/super1.c
index f7020320..44d6ecad 100644
--- a/super1.c
+++ b/super1.c
@@ -2359,8 +2359,9 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 
 	if (st->minor_version >= 1 &&
 	    st->ignore_hw_compat == 0 &&
-	    (dsize < (__le64_to_cpu(super->data_offset) +
-		      __le64_to_cpu(super->size))
+	    ((role_from_sb(super) != MD_DISK_ROLE_JOURNAL &&
+		  dsize < (__le64_to_cpu(super->data_offset) +
+		      __le64_to_cpu(super->size)))
 	     ||
 	     dsize < (__le64_to_cpu(super->data_offset) +
 		      __le64_to_cpu(super->data_size)))) {
-- 
2.40.0




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux