From patchwork Fri Oct 2 12:40:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Reisner X-Patchwork-Id: 51383 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n92FUlZL021113 for ; Fri, 2 Oct 2009 15:30:50 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 9DA9961AF2C; Fri, 2 Oct 2009 11:30:47 -0400 (EDT) Received: from int-mx04.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n92CeZZt002976 for ; Fri, 2 Oct 2009 08:40:35 -0400 Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.8]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n92CeYep025910 for ; Fri, 2 Oct 2009 08:40:34 -0400 Received: from mail09.linbit.com (mail09.linbit.com [212.69.161.110]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n92CeOAo028033 for ; Fri, 2 Oct 2009 08:40:24 -0400 Received: from localhost.localdomain (unknown [10.9.9.50]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id C795610888BE; Fri, 2 Oct 2009 14:40:14 +0200 (CEST) From: Philipp Reisner To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Andrew Morton , "David S. Miller" , Greg KH Date: Fri, 2 Oct 2009 14:40:09 +0200 Message-Id: <1254487211-11810-7-git-send-email-philipp.reisner@linbit.com> In-Reply-To: <1254487211-11810-6-git-send-email-philipp.reisner@linbit.com> References: <1254487211-11810-1-git-send-email-philipp.reisner@linbit.com> <1254487211-11810-2-git-send-email-philipp.reisner@linbit.com> <1254487211-11810-3-git-send-email-philipp.reisner@linbit.com> <1254487211-11810-4-git-send-email-philipp.reisner@linbit.com> <1254487211-11810-5-git-send-email-philipp.reisner@linbit.com> <1254487211-11810-6-git-send-email-philipp.reisner@linbit.com> X-RedHat-Spam-Score: -2 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.8 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 02 Oct 2009 11:30:41 -0400 Cc: Evgeniy Polyakov , dm-devel@redhat.com, linux-fbdev-devel@lists.sourceforge.net, Philipp Reisner Subject: [dm-devel] [PATCH 6/8] dst/connector: Disallow unpliviged users to configure dst X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c index 3943c91..ee16010 100644 --- a/drivers/staging/dst/dcore.c +++ b/drivers/staging/dst/dcore.c @@ -855,6 +855,11 @@ static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) struct dst_node *n = NULL, *tmp; unsigned int hash; + if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) { + err = -EPERM; + goto out; + } + if (msg->len < sizeof(struct dst_ctl)) { err = -EBADMSG; goto out;