From: Ben Pfaff Date: Thu, 23 Apr 2009 18:23:43 +0000 (-0700) Subject: brcompat: Check for null pointer before reading netlink attribute. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8107f7d22e63beddf381fdd88f58f3cc761267c2;p=openvswitch brcompat: Check for null pointer before reading netlink attribute. Netlink policy parsing only checks that, if an attribute is present, then its format is correct. It doesn't ensure that attributes are present, so an explicit check is needed, which this commit adds. --- diff --git a/datapath/brcompat.c b/datapath/brcompat.c index e20af016..46ecce00 100644 --- a/datapath/brcompat.c +++ b/datapath/brcompat.c @@ -294,6 +294,9 @@ static struct nla_policy brc_genl_policy[BRC_GENL_A_MAX + 1] = { static int brc_genl_dp_result(struct sk_buff *skb, struct genl_info *info) { + if (!info->attrs[BRC_GENL_A_ERR_CODE]) + return -EINVAL; + dp_act_err = nla_get_u32(info->attrs[BRC_GENL_A_ERR_CODE]); complete(&dp_act_done);