Discussion:
soreserve() return value
(too old to reply)
Sean Boudreau
2009-07-23 15:02:42 UTC
Permalink
Hi:

It looks like the return value from soreserve()
should be checked as per the attached diff. Any
concerns?

Regards,

-seanb
Greg A. Woods
2009-07-23 19:40:30 UTC
Permalink
At Thu, 23 Jul 2009 11:02:42 -0400, Sean Boudreau <***@qnx.com> wrote:
Subject: soreserve() return value
Index: sys/kern/uipc_socket2.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.102
diff -u -r1.102 uipc_socket2.c
--- sys/kern/uipc_socket2.c 9 Apr 2009 00:43:38 -0000 1.102
+++ sys/kern/uipc_socket2.c 23 Jul 2009 14:05:13 -0000
@@ -279,7 +279,10 @@
so->so_rcv.sb_mowner = head->so_rcv.sb_mowner;
so->so_snd.sb_mowner = head->so_snd.sb_mowner;
#endif
- (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);
+ if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) != 0) {
+ soput(so);
+ return NULL;
+ }
so->so_snd.sb_lowat = head->so_snd.sb_lowat;
so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;
so->so_rcv.sb_timeo = head->so_rcv.sb_timeo;
It does look like FreeBSD's sonewconn() checks the return value of
soreserve() these days, though their code has transmuted quite a bit
beyond just doing that....
--
Greg A. Woods
Planix, Inc.

<***@planix.com> +1 416 218-0099 http://www.planix.com/
Loading...