From patchwork Sun Apr 13 15:11:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3974361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31EFBBFF02 for ; Sun, 13 Apr 2014 15:12:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 722AD20220 for ; Sun, 13 Apr 2014 15:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AEA852021A for ; Sun, 13 Apr 2014 15:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754787AbaDMPMI (ORCPT ); Sun, 13 Apr 2014 11:12:08 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:54274 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754783AbaDMPME (ORCPT ); Sun, 13 Apr 2014 11:12:04 -0400 Received: by mail-pd0-f173.google.com with SMTP id z10so7170932pdj.32 for ; Sun, 13 Apr 2014 08:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=rvRBzL+LGP3U1+HHevnHPvqtkLCLtOFL2LIGEci2HAE=; b=jTEtY7u1l7AEi2JqcWGOy4Ruw42XcQjuXVFdpU7GtBCgTncgnvr8u57TyaYRcCHjjU VTIclSqy3C2FbfeXBZGxU5Hq9A9zl/T8DSKt8AcCj9vkjS11hKbfMdRSOjFBbLwBByCP 7jXrPFNDkgk8mrRu8YZexUSwTFi4K+ktwMoQUBboJYgv/9L2CnNL9uCt5IRP1fBbX+wN aArW+YsDKqxnrVijXqsUZDGEsCx85kHoy8T0SPhcrU3vDJRf44j6he5u6UWD/khmVgip se8tMFaRS0ZaYqnfWswuhy9xYjGEi0taG3pxo0VQS3INbnftegYZCbsbX8CfpbyhbUl+ Mq4w== X-Received: by 10.66.124.232 with SMTP id ml8mr39099254pab.38.1397401923974; Sun, 13 Apr 2014 08:12:03 -0700 (PDT) Received: from [192.168.0.104] ([171.215.249.239]) by mx.google.com with ESMTPSA id e6sm28230243pbg.4.2014.04.13.08.12.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Apr 2014 08:12:03 -0700 (PDT) Message-ID: <534AA92B.8010805@gmail.com> Date: Sun, 13 Apr 2014 23:11:39 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "J. Bruce Fields" , linux-nfs@vger.kernel.org Subject: [PATCH] NFSD: Checking whether kill_suid by should_remove_suid() Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As local filesystem, writing data to the file by non-owner will clears the SUID+SGID, owner will not. Signed-off-by: Kinglong Mee --- fs/nfsd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) if (stable) { diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 16f0673..19c0931 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -943,7 +943,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, fsnotify_modify(file); /* clear setuid/setgid flag after write */ - if (inode->i_mode & (S_ISUID | S_ISGID)) + if (should_remove_suid(dentry)) kill_suid(dentry);