svn commit: r367449 - in stable: 11/sys/kern 12/sys/kern

2020-11-07 Thread John Baldwin
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/12/sys/kern/vfs_aio.c
Directory Properties:
  stable/12/   (props changed)

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

Modified: stable/12/sys/kern/vfs_aio.c
==
--- stable/12/sys/kern/vfs_aio.cSat Nov  7 15:38:01 2020
(r367448)
+++ stable/12/sys/kern/vfs_aio.cSat Nov  7 16:20:37 2020
(r367449)
@@ -1278,7 +1278,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;
@@ -1288,7 +1287,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;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367449 - in stable: 11/sys/kern 12/sys/kern

2020-11-07 Thread John Baldwin
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.cSat Nov  7 15:38:01 2020
(r367448)
+++ stable/11/sys/kern/vfs_aio.cSat 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;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"