[DragonFlyBSD - Bug #2810] (New) In kernel file src/sys/netinet6/nd6_nbr.c, two mbuf size comparisons are erroneous

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Fri Apr 10 16:12:02 PDT 2015


Issue #2810 has been reported by fenyo.

----------------------------------------
Bug #2810: In kernel file src/sys/netinet6/nd6_nbr.c, two mbuf size comparisons are erroneous
http://bugs.dragonflybsd.org/issues/2810

* Author: fenyo
* Status: New
* Priority: Low
* Assignee: 
* Category: Kernel
* Target version: 
----------------------------------------
In src/sys/netinet6/nd6_nbr.c, there are two times the same minor bug:

At first, in this part of the file:
-----------------------------
	if (max_linkhdr + maxlen >= MCLBYTES) {
#ifdef DIAGNOSTIC
		kprintf("nd6_ns_output: max_linkhdr + maxlen >= MCLBYTES "
		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
#endif
		return;
	}
-----------------------------

There is two times the same little mistake in this code: the two ">=" should be changed to ">"
(note that it is correctly written in the last line of the kprintf: "(%d + %d > %d)\n").

This is a bug because if the packet need exactly MCLBYTES, it is possible to process it, but the code returns without having processed the packet.

Anyway, it is a minor bug because this case should never happen since the Neighbor Advertisement and Neighbor Solicitation packets are always small enough to be contained in a single MBUF cluster.
But the code is wrong, it would be nicer if corrected.

Secondly, the same bug appears later in the same file:
-----------------------------------
	if (max_linkhdr + maxlen >= MCLBYTES) {
#ifdef DIAGNOSTIC
		kprintf("nd6_na_output: max_linkhdr + maxlen >= MCLBYTES "
		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
#endif
		return;
-----------------------------------

Here again, the two "=>" should be changed to ">".





-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list