Source-Changes-HG archive

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

[src/trunk]: src/sys/kern physio(9): Avoid left shift of negative in alignmen...



details:   https://anonhg.NetBSD.org/src/rev/df1d120e3fec
branches:  trunk
changeset: 368428:df1d120e3fec
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 10 23:11:55 2022 +0000

description:
physio(9): Avoid left shift of negative in alignment check.

Reported-by: syzbot+426b1db52f91ad2b994f%syzkaller.appspotmail.com@localhost
https://syzkaller.appspot.com/bug?id=f2456661792789db6d1c20e9d7e48db5c151d56d

diffstat:

 sys/kern/kern_physio.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 908d3a7d8e04 -r df1d120e3fec sys/kern/kern_physio.c
--- a/sys/kern/kern_physio.c    Sun Jul 10 21:32:09 2022 +0000
+++ b/sys/kern/kern_physio.c    Sun Jul 10 23:11:55 2022 +0000
@@ -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 @@
                                 * 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;
                                }



Home | Main Index | Thread Index | Old Index