diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b7a26120d5521efb30e349db0aec43c5769bba04..faaf68881ec3b85f1f04d62b006c76403c2cc58a 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -343,6 +343,8 @@ int ip_ra_control(struct sock *sk, unsigned char on, return -EINVAL; new_ra = on ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; + if (on && !new_ra) + return -ENOMEM; mutex_lock(&net->ipv4.ra_mutex); for (rap = &net->ipv4.ra_chain;