net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh
authorMuhammad Usama Anjum <musamaanjum@gmail.com>
Thu, 8 Apr 2021 22:01:29 +0000 (03:01 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:22:32 +0000 (08:22 +0200)
commit426853f87e34c9945a655e8997d2f551b12ceb76
treefe7fdaff3b95df15df1373cc6c270f8c6db01d21
parentdf720c5687aeae1f99ded448d26893e288702ff3
net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh

commit 864db232dc7036aa2de19749c3d5be0143b24f8f upstream.

nlh is being checked for validtity two times when it is dereferenced in
this function. Check for validity again when updating the flags through
nlh pointer to make the dereferencing safe.

CC: <stable@vger.kernel.org>
Addresses-Coverity: ("NULL pointer dereference")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/route.c