From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751015AbVLTNiE (ORCPT ); Tue, 20 Dec 2005 08:38:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751017AbVLTNiE (ORCPT ); Tue, 20 Dec 2005 08:38:04 -0500 Received: from ns.virtualhost.dk ([195.184.98.160]:51999 "EHLO virtualhost.dk") by vger.kernel.org with ESMTP id S1751015AbVLTNiC (ORCPT ); Tue, 20 Dec 2005 08:38:02 -0500 Date: Tue, 20 Dec 2005 14:39:39 +0100 From: Jens Axboe To: Ben Collins Cc: john stultz , lkml , greg@kroah.com Subject: Re: [RFC] Let non-root users eject their ipods? Message-ID: <20051220133939.GI3734@suse.de> References: <1135047119.8407.24.camel@leatherman> <20051220074652.GW3734@suse.de> <1135082490.16754.0.camel@localhost.localdomain> <20051220132821.GH3734@suse.de> <1135085557.16754.2.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1135085557.16754.2.camel@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 20 2005, Ben Collins wrote: > On Tue, 2005-12-20 at 14:28 +0100, Jens Axboe wrote: > > On Tue, Dec 20 2005, Ben Collins wrote: > > > On Tue, 2005-12-20 at 08:46 +0100, Jens Axboe wrote: > > > > On Mon, Dec 19 2005, john stultz wrote: > > > > > All, > > > > > I'm getting a little tired of my roommates not knowing how to safely > > > > > eject their usb-flash disks from my system and I'd personally like it if > > > > > I could avoid bringing up a root shell to eject my ipod. Sure, one could > > > > > suid the eject command, but that seems just as bad as changing the > > > > > permissions in the kernel (eject wouldn't be able to check if the user > > > > > has read/write permissions on the device, allowing them to eject > > > > > anything). > > > > > > > > This just came up yesterday, eject isn't opening the device RDWR hence > > > > you have a permission problem with a command requiring write > > > > permissions. So just fix eject, there's no need to suid eject or run it > > > > as root. > > > > > > Yep, and here's the patch to do it: > > > > > > http://bugzilla.ubuntu.com/attachment.cgi?id=5415 > > > > > > Still, this whole issue with ALLOW_MEDIUM_REMOVAL. Would be nice if > > > CDROMEJECT just did the right thing. > > > > I would tend to agree, but you are bypassing the checks that are in > > there by doing so which isn't very nice. Then we might as well just mark > > ALLOW_MEDIUM_REMOVAL as safe-for-read in the first place. > > Should be an easy check to add. In fact, I'll resend both patches with > that in place if you want. There's still the quirky problem of forcing a locked tray out. In some cases this is what you want, if things get stuck for some reason or another. But usually the tray is locked for a good reason, because there are active users of the device. Say two processes has the cdrom open, one of them doing io (maybe even writing!), the other could do a CDROMEJECT now and force the ejection of a busy drive. -- Jens Axboe