net: Return the correct errno code
authorZheng Yongjun <zhengyongjun3@huawei.com>
Tue, 1 Jun 2021 14:14:07 +0000 (22:14 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Jun 2021 00:02:15 +0000 (17:02 -0700)
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c

index d9bccad..750f388 100644 (file)
@@ -318,7 +318,7 @@ lookup_protocol:
 
        WARN_ON(!answer_prot->slab);
 
-       err = -ENOBUFS;
+       err = -ENOMEM;
        sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, kern);
        if (!sk)
                goto out;