Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2274017pxb; Mon, 11 Jan 2021 05:47:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJySU05nnHE46VnlGzDVQGEKmJvkUDV4Tej14TRn2+ECqmIB4Xiepzoh/NNVhsv7yBlmmgFe X-Received: by 2002:a50:ab51:: with SMTP id t17mr14131949edc.89.1610372823536; Mon, 11 Jan 2021 05:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372823; cv=none; d=google.com; s=arc-20160816; b=yb2mahZYsRZJWMPLIB4t9/ltGAwZikSX8uxwd4MFE6iZHGTr7RI10rjX39/K//X2wd RcR3oXk/Rtn5sttTGjDJuDZw8Ouan7jNx4RNEInWwXd9a+innbDGBTBgHRzu0UfAPBpS UNUIRVOojvbObVX1CQRyd4ePIsMsOUuvRhqP3VYUTllXz299tKiX1IAakqH8QgkFfHvS PvI29meJijBObVwwQ+wpTVP0l/A3d63N8/qzN279p60aE6yYGfCUlAOFh59P0VSWwHIV Hm4aX8iXYhULt/eqtxNUHjyNSgaGC+spsdXsSwdevCivOIFZ2SkMaNEliBQbZyZPK9rc i9jQ== 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=MUTulRmXdbAFIR7EjxAhwUE0Jc34T9HRbs3QvBV8lSQ=; b=L0Yzp3qzDzMOxEPxxKToImjRXkbIJqLAB23kBn8mt/7Ketw5PXEBXubivHDzP297eR EmOC9MUqOVTOHdjMxv3XcQlvxFU2MnLSaIXfDrbBv9pPl408FQw2IwtpEWe/hDkaRod2 DAMtJwj9KTvVGL8fUiNRJ6vGVyB6sX9uvP8BArj9DIXnmm9lPlWpOh3K7cZSbB1uE9MQ jB4cr4B9wCsAnP8JAyJ8WtKPNVos9Wn1aY7/EjbiNlA+pz8U3DC+hTrJILL0qFmzEeTr G9TCZ6vThUiMd6BfoCPAC2NAukE5yVgkq/MFlPgX9u6EFTsn2Sfye75JEyBnGn5aOrSg xFUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1X1Fnnkn; 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 di13si6871766edb.412.2021.01.11.05.46.39; Mon, 11 Jan 2021 05:47:03 -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=1X1Fnnkn; 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 S1730691AbhAKNLt (ORCPT + 99 others); Mon, 11 Jan 2021 08:11:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:58156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731295AbhAKNK6 (ORCPT ); Mon, 11 Jan 2021 08:10:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 72838229C4; Mon, 11 Jan 2021 13:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370617; bh=+Kd3aqHT+ZRR+qTRRaanrxlV7+HyLHkYUaBKHsKdhvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1X1Fnnkn3vL7n5W3A73tCn3bb46QgdZU/7ScOtL4ysiSyRPWgqyJXGa+WdE0CyN8h SJLk4ywS+1GbfYK6LHNg0s4/wX0cwd/RxmeL+b1MwQCT2tS/8i0fSVp+PjnBgiDMbY Ttj7Kp9d1WrbKE22oRe7AeOAtpk1REIuUVQTvoNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Machata , Jakub Kicinski Subject: [PATCH 5.4 23/92] net: dcb: Validate netlink message in DCB handler Date: Mon, 11 Jan 2021 14:01:27 +0100 Message-Id: <20210111130040.262222131@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@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 @@ -1765,6 +1765,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;