Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 1999 09:50:51 +0100
From:      amobbs@allstor-sw.co.uk
To:        freebsd-scsi@freebsd.org
Subject:   Bug in cam_periph.c
Message-ID:  <8025677B.00309A45.00@mail.plasmon.co.uk>

next in thread | raw e-mail | index | archive | help

It looks to me that the tests for useracc read/write permission in
cam_periph_mapmem are the wrong way around. Surely if the data direction is OUT,
you want to be able to read the memory, and if it's IN you need to be able to
write to the buffer. (He said, having tried to put a R/O mmap'd buffer through a
passthrough driver write with little success.)

(patch against -stable).

--- cam_periph.c.orig    Sun May 23 11:58:17 1999
+++ cam_periph.c    Sun May 23 12:00:31 1999
@@ -558,7 +558,7 @@
               return(E2BIG);
          }

-         if (dirs[i] & CAM_DIR_IN) {
+         if (dirs[i] & CAM_DIR_OUT) {
               flags[i] = B_READ;
               if (useracc(*data_ptrs[i], lengths[i], B_READ) == 0){
                    printf("cam_periph_mapmem: error, "
@@ -574,7 +574,7 @@
           * XXX this check is really bogus, since B_WRITE currently
           * is all 0's, and so it is "set" all the time.
           */
-         if (dirs[i] & CAM_DIR_OUT) {
+         if (dirs[i] & CAM_DIR_IN) {
               flags[i] |= B_WRITE;
               if (useracc(*data_ptrs[i], lengths[i], B_WRITE) == 0){
                    printf("cam_periph_mapmem: error, "





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8025677B.00309A45.00>