From 8107f7d22e63beddf381fdd88f58f3cc761267c2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 23 Apr 2009 11:23:43 -0700 Subject: [PATCH] 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. --- datapath/brcompat.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.30.2