From owner-freebsd-usb@FreeBSD.ORG Fri Sep 19 15:34:38 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40593106566B for ; Fri, 19 Sep 2008 15:34:38 +0000 (UTC) (envelope-from zozo@q.gid0.org) Received: from smtp6-g19.free.fr (smtp6-g19.free.fr [212.27.42.36]) by mx1.freebsd.org (Postfix) with ESMTP id C9E9E8FC1D for ; Fri, 19 Sep 2008 15:34:37 +0000 (UTC) (envelope-from zozo@q.gid0.org) Received: from smtp6-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp6-g19.free.fr (Postfix) with ESMTP id 8E4ED17489 for ; Fri, 19 Sep 2008 17:34:36 +0200 (CEST) Received: from q.gid0.org (s.gid0.org [88.163.116.140]) by smtp6-g19.free.fr (Postfix) with ESMTP id 3157A17E82 for ; Fri, 19 Sep 2008 17:34:31 +0200 (CEST) Received: (from zozo@localhost) by q.gid0.org (8.14.3/8.14.3/Submit) id m8JFYGHI001211 for freebsd-usb@freebsd.org; Fri, 19 Sep 2008 17:34:16 +0200 (CEST) (envelope-from zozo) Date: Fri, 19 Sep 2008 17:34:16 +0200 From: Olivier Smedts To: freebsd-usb@freebsd.org Message-ID: <20080919153415.GA1178@q.gid0.org> References: <20080919145320.GA2444@q.gid0.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080919145320.GA2444@q.gid0.org> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [usb2] new usb stack and suser in CURRENT X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Sep 2008 15:34:38 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 19, 2008 at 04:53:22PM +0200, Olivier Smedts wrote: > Since the suser interface has been removed from HEAD > (http://www.freebsd.org/cgi/getmsg.cgi?fetch=284102+0+current/cvs-src) > I use the following patch to use the new usb2 stack with > latest CURRENT. Of course, PRIV_ROOT is not the right one to use, > see include/sys/priv.h. Attachment seems to have been removed. Retrying with a different content-type and disposition (mutt is so great). -- Olivier Smedts _ ASCII ribbon campaign ( ) e-mail: olivier at gid0.org - against HTML email & vCards X www: http://www.gid0.org - against proprietary attachments / \ "Il y a seulement 10 sortes de gens dans le monde : ceux qui comprennent le binaire, et ceux qui ne le comprennent pas." --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline; filename=diff Content-Transfer-Encoding: 8bit Index: i4b/src/sys/dev/usb2/core/usb2_dev.c =================================================================== --- i4b/src/sys/dev/usb2/core/usb2_dev.c (révision 880) +++ i4b/src/sys/dev/usb2/core/usb2_dev.c (copie de travail) @@ -262,7 +262,7 @@ int error; /* only super-user can set permissions */ - error = suser(curthread); + error = priv_check(curthread, PRIV_ROOT); if (error) { return (error); } Index: i4b/src/sys/dev/usb2/core/usb2_generic.c =================================================================== --- i4b/src/sys/dev/usb2/core/usb2_generic.c (révision 880) +++ i4b/src/sys/dev/usb2/core/usb2_generic.c (copie de travail) @@ -878,7 +878,7 @@ (req->bRequest == UR_SET_CONFIG)) || ((req->bmRequestType == UT_WRITE_INTERFACE) && (req->bRequest == UR_SET_INTERFACE))) { - if (suser(curthread)) { + if (priv_check(curthread, PRIV_ROOT)) { return (EPERM); } } @@ -887,7 +887,7 @@ * not update the data toggle value in "struct usb2_pipe" ! */ if (req->bmRequestType == UT_WRITE_ENDPOINT) { - if (suser(curthread)) { + if (priv_check(curthread, PRIV_ROOT)) { return (EPERM); } } @@ -946,7 +946,7 @@ /* control endpoint only */ return (EINVAL); } - if (suser(curthread)) { + if (priv_check(curthread, PRIV_ROOT)) { return (EPERM); } mtx_lock(f->priv_mtx); @@ -1738,7 +1738,7 @@ (udev->parent_hub == NULL)) { return (EINVAL); } - if (suser(curthread)) { + if (priv_check(curthread, PRIV_ROOT)) { return (EPERM); } switch (mode) { @@ -1805,7 +1805,7 @@ struct usb2_hub *hub; int err; - if (suser(curthread)) { + if (priv_check(curthread, PRIV_ROOT)) { return (EPERM); } if (port_no == 0) { @@ -2115,7 +2115,7 @@ case USB_IFACE_DRIVER_DETACH: /* TODO */ - if (suser(curthread)) + if (priv_check(curthread, PRIV_ROOT)) error = EPERM; else error = EINVAL; --BOKacYhQ+x31HxR3--