Module Name: src Committed By: jdolecek Date: Mon Apr 13 20:02:27 UTC 2020
Modified Files: src/sys/miscfs/specfs: spec_vnops.c Log Message: when determining I/O block size for VBLK device, only use pi_bsize returned by DIOCGPARTINFO if it's bigger than DEV_BSIZE and less than MAXBSIZE (MAXPHYS) fixes panic "buf mem pool index 8" in buf_mempoolidx() when the disklabel contains bsize 128KB and something reads the block device - buffer cache can't allocate bufs bigger than MAXPHYS To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/sys/miscfs/specfs/spec_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/miscfs/specfs/spec_vnops.c diff -u src/sys/miscfs/specfs/spec_vnops.c:1.176 src/sys/miscfs/specfs/spec_vnops.c:1.177 --- src/sys/miscfs/specfs/spec_vnops.c:1.176 Sun Sep 22 22:59:39 2019 +++ src/sys/miscfs/specfs/spec_vnops.c Mon Apr 13 20:02:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.177 2020/04/13 20:02:27 jdolecek Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.177 2020/04/13 20:02:27 jdolecek Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -717,7 +717,7 @@ spec_read(void *v) return (EINVAL); if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0) - bsize = pi.pi_bsize; + bsize = imin(imax(pi.pi_bsize, DEV_BSIZE), MAXBSIZE); else bsize = BLKDEV_IOSIZE; @@ -786,7 +786,7 @@ spec_write(void *v) return (EINVAL); if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0) - bsize = pi.pi_bsize; + bsize = imin(imax(pi.pi_bsize, DEV_BSIZE), MAXBSIZE); else bsize = BLKDEV_IOSIZE;