svn commit: r241462 - stable/9/sys/kern

Navdeep Parhar np at FreeBSD.org
Thu Oct 11 21:15:55 UTC 2012


Author: np
Date: Thu Oct 11 21:15:54 2012
New Revision: 241462
URL: http://svn.freebsd.org/changeset/base/241462

Log:
  MFC r233850:
  - Remove redundant call to pr_ctloutput from code that handles SO_SETFIB.
  - Add a check for errors during copyin while here.

Modified:
  stable/9/sys/kern/uipc_socket.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/uipc_socket.c
==============================================================================
--- stable/9/sys/kern/uipc_socket.c	Thu Oct 11 20:53:11 2012	(r241461)
+++ stable/9/sys/kern/uipc_socket.c	Thu Oct 11 21:15:54 2012	(r241462)
@@ -2498,20 +2498,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:


More information about the svn-src-stable-9 mailing list