Commit 0a9ee81349d90c6c85831f38118bf569c60a4d51
Committed by
Pablo Neira Ayuso
1 parent
40cb1f9bc5
Exists in
master
and in
20 other branches
netfilter: Remove unnecessary OOM logging messages
Site specific OOM messages are duplications of a generic MM out of memory message and aren't really useful, so just delete them. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Showing 18 changed files with 37 additions and 92 deletions Side-by-side Diff
- net/bridge/netfilter/ebt_ulog.c
- net/ipv4/netfilter/ipt_CLUSTERIP.c
- net/ipv4/netfilter/ipt_ULOG.c
- net/ipv4/netfilter/nf_nat_snmp_basic.c
- net/ipv6/netfilter/nf_conntrack_reasm.c
- net/netfilter/ipset/ip_set_core.c
- net/netfilter/ipvs/ip_vs_core.c
- net/netfilter/ipvs/ip_vs_ctl.c
- net/netfilter/ipvs/ip_vs_dh.c
- net/netfilter/ipvs/ip_vs_lblc.c
- net/netfilter/ipvs/ip_vs_lblcr.c
- net/netfilter/ipvs/ip_vs_proto.c
- net/netfilter/ipvs/ip_vs_sh.c
- net/netfilter/ipvs/ip_vs_wrr.c
- net/netfilter/nf_conntrack_core.c
- net/netfilter/nfnetlink_log.c
- net/netfilter/xt_IDLETIMER.c
- net/netfilter/xt_hashlimit.c
net/bridge/netfilter/ebt_ulog.c
... | ... | @@ -102,16 +102,15 @@ |
102 | 102 | unsigned int n; |
103 | 103 | |
104 | 104 | n = max(size, nlbufsiz); |
105 | - skb = alloc_skb(n, GFP_ATOMIC); | |
105 | + skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN); | |
106 | 106 | if (!skb) { |
107 | - pr_debug("cannot alloc whole buffer of size %ub!\n", n); | |
108 | 107 | if (n > size) { |
109 | 108 | /* try to allocate only as much as we need for |
110 | 109 | * current packet */ |
111 | 110 | skb = alloc_skb(size, GFP_ATOMIC); |
112 | 111 | if (!skb) |
113 | - pr_debug("cannot even allocate " | |
114 | - "buffer of size %ub\n", size); | |
112 | + pr_debug("cannot even allocate buffer of size %ub\n", | |
113 | + size); | |
115 | 114 | } |
116 | 115 | } |
117 | 116 |
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/ipt_ULOG.c
... | ... | @@ -135,10 +135,8 @@ |
135 | 135 | * due to slab allocator restrictions */ |
136 | 136 | |
137 | 137 | n = max(size, nlbufsiz); |
138 | - skb = alloc_skb(n, GFP_ATOMIC); | |
138 | + skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN); | |
139 | 139 | if (!skb) { |
140 | - pr_debug("cannot alloc whole buffer %ub!\n", n); | |
141 | - | |
142 | 140 | if (n > size) { |
143 | 141 | /* try to allocate only as much as we need for |
144 | 142 | * current packet */ |
net/ipv4/netfilter/nf_nat_snmp_basic.c
... | ... | @@ -400,11 +400,8 @@ |
400 | 400 | *len = 0; |
401 | 401 | |
402 | 402 | *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); |
403 | - if (*octets == NULL) { | |
404 | - if (net_ratelimit()) | |
405 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
403 | + if (*octets == NULL) | |
406 | 404 | return 0; |
407 | - } | |
408 | 405 | |
409 | 406 | ptr = *octets; |
410 | 407 | while (ctx->pointer < eoc) { |
411 | 408 | |
... | ... | @@ -451,11 +448,8 @@ |
451 | 448 | return 0; |
452 | 449 | |
453 | 450 | *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); |
454 | - if (*oid == NULL) { | |
455 | - if (net_ratelimit()) | |
456 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
451 | + if (*oid == NULL) | |
457 | 452 | return 0; |
458 | - } | |
459 | 453 | |
460 | 454 | optr = *oid; |
461 | 455 | |
... | ... | @@ -728,8 +722,6 @@ |
728 | 722 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
729 | 723 | if (*obj == NULL) { |
730 | 724 | kfree(id); |
731 | - if (net_ratelimit()) | |
732 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
733 | 725 | return 0; |
734 | 726 | } |
735 | 727 | (*obj)->syntax.l[0] = l; |
... | ... | @@ -744,8 +736,6 @@ |
744 | 736 | if (*obj == NULL) { |
745 | 737 | kfree(p); |
746 | 738 | kfree(id); |
747 | - if (net_ratelimit()) | |
748 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
749 | 739 | return 0; |
750 | 740 | } |
751 | 741 | memcpy((*obj)->syntax.c, p, len); |
... | ... | @@ -759,8 +749,6 @@ |
759 | 749 | *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); |
760 | 750 | if (*obj == NULL) { |
761 | 751 | kfree(id); |
762 | - if (net_ratelimit()) | |
763 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
764 | 752 | return 0; |
765 | 753 | } |
766 | 754 | if (!asn1_null_decode(ctx, end)) { |
... | ... | @@ -780,8 +768,6 @@ |
780 | 768 | if (*obj == NULL) { |
781 | 769 | kfree(lp); |
782 | 770 | kfree(id); |
783 | - if (net_ratelimit()) | |
784 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
785 | 771 | return 0; |
786 | 772 | } |
787 | 773 | memcpy((*obj)->syntax.ul, lp, len); |
... | ... | @@ -801,8 +787,6 @@ |
801 | 787 | if (*obj == NULL) { |
802 | 788 | kfree(p); |
803 | 789 | kfree(id); |
804 | - if (net_ratelimit()) | |
805 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
806 | 790 | return 0; |
807 | 791 | } |
808 | 792 | memcpy((*obj)->syntax.uc, p, len); |
... | ... | @@ -819,8 +803,6 @@ |
819 | 803 | *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); |
820 | 804 | if (*obj == NULL) { |
821 | 805 | kfree(id); |
822 | - if (net_ratelimit()) | |
823 | - pr_notice("OOM in bsalg (%d)\n", __LINE__); | |
824 | 806 | return 0; |
825 | 807 | } |
826 | 808 | (*obj)->syntax.ul[0] = ul; |
net/ipv6/netfilter/nf_conntrack_reasm.c
... | ... | @@ -182,7 +182,6 @@ |
182 | 182 | return container_of(q, struct nf_ct_frag6_queue, q); |
183 | 183 | |
184 | 184 | oom: |
185 | - pr_debug("Can't alloc new queue\n"); | |
186 | 185 | return NULL; |
187 | 186 | } |
188 | 187 | |
189 | 188 | |
... | ... | @@ -370,10 +369,10 @@ |
370 | 369 | struct sk_buff *clone; |
371 | 370 | int i, plen = 0; |
372 | 371 | |
373 | - if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) { | |
374 | - pr_debug("Can't alloc skb\n"); | |
372 | + clone = alloc_skb(0, GFP_ATOMIC); | |
373 | + if (clone == NULL) | |
375 | 374 | goto out_oom; |
376 | - } | |
375 | + | |
377 | 376 | clone->next = head->next; |
378 | 377 | head->next = clone; |
379 | 378 | skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list; |
net/netfilter/ipset/ip_set_core.c
... | ... | @@ -1699,10 +1699,8 @@ |
1699 | 1699 | |
1700 | 1700 | ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max, |
1701 | 1701 | GFP_KERNEL); |
1702 | - if (!ip_set_list) { | |
1703 | - pr_err("ip_set: Unable to create ip_set_list\n"); | |
1702 | + if (!ip_set_list) | |
1704 | 1703 | return -ENOMEM; |
1705 | - } | |
1706 | 1704 | |
1707 | 1705 | ret = nfnetlink_subsys_register(&ip_set_netlink_subsys); |
1708 | 1706 | if (ret != 0) { |
net/netfilter/ipvs/ip_vs_core.c
... | ... | @@ -1877,10 +1877,9 @@ |
1877 | 1877 | struct netns_ipvs *ipvs; |
1878 | 1878 | |
1879 | 1879 | ipvs = net_generic(net, ip_vs_net_id); |
1880 | - if (ipvs == NULL) { | |
1881 | - pr_err("%s(): no memory.\n", __func__); | |
1880 | + if (ipvs == NULL) | |
1882 | 1881 | return -ENOMEM; |
1883 | - } | |
1882 | + | |
1884 | 1883 | /* Hold the beast until a service is registerd */ |
1885 | 1884 | ipvs->enable = 0; |
1886 | 1885 | ipvs->net = net; |
net/netfilter/ipvs/ip_vs_ctl.c
... | ... | @@ -856,15 +856,12 @@ |
856 | 856 | } |
857 | 857 | |
858 | 858 | dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL); |
859 | - if (dest == NULL) { | |
860 | - pr_err("%s(): no memory.\n", __func__); | |
859 | + if (dest == NULL) | |
861 | 860 | return -ENOMEM; |
862 | - } | |
861 | + | |
863 | 862 | dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); |
864 | - if (!dest->stats.cpustats) { | |
865 | - pr_err("%s() alloc_percpu failed\n", __func__); | |
863 | + if (!dest->stats.cpustats) | |
866 | 864 | goto err_alloc; |
867 | - } | |
868 | 865 | |
869 | 866 | dest->af = svc->af; |
870 | 867 | dest->protocol = svc->protocol; |
871 | 868 | |
... | ... | @@ -1168,10 +1165,8 @@ |
1168 | 1165 | goto out_err; |
1169 | 1166 | } |
1170 | 1167 | svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); |
1171 | - if (!svc->stats.cpustats) { | |
1172 | - pr_err("%s() alloc_percpu failed\n", __func__); | |
1168 | + if (!svc->stats.cpustats) | |
1173 | 1169 | goto out_err; |
1174 | - } | |
1175 | 1170 | |
1176 | 1171 | /* I'm the first user of the service */ |
1177 | 1172 | atomic_set(&svc->usecnt, 0); |
1178 | 1173 | |
... | ... | @@ -3716,10 +3711,9 @@ |
3716 | 3711 | |
3717 | 3712 | /* procfs stats */ |
3718 | 3713 | ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); |
3719 | - if (!ipvs->tot_stats.cpustats) { | |
3720 | - pr_err("%s(): alloc_percpu.\n", __func__); | |
3714 | + if (!ipvs->tot_stats.cpustats) | |
3721 | 3715 | return -ENOMEM; |
3722 | - } | |
3716 | + | |
3723 | 3717 | spin_lock_init(&ipvs->tot_stats.lock); |
3724 | 3718 | |
3725 | 3719 | proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops); |
net/netfilter/ipvs/ip_vs_dh.c
... | ... | @@ -150,10 +150,9 @@ |
150 | 150 | /* allocate the DH table for this service */ |
151 | 151 | tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE, |
152 | 152 | GFP_ATOMIC); |
153 | - if (tbl == NULL) { | |
154 | - pr_err("%s(): no memory\n", __func__); | |
153 | + if (tbl == NULL) | |
155 | 154 | return -ENOMEM; |
156 | - } | |
155 | + | |
157 | 156 | svc->sched_data = tbl; |
158 | 157 | IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for " |
159 | 158 | "current service\n", |
net/netfilter/ipvs/ip_vs_lblc.c
... | ... | @@ -202,10 +202,8 @@ |
202 | 202 | en = ip_vs_lblc_get(dest->af, tbl, daddr); |
203 | 203 | if (!en) { |
204 | 204 | en = kmalloc(sizeof(*en), GFP_ATOMIC); |
205 | - if (!en) { | |
206 | - pr_err("%s(): no memory\n", __func__); | |
205 | + if (!en) | |
207 | 206 | return NULL; |
208 | - } | |
209 | 207 | |
210 | 208 | en->af = dest->af; |
211 | 209 | ip_vs_addr_copy(dest->af, &en->addr, daddr); |
212 | 210 | |
... | ... | @@ -345,10 +343,9 @@ |
345 | 343 | * Allocate the ip_vs_lblc_table for this service |
346 | 344 | */ |
347 | 345 | tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); |
348 | - if (tbl == NULL) { | |
349 | - pr_err("%s(): no memory\n", __func__); | |
346 | + if (tbl == NULL) | |
350 | 347 | return -ENOMEM; |
351 | - } | |
348 | + | |
352 | 349 | svc->sched_data = tbl; |
353 | 350 | IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for " |
354 | 351 | "current service\n", sizeof(*tbl)); |
net/netfilter/ipvs/ip_vs_lblcr.c
... | ... | @@ -112,10 +112,8 @@ |
112 | 112 | } |
113 | 113 | |
114 | 114 | e = kmalloc(sizeof(*e), GFP_ATOMIC); |
115 | - if (e == NULL) { | |
116 | - pr_err("%s(): no memory\n", __func__); | |
115 | + if (e == NULL) | |
117 | 116 | return NULL; |
118 | - } | |
119 | 117 | |
120 | 118 | atomic_inc(&dest->refcnt); |
121 | 119 | e->dest = dest; |
122 | 120 | |
... | ... | @@ -373,10 +371,8 @@ |
373 | 371 | en = ip_vs_lblcr_get(dest->af, tbl, daddr); |
374 | 372 | if (!en) { |
375 | 373 | en = kmalloc(sizeof(*en), GFP_ATOMIC); |
376 | - if (!en) { | |
377 | - pr_err("%s(): no memory\n", __func__); | |
374 | + if (!en) | |
378 | 375 | return NULL; |
379 | - } | |
380 | 376 | |
381 | 377 | en->af = dest->af; |
382 | 378 | ip_vs_addr_copy(dest->af, &en->addr, daddr); |
383 | 379 | |
... | ... | @@ -516,10 +512,9 @@ |
516 | 512 | * Allocate the ip_vs_lblcr_table for this service |
517 | 513 | */ |
518 | 514 | tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); |
519 | - if (tbl == NULL) { | |
520 | - pr_err("%s(): no memory\n", __func__); | |
515 | + if (tbl == NULL) | |
521 | 516 | return -ENOMEM; |
522 | - } | |
517 | + | |
523 | 518 | svc->sched_data = tbl; |
524 | 519 | IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for " |
525 | 520 | "current service\n", sizeof(*tbl)); |
net/netfilter/ipvs/ip_vs_proto.c
... | ... | @@ -74,10 +74,9 @@ |
74 | 74 | struct ip_vs_proto_data *pd = |
75 | 75 | kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC); |
76 | 76 | |
77 | - if (!pd) { | |
78 | - pr_err("%s(): no memory.\n", __func__); | |
77 | + if (!pd) | |
79 | 78 | return -ENOMEM; |
80 | - } | |
79 | + | |
81 | 80 | pd->pp = pp; /* For speed issues */ |
82 | 81 | pd->next = ipvs->proto_data_table[hash]; |
83 | 82 | ipvs->proto_data_table[hash] = pd; |
net/netfilter/ipvs/ip_vs_sh.c
... | ... | @@ -147,10 +147,9 @@ |
147 | 147 | /* allocate the SH table for this service */ |
148 | 148 | tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE, |
149 | 149 | GFP_ATOMIC); |
150 | - if (tbl == NULL) { | |
151 | - pr_err("%s(): no memory\n", __func__); | |
150 | + if (tbl == NULL) | |
152 | 151 | return -ENOMEM; |
153 | - } | |
152 | + | |
154 | 153 | svc->sched_data = tbl; |
155 | 154 | IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for " |
156 | 155 | "current service\n", |
net/netfilter/ipvs/ip_vs_wrr.c
... | ... | @@ -85,10 +85,9 @@ |
85 | 85 | * Allocate the mark variable for WRR scheduling |
86 | 86 | */ |
87 | 87 | mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC); |
88 | - if (mark == NULL) { | |
89 | - pr_err("%s(): no memory\n", __func__); | |
88 | + if (mark == NULL) | |
90 | 89 | return -ENOMEM; |
91 | - } | |
90 | + | |
92 | 91 | mark->cl = &svc->destinations; |
93 | 92 | mark->cw = 0; |
94 | 93 | mark->mw = ip_vs_wrr_max_weight(svc); |
net/netfilter/nf_conntrack_core.c
... | ... | @@ -661,7 +661,6 @@ |
661 | 661 | */ |
662 | 662 | ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp); |
663 | 663 | if (ct == NULL) { |
664 | - pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n"); | |
665 | 664 | atomic_dec(&net->ct.count); |
666 | 665 | return ERR_PTR(-ENOMEM); |
667 | 666 | } |
668 | 667 | |
... | ... | @@ -749,10 +748,8 @@ |
749 | 748 | |
750 | 749 | ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC, |
751 | 750 | hash); |
752 | - if (IS_ERR(ct)) { | |
753 | - pr_debug("Can't allocate conntrack.\n"); | |
751 | + if (IS_ERR(ct)) | |
754 | 752 | return (struct nf_conntrack_tuple_hash *)ct; |
755 | - } | |
756 | 753 | |
757 | 754 | if (!l4proto->new(ct, skb, dataoff)) { |
758 | 755 | nf_conntrack_free(ct); |
net/netfilter/nfnetlink_log.c
... | ... | @@ -307,17 +307,14 @@ |
307 | 307 | n = max(inst_size, pkt_size); |
308 | 308 | skb = alloc_skb(n, GFP_ATOMIC); |
309 | 309 | if (!skb) { |
310 | - pr_notice("nfnetlink_log: can't alloc whole buffer (%u bytes)\n", | |
311 | - inst_size); | |
312 | - | |
313 | 310 | if (n > pkt_size) { |
314 | 311 | /* try to allocate only as much as we need for current |
315 | 312 | * packet */ |
316 | 313 | |
317 | 314 | skb = alloc_skb(pkt_size, GFP_ATOMIC); |
318 | 315 | if (!skb) |
319 | - pr_err("nfnetlink_log: can't even alloc %u " | |
320 | - "bytes\n", pkt_size); | |
316 | + pr_err("nfnetlink_log: can't even alloc %u bytes\n", | |
317 | + pkt_size); | |
321 | 318 | } |
322 | 319 | } |
323 | 320 |
net/netfilter/xt_IDLETIMER.c
... | ... | @@ -122,14 +122,12 @@ |
122 | 122 | |
123 | 123 | info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL); |
124 | 124 | if (!info->timer) { |
125 | - pr_debug("couldn't alloc timer\n"); | |
126 | 125 | ret = -ENOMEM; |
127 | 126 | goto out; |
128 | 127 | } |
129 | 128 | |
130 | 129 | info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); |
131 | 130 | if (!info->timer->attr.attr.name) { |
132 | - pr_debug("couldn't alloc attribute name\n"); | |
133 | 131 | ret = -ENOMEM; |
134 | 132 | goto out_free_timer; |
135 | 133 | } |
net/netfilter/xt_hashlimit.c
... | ... | @@ -176,10 +176,7 @@ |
176 | 176 | ent = NULL; |
177 | 177 | } else |
178 | 178 | ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC); |
179 | - if (!ent) { | |
180 | - if (net_ratelimit()) | |
181 | - pr_err("cannot allocate dsthash_ent\n"); | |
182 | - } else { | |
179 | + if (ent) { | |
183 | 180 | memcpy(&ent->dst, dst, sizeof(ent->dst)); |
184 | 181 | spin_lock_init(&ent->lock); |
185 | 182 |