public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Yiqi Sun <sunyiqixm@gmail.com>,
	Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Simon Horman <horms@kernel.org>, netdev@vger.kernel.org
Subject: [bug report] ipv4: icmp: fix null-ptr-deref in icmp_build_probe()
Date: Fri, 10 Apr 2026 13:16:41 +0300	[thread overview]
Message-ID: <adjOCdCW1EpPl8lf@stanley.mountain> (raw)

Hello Yiqi Sun,

Commit fde29fd93493 ("ipv4: icmp: fix null-ptr-deref in
icmp_build_probe()") from Apr 2, 2026 (linux-next), leads to the
following Smatch static checker warning:

	net/ipv4/icmp.c:1351 icmp_build_probe()
	warn: 'dev' is not an error pointer

net/ipv4/icmp.c
    1341 #if IS_ENABLED(CONFIG_IPV6)
    1342                 case ICMP_AFI_IP6:
    1343                         if (iio->ident.addr.ctype3_hdr.addrlen != sizeof(struct in6_addr))
    1344                                 goto send_mal_query;
    1345                         dev = ipv6_dev_find(net, &iio->ident.addr.ip_addr.ipv6_addr, dev);
    1346 
    1347                         /*
    1348                          * If IPv6 identifier lookup is unavailable, silently
    1349                          * discard the request instead of misreporting NO_IF.
    1350                          */
--> 1351                         if (IS_ERR(dev))
    1352                                 return false;

It looks like there were two patches that went in around the same
time.  Commit fde29fd93493 ("ipv4: icmp: fix null-ptr-deref in
icmp_build_probe()") updated the checking for
ipv6_stub->ipv6_dev_find() but d98adfbdd5c0 ("ipv4: drop ipv6_stub usage
and use direct function calls") changed it to not return error pointers.

This IS_ERR() check can be removed.

    1353 
    1354                         dev_hold(dev);
    1355                         break;
    1356 #endif
    1357                 default:
    1358                         goto send_mal_query;
    1359                 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

             reply	other threads:[~2026-04-10 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:16 Dan Carpenter [this message]
2026-04-10 10:51 ` [bug report] ipv4: icmp: fix null-ptr-deref in icmp_build_probe() Fernando Fernandez Mancera
2026-04-10 11:19   ` Fernando Fernandez Mancera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adjOCdCW1EpPl8lf@stanley.mountain \
    --to=error27@gmail.com \
    --cc=fmancera@suse.de \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sunyiqixm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox