From nobody@FreeBSD.org  Mon Aug 31 10:22:08 2009
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 370031065692
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 10:22:08 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 25CFB8FC32
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 10:22:08 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7VAM7nx064743
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 10:22:07 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n7VAM7ab064742;
	Mon, 31 Aug 2009 10:22:07 GMT
	(envelope-from nobody)
Message-Id: <200908311022.n7VAM7ab064742@www.freebsd.org>
Date: Mon, 31 Aug 2009 10:22:07 GMT
From: Patroklos Argyroudis <argp@census-labs.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NULL pointer dereference in t3_set_tcb_field() in file sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         138381
>Category:       kern
>Synopsis:       [cxgb] [patch] NULL pointer dereference in t3_set_tcb_field() in file sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    np
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 31 10:30:04 UTC 2009
>Closed-Date:    Thu Oct 25 19:05:17 UTC 2012
>Last-Modified:  Thu Oct 25 19:05:17 UTC 2012
>Originator:     Patroklos Argyroudis
>Release:        8.0-CURRENT
>Organization:
census, inc
>Environment:
N/A
>Description:
There is a possible NULL pointer dereference in t3_set_tcb_field() line 895 in file sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c. The dereference should be after the check against NULL in line 897.
>How-To-Repeat:
N/A
>Fix:
Patch attached.

Patch attached with submission follows:

--- ./sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c.orig	2009-08-28 15:12:33.000000000 +0300
+++ ./sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c	2009-08-28 15:27:38.000000000 +0300
@@ -892,10 +892,12 @@
 t3_set_tcb_field(struct toepcb *toep, uint16_t word, uint64_t mask, uint64_t val)
 {
 	struct mbuf *m;
-	struct tcpcb *tp = toep->tp_tp;
+	struct tcpcb *tp;
 	
 	if (toep == NULL)
 		return;
+
+	tp = toep->tp_tp;
  
 	if (tp->t_state == TCPS_CLOSED || (toep->tp_flags & TP_ABORT_SHUTDOWN)) {
 		printf("not seting field\n");


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kmacy 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 31 10:34:36 UTC 2009 
Responsible-Changed-Why:  
Over to author. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138381 
Responsible-Changed-From-To: kmacy->np 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Mar 14 09:52:44 UTC 2010 
Responsible-Changed-Why:  
Over to current maintainer of cxgb. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138381 
State-Changed-From-To: open->closed 
State-Changed-By: np 
State-Changed-When: Thu Oct 25 19:03:29 UTC 2012 
State-Changed-Why:  
cxgb's TCP offload module (TOM) was rewritten some time back and the problem 
reported in this PR does not apply to the new code. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138381 
>Unformatted:
