purpose of ping_hash() in net/ipv4/ping.c
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: 2022-09-29 11:12:01
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: 2022-09-29 11:12:01
Hi I'm wondering about the purpose of the function ping_hash() in net/ipv4/ping.c. It only contains an unconditional BUG(), with a comment that doesn't help much. It was there with the original commit c319b4d76b9e (net: ipv4: add IPPROTO_ICMP socket kind), but then renamed and made non-static for "use" by IPv6 in 6d0bfe226116 (net: ipv6: Add IPv6 support to the ping socket.) The latter commit also added the 'EXPORT_SYMBOL_GPL(ping_hash);' in a somewhat non-standard location (namely, after the the similarly named ping_hashfn()), which is why I stumbled on this oddity. Can we just remove ping_hash() and stop setting .hash of in ping_prot and pingv6_prot? I don't think there's much difference between a NULL deref and an explicit BUG a few instructions later. And if we can't, can someone perhaps improve the comment and move the export to the right place? Rasmus