Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2012 18:38:00 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233850 - head/sys/kern
Message-ID:  <201204031838.q33Ic0DV063324@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Apr  3 18:38:00 2012
New Revision: 233850
URL: http://svn.freebsd.org/changeset/base/233850

Log:
  - Remove redundant call to pr_ctloutput from code that handles SO_SETFIB.
  - Add a check for errors during copyin while here.
  
  Reviewed by:	julian, bz
  MFC after:	2 weeks

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Tue Apr  3 18:24:57 2012	(r233849)
+++ head/sys/kern/uipc_socket.c	Tue Apr  3 18:38:00 2012	(r233850)
@@ -2504,20 +2504,19 @@ sosetopt(struct socket *so, struct socko
 		case SO_SETFIB:
 			error = sooptcopyin(sopt, &optval, sizeof optval,
 					    sizeof optval);
+			if (error)
+				goto bad;
+
 			if (optval < 0 || optval >= rt_numfibs) {
 				error = EINVAL;
 				goto bad;
 			}
 			if (((so->so_proto->pr_domain->dom_family == PF_INET) ||
 			   (so->so_proto->pr_domain->dom_family == PF_INET6) ||
-			   (so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
+			   (so->so_proto->pr_domain->dom_family == PF_ROUTE)))
 				so->so_fibnum = optval;
-				/* Note: ignore error */
-				if (so->so_proto->pr_ctloutput)
-					(*so->so_proto->pr_ctloutput)(so, sopt);
-			} else {
+			else
 				so->so_fibnum = 0;
-			}
 			break;
 
 		case SO_USER_COOKIE:



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