From owner-freebsd-scsi Mon May 24 1:54: 2 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from relay1.mail.uk.psi.net (relay1.mail.uk.psi.net [154.32.105.6]) by hub.freebsd.org (Postfix) with ESMTP id 931BF14D26 for ; Mon, 24 May 1999 01:53:59 -0700 (PDT) (envelope-from amobbs@allstor-sw.co.uk) Received: from mail.plasmon.co.uk ([193.115.5.217]) by relay1.mail.uk.psi.net with smtp (Exim 2.02 #3) id 10lqUb-0003Vb-00 for freebsd-scsi@freebsd.org; Mon, 24 May 1999 09:53:53 +0100 Received: by mail.plasmon.co.uk(Lotus SMTP MTA v4.6.3 (778.2 1-4-1999)) id 8025677B.00309C00 ; Mon, 24 May 1999 09:50:56 +0100 X-Lotus-FromDomain: PLASNOTES From: amobbs@allstor-sw.co.uk To: freebsd-scsi@freebsd.org Message-ID: <8025677B.00309A45.00@mail.plasmon.co.uk> Date: Mon, 24 May 1999 09:50:51 +0100 Subject: Bug in cam_periph.c Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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