mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
getblkx(9): be more tolerant but also strict with the buffer size checks
PR: 277414
(cherry picked from commit 7e4ac11b60
)
This commit is contained in:
parent
2feed11fbe
commit
1c1fde7540
1 changed files with 10 additions and 2 deletions
|
@ -3963,9 +3963,11 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int slpflag,
|
|||
("GB_KVAALLOC only makes sense with GB_UNMAPPED"));
|
||||
if (vp->v_type != VCHR)
|
||||
ASSERT_VOP_LOCKED(vp, "getblk");
|
||||
if (size > maxbcachebuf)
|
||||
panic("getblk: size(%d) > maxbcachebuf(%d)\n", size,
|
||||
if (size > maxbcachebuf) {
|
||||
printf("getblkx: size(%d) > maxbcachebuf(%d)\n", size,
|
||||
maxbcachebuf);
|
||||
return (EIO);
|
||||
}
|
||||
if (!unmapped_buf_allowed)
|
||||
flags &= ~(GB_UNMAPPED | GB_KVAALLOC);
|
||||
|
||||
|
@ -4132,6 +4134,12 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int slpflag,
|
|||
vmio = vp->v_object != NULL;
|
||||
if (vmio) {
|
||||
maxsize = size + (offset & PAGE_MASK);
|
||||
if (maxsize > maxbcachebuf) {
|
||||
printf(
|
||||
"getblkx: maxsize(%d) > maxbcachebuf(%d)\n",
|
||||
maxsize, maxbcachebuf);
|
||||
return (EIO);
|
||||
}
|
||||
} else {
|
||||
maxsize = size;
|
||||
/* Do not allow non-VMIO notmapped buffers. */
|
||||
|
|
Loading…
Reference in a new issue