Skip to content

Commit 83469ae

Browse files
committed
gossmap: don't crash if we hit a zero-length record.
We have a report of this happening under ZFS. We cannot do much if this really is a problem where we can't read back what we write, but this avoids the immediate crash. Fixes: ElementsProject#7971 Signed-off-by: Rusty Russell <[email protected]>
1 parent 1f26e34 commit 83469ae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

common/gossmap.c

+5
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,11 @@ static bool map_catchup(struct gossmap *map, bool *changed)
701701
if (map->map_end + reclen > map->map_size)
702702
break;
703703

704+
/* Under zfs, apparently we can see zeroes here. I'm hoping this effect
705+
* is transient: hope to make progress next time */
706+
if (be16_to_cpu(ghdr.len) < sizeof(be16))
707+
break;
708+
704709
off = map->map_end + sizeof(ghdr);
705710
type = map_be16(map, off);
706711
if (type == WIRE_CHANNEL_ANNOUNCEMENT) {

0 commit comments

Comments
 (0)