Module Name: src Committed By: riastradh Date: Sun Jul 10 23:11:55 UTC 2022
Modified Files: src/sys/kern: kern_physio.c Log Message: physio(9): Avoid left shift of negative in alignment check. Reported-by: syzbot+426b1db52f91ad2b9...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=f2456661792789db6d1c20e9d7e48db5c151d56d To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/kern/kern_physio.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/kern/kern_physio.c diff -u src/sys/kern/kern_physio.c:1.101 src/sys/kern/kern_physio.c:1.102 --- src/sys/kern/kern_physio.c:1.101 Thu Jun 30 01:52:29 2022 +++ src/sys/kern/kern_physio.c Sun Jul 10 23:11:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_physio.c,v 1.101 2022/06/30 01:52:29 riastradh Exp $ */ +/* $NetBSD: kern_physio.c,v 1.102 2022/07/10 23:11:55 riastradh Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.101 2022/06/30 01:52:29 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.102 2022/07/10 23:11:55 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -308,7 +308,7 @@ physio(void (*strategy)(struct buf *), s * aligned, the block addresses are used to track * errors of finished requests. */ - if (dbtob(bp->b_blkno) != uio->uio_offset) { + if (uio->uio_offset & (DEV_BSIZE - 1)) { error = EINVAL; goto done; }