Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72f2a05b authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller
Browse files

macsec: add missing NULL check after kmalloc



Fixes: c09440f7 ("macsec: introduce IEEE 802.1AE driver")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d05a06d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
	}