Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipvs: ip_vs_sh: ip_vs_sh_get_port: check skb_header_pointer for NULL

skb_header_pointer could return NULL, so check for it as we do it
everywhere else in ipvs code. This fixes a coverity warning.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>

authored by

Daniel Borkmann and committed by
Simon Horman
54e35cc5 70e3ca79

+6
+6
net/netfilter/ipvs/ip_vs_sh.c
··· 269 269 switch (iph->protocol) { 270 270 case IPPROTO_TCP: 271 271 th = skb_header_pointer(skb, iph->len, sizeof(_tcph), &_tcph); 272 + if (unlikely(th == NULL)) 273 + return 0; 272 274 port = th->source; 273 275 break; 274 276 case IPPROTO_UDP: 275 277 uh = skb_header_pointer(skb, iph->len, sizeof(_udph), &_udph); 278 + if (unlikely(uh == NULL)) 279 + return 0; 276 280 port = uh->source; 277 281 break; 278 282 case IPPROTO_SCTP: 279 283 sh = skb_header_pointer(skb, iph->len, sizeof(_sctph), &_sctph); 284 + if (unlikely(sh == NULL)) 285 + return 0; 280 286 port = sh->source; 281 287 break; 282 288 default: