Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Nov 2020 16:20:38 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r367449 - in stable: 11/sys/kern 12/sys/kern
Message-ID:  <202011071620.0A7GKcQT067333@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat Nov  7 16:20:37 2020
New Revision: 367449
URL: https://svnweb.freebsd.org/changeset/base/367449

Log:
  MFC 366296: Avoid a dubious assignment to bio_data in aio_qbio().
  
  A user pointer is not a suitable value for bio_data and the next block
  of code always overwrites bio_data anyway.  Just use cb->aio_buf
  directly in the call to vm_fault_quick_hold_pages().

Modified:
  stable/11/sys/kern/vfs_aio.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/kern/vfs_aio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/kern/vfs_aio.c
==============================================================================
--- stable/11/sys/kern/vfs_aio.c	Sat Nov  7 15:38:01 2020	(r367448)
+++ stable/11/sys/kern/vfs_aio.c	Sat Nov  7 16:20:37 2020	(r367449)
@@ -1280,7 +1280,6 @@ aio_qbio(struct proc *p, struct kaiocb *job)
 	bp->bio_length = cb->aio_nbytes;
 	bp->bio_bcount = cb->aio_nbytes;
 	bp->bio_done = aio_biowakeup;
-	bp->bio_data = (void *)(uintptr_t)cb->aio_buf;
 	bp->bio_offset = cb->aio_offset;
 	bp->bio_cmd = cb->aio_lio_opcode == LIO_WRITE ? BIO_WRITE : BIO_READ;
 	bp->bio_dev = dev;
@@ -1290,7 +1289,7 @@ aio_qbio(struct proc *p, struct kaiocb *job)
 	if (cb->aio_lio_opcode == LIO_READ)
 		prot |= VM_PROT_WRITE;	/* Less backwards than it looks */
 	job->npages = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map,
-	    (vm_offset_t)bp->bio_data, bp->bio_length, prot, job->pages,
+	    (vm_offset_t)cb->aio_buf, bp->bio_length, prot, job->pages,
 	    nitems(job->pages));
 	if (job->npages < 0) {
 		error = EFAULT;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011071620.0A7GKcQT067333>