Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932185Ab0AETxM (ORCPT ); Tue, 5 Jan 2010 14:53:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932166Ab0AETxI (ORCPT ); Tue, 5 Jan 2010 14:53:08 -0500 Received: from kroah.org ([198.145.64.141]:46040 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932163Ab0AETxA (ORCPT ); Tue, 5 Jan 2010 14:53:00 -0500 X-Mailbox-Line: From gregkh@mini.kroah.org Tue Jan 5 11:49:15 2010 Message-Id: <20100105194915.376656312@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Tue, 05 Jan 2010 11:48:00 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, stable-review@kernel.org Cc: "Serge E. Hallyn" Subject: [09/10] generic_permission: MAY_OPEN is not write access In-Reply-To: <20100105195007.GA23952@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1442 Lines: 42 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Serge E. Hallyn commit 7ea6600148c265b1fd53e521022b1d7aec81d974 upstream. generic_permission was refusing CAP_DAC_READ_SEARCH-enabled processes from opening DAC-protected files read-only, because do_filp_open adds MAY_OPEN to the open mask. Ignore MAY_OPEN. After this patch, CAP_DAC_READ_SEARCH is again sufficient to open(fname, O_RDONLY) on a file to which DAC otherwise refuses us read permission. Reported-by: Mike Kazantsev Signed-off-by: Serge E. Hallyn Tested-by: Mike Kazantsev Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -220,6 +220,7 @@ int generic_permission(struct inode *ino /* * Searching includes executable on directories, else just read. */ + mask &= MAY_READ | MAY_WRITE | MAY_EXEC; if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) if (capable(CAP_DAC_READ_SEARCH)) return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/