From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4628C32792 for ; Thu, 3 Oct 2019 16:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84594207FF for ; Thu, 3 Oct 2019 16:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120882; bh=W0T+0m0P2SGl5GUNMUD4zXhYLqP9P+xj8Epf7hhfNdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZUPVTlHoMT/HkLgyi/X8MKSkVXun3BsSyq4o/YuCKntbxtBqxo/3QKEYn2yYX7vvR sCopuZXq7DN2Gzwn4ffejTUd1Zx9TIXZn2eMrSZyzhDSsjvDRmHrPsROF59UxnV64V ysvpjQqvy8QWSeQDK6nwsjtBW0fvNpZLWBabYJIM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405017AbfJCQlV (ORCPT ); Thu, 3 Oct 2019 12:41:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:51594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404538AbfJCQlN (ORCPT ); Thu, 3 Oct 2019 12:41:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED261206BB; Thu, 3 Oct 2019 16:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120873; bh=W0T+0m0P2SGl5GUNMUD4zXhYLqP9P+xj8Epf7hhfNdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyQCaOZiSLVykxPyG0WLXYVRHUGHIKCOgI6OP0ql/RM3Kq9YwpGwrBNWJqu17ogog y7CnNoXcGS+j+OSmgyPJdYjCpiPLfQ0RPMeipBepYTnhsJ2GCIxj8YFiWwtAntqJn/ u+x9/ZZZgiGuwS2iSA3FhdeERMO4tkPCgIjzcWUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ori Nimron , "David S. Miller" Subject: [PATCH 5.3 034/344] appletalk: enforce CAP_NET_RAW for raw sockets Date: Thu, 3 Oct 2019 17:49:59 +0200 Message-Id: <20191003154543.445016933@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ori Nimron [ Upstream commit 6cc03e8aa36c51f3b26a0d21a3c4ce2809c842ac ] When creating a raw AF_APPLETALK socket, CAP_NET_RAW needs to be checked first. Signed-off-by: Ori Nimron Signed-off-by: Greg Kroah-Hartman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/appletalk/ddp.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1023,6 +1023,11 @@ static int atalk_create(struct net *net, */ if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) goto out; + + rc = -EPERM; + if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW)) + goto out; + rc = -ENOMEM; sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern); if (!sk)