Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Apr 2006 10:44:42 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/net raw_usrreq.c src/sys/netkey keysock.c
Message-ID:  <20060409084442.GE2135@garage.freebsd.pl>
In-Reply-To: <200604011555.k31FtiYU025077@repoman.freebsd.org>
References:  <200604011555.k31FtiYU025077@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--7CZp05NP8/gJM8Cl
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Apr 01, 2006 at 03:55:44PM +0000, Robert Watson wrote:
+> rwatson     2006-04-01 15:55:44 UTC
+>=20
+>   FreeBSD src repository
+>=20
+>   Modified files:
+>     sys/net              raw_usrreq.c=20
+>     sys/netkey           keysock.c=20
+>   Log:
+>   In raw and raw-derived socket types, maintain and enforce invariant th=
at
+>   the so_pcb pointer on the socket is always non-NULL.  This eliminates
+>   countless unnecessary error checks, replacing them with assertions.
[...]
+>  static int
+>  raw_uattach(struct socket *so, int proto, struct thread *td)
+>  {
+> -	struct rawcb *rp =3D sotorawcb(so);
+>  	int error;
+> =20
+> -	if (rp =3D=3D 0)
+> -		return EINVAL;
+> +	KASSERT(sotorawcb(so) =3D=3D NULL, ("raw_uattach: rp !=3D NULL"));
+>  	if (td && (error =3D suser(td)) !=3D 0)
+>  		return error;
+>  	return raw_attach(so, proto);

My system panics on this KASSERT(9) when I setup IPsec.
When you look closer, EINVAL was returned when sotorawcb(so) was equal
to NULL and you change it to panic when it is not NULL.
So what you really wanted here, IMHO was:

	KASSERT(sotorawcb(so) !=3D NULL, ("raw_uattach: rp =3D=3D NULL"));

With this KASSERT(9) it works for me.
BTW. There is no more 'rp' variable in the function.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--7CZp05NP8/gJM8Cl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFEOMl6ForvXbEpPzQRAg0NAJ4mpeNR6uld7rSvag75jXufq4i21QCePWuL
XnbdIId4c8AFoc1o0eagn6w=
=IH2F
-----END PGP SIGNATURE-----

--7CZp05NP8/gJM8Cl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060409084442.GE2135>