Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2674766pxb; Mon, 11 Jan 2021 16:51:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqp3RCip0bwIOdkyB+KVyObCacetdoGhfqChPUrn8BVz6ZU6aRMl0/SO5BxAYCC1b6T3m3 X-Received: by 2002:aa7:c253:: with SMTP id y19mr1358025edo.179.1610412682079; Mon, 11 Jan 2021 16:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412682; cv=none; d=google.com; s=arc-20160816; b=hk9j0GTSe4e1y+k49irl1teghF5pCmw7OlgpRqD8iNhReSgMjHstNb1T47eToCbHms 6Gz2DwnAZswj5mWIRhzUruuQ4gdutA3NZ15Q3d1QocdFlNjmz0MRwYibIVdcwKkSodos EEQns0U/Vm25/A4HG2O+VirSzONg4OlC6Vj/tk7QnFwdrv835+ruqA3wP4f4ydRfnRC3 lDtxYzaU7DUDQhs9IBoyaQhw/6CiUanNmK9Wr4DfUM9/PTeZP3Uf91qciS+iaA24Az1A 1ndyX6gZ2S1SjjsGx4lmW7S4u7uCR2DgGJ4BwMOvPQkE9eztIfCYN4jiPNJzPA3YAjca Jw+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DFH0tLnwkkushbRxuKgssfWwDwsBC2Iiz/tS24hXb2k=; b=GrRkwD/rR956IBkSGeveMeLtuMnUpoAlULnEFGifx2cha4HWQXaPUw1BdGgH7pPcnY vYkaUhM1Y3Ic7/YZZFoW5jzbDmwLpcF6W3TgKshNP5+L0kn4QDxtsqO/ngzmDAmrJtU8 tbcWp3D4cdOoriF5G+lE1uWVo/Qe9Ipl4QBkLcAg2g8qcdTxZBfXGvjlWTv2qreInvLK jgq+9OhSV+3WQWPAVZ0oY2YBw1xcZOrkKPZH/V++u5ogVT+xV2AYeb1+KJtnLyLL0XIh QxTC6GE31oERdHSO9Xkauqktoe0uub/RM9Qy5Nm7m0lrA/uJ009tF1kMj0XbyW9KCIqA 5dIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6YLZ8nt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh12si430507ejb.48.2021.01.11.16.50.58; Mon, 11 Jan 2021 16:51:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6YLZ8nt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729324AbhAKNIg (ORCPT + 99 others); Mon, 11 Jan 2021 08:08:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:54288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730591AbhAKNHa (ORCPT ); Mon, 11 Jan 2021 08:07:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E35BA22515; Mon, 11 Jan 2021 13:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370435; bh=99pWozPUTAovepm9asQ1gDQbcAldCs2aL9E+joD8nIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6YLZ8ntb4toBt+5uw3w7ShaTS1E9WH2uSz2SfWjw0Z9vNV06ulRLrTchJvA1V+nD U0IEixlipWXyB8wG0eaifJjKfbbso6I0u1bSRRcqOmyYoAoPHSjje81C8H8u0YmPHd 1L9VhzmakpTcxvDSQGNTpUx4snuqqLSDVeU2N/Ck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Machata , Jakub Kicinski Subject: [PATCH 4.19 20/77] net: dcb: Validate netlink message in DCB handler Date: Mon, 11 Jan 2021 14:01:29 +0100 Message-Id: <20210111130037.389318488@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130036.414620026@linuxfoundation.org> References: <20210111130036.414620026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Petr Machata [ Upstream commit 826f328e2b7e8854dd42ea44e6519cd75018e7b1 ] DCB uses the same handler function for both RTM_GETDCB and RTM_SETDCB messages. dcb_doit() bounces RTM_SETDCB mesasges if the user does not have the CAP_NET_ADMIN capability. However, the operation to be performed is not decided from the DCB message type, but from the DCB command. Thus DCB_CMD_*_GET commands are used for reading DCB objects, the corresponding SET and DEL commands are used for manipulation. The assumption is that set-like commands will be sent via an RTM_SETDCB message, and get-like ones via RTM_GETDCB. However, this assumption is not enforced. It is therefore possible to manipulate DCB objects without CAP_NET_ADMIN capability by sending the corresponding command in an RTM_GETDCB message. That is a bug. Fix it by validating the type of the request message against the type used for the response. Fixes: 2f90b8657ec9 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver") Signed-off-by: Petr Machata Link: https://lore.kernel.org/r/a2a9b88418f3a58ef211b718f2970128ef9e3793.1608673640.git.me@pmachata.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/dcb/dcbnl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1756,6 +1756,8 @@ static int dcb_doit(struct sk_buff *skb, fn = &reply_funcs[dcb->cmd]; if (!fn->cb) return -EOPNOTSUPP; + if (fn->type != nlh->nlmsg_type) + return -EPERM; if (!tb[DCB_ATTR_IFNAME]) return -EINVAL;