Skip to content

Commit dbdca9d

Browse files
pmachatagregkh
authored andcommitted
net: dcb: Validate netlink message in DCB handler
[ Upstream commit 826f328 ] 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: 2f90b86 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver") Signed-off-by: Petr Machata <[email protected]> Link: https://lore.kernel.org/r/a2a9b88418f3a58ef211b718f2970128ef9e3793.1608673640.git.me@pmachata.org Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2641363 commit dbdca9d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/dcb/dcbnl.c

+2
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,8 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
17651765
fn = &reply_funcs[dcb->cmd];
17661766
if (!fn->cb)
17671767
return -EOPNOTSUPP;
1768+
if (fn->type != nlh->nlmsg_type)
1769+
return -EPERM;
17681770

17691771
if (!tb[DCB_ATTR_IFNAME])
17701772
return -EINVAL;

0 commit comments

Comments
 (0)