From nobody@FreeBSD.org  Mon Jun 27 12:43:54 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B73741065673
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Jun 2011 12:43:54 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 59A5B8FC21
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Jun 2011 12:43:53 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5RChrK1037328
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Jun 2011 12:43:53 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5RChrVr037316;
	Mon, 27 Jun 2011 12:43:53 GMT
	(envelope-from nobody)
Message-Id: <201106271243.p5RChrVr037316@red.freebsd.org>
Date: Mon, 27 Jun 2011 12:43:53 GMT
From: Greg Becker <greg@codeconcepts.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Possible dereference of null pointer by code that calls replay_find()...
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158340
>Category:       kern
>Synopsis:       [rpc] Possible dereference of null pointer by code that calls replay_find()...
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 27 12:50:07 UTC 2011
>Closed-Date:    
>Last-Modified:  Mon Jun 27 22:15:01 UTC 2011
>Originator:     Greg Becker
>Release:        8.2
>Organization:
CodeConcepts
>Environment:
>Description:
In replay_find() (src/sys/rpc/replay.c), if a message is found in the DRC but does not have a body then mp is left untouched.  The only caller of replay_find() is svc_getreq(), which assumes that replay_find() returns a valid pointer in this argument.

Now, I don't know if rce_repbody can legitimately be NULL, but for completeness svc_getreq() should probably set repbody to NULL and then check it after the call to replay_find(), and avoid making the call to SVC_REPLY() if repbody is NULL.

replay_find() also should set *mp = NULL if rce_repbody is NULL.


>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
