aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabrina Dubroca <[email protected]>2016-04-22 11:28:01 +0200
committerDavid S. Miller <[email protected]>2016-04-24 14:31:58 -0400
commit72f2a05b8f367ee0d75584a6fbec7dbe7c144f27 (patch)
tree4c3683dfc8f7366f92e34a051737b9ba0f1bea94
parent3d05a06d313d602f7cd589d5d8d45bd04902adcb (diff)
macsec: add missing NULL check after kmalloc
Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Sabrina Dubroca <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--drivers/net/macsec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 84d3e5ca8817..f691030ee3df 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1622,8 +1622,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
}
rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL);
- if (init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), secy->key_len,
- secy->icv_len)) {
+ if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
+ secy->key_len, secy->icv_len)) {
rtnl_unlock();
return -ENOMEM;
}