summaryrefslogtreecommitdiffstats
path: root/sys/netatm
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-01 15:15:05 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-01 15:15:05 +0000
commit8622e776f910513e077d822efc579cdb9ba09316 (patch)
tree9714c8659826516cd802bd3b0a45d778b7ebb1a6 /sys/netatm
parent6b3805592d02e666e50f1d4473fb18c587d69a75 (diff)
downloadFreeBSD-src-8622e776f910513e077d822efc579cdb9ba09316.zip
FreeBSD-src-8622e776f910513e077d822efc579cdb9ba09316.tar.gz
Change protocol switch pru_abort() API so that it returns void rather
than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
Diffstat (limited to 'sys/netatm')
-rw-r--r--sys/netatm/atm_aal5.c23
-rw-r--r--sys/netatm/atm_proto.c14
-rw-r--r--sys/netatm/atm_usrreq.c2
-rw-r--r--sys/netatm/atm_var.h1
4 files changed, 34 insertions, 6 deletions
diff --git a/sys/netatm/atm_aal5.c b/sys/netatm/atm_aal5.c
index 2367eb9..2a5e1e3 100644
--- a/sys/netatm/atm_aal5.c
+++ b/sys/netatm/atm_aal5.c
@@ -78,7 +78,7 @@ static int atm_aal5_disconnect(struct socket *);
static int atm_aal5_shutdown(struct socket *);
static int atm_aal5_send(struct socket *, int, KBuffer *,
struct sockaddr *, KBuffer *, struct thread *td);
-static int atm_aal5_abort(struct socket *);
+static void atm_aal5_abort(struct socket *);
static int atm_aal5_control(struct socket *, u_long, caddr_t,
struct ifnet *, struct thread *td);
static int atm_aal5_sense(struct socket *, struct stat *);
@@ -204,6 +204,11 @@ static Atm_attributes atm_aal5_defattr = {
;
#endif /* DIAGNOSTIC */
+#define ATM_INTRO_NOERR(f) \
+ int s; \
+ s = splnet(); \
+ ;
+
#define ATM_OUTRO() \
/* \
* Drain any deferred calls \
@@ -213,6 +218,14 @@ static Atm_attributes atm_aal5_defattr = {
return (err); \
;
+#define ATM_OUTRO_NOERR() \
+ /* \
+ * Drain any deferred calls \
+ */ \
+ STACK_DRAIN(); \
+ (void) splx(s); \
+ ;
+
#define ATM_RETERR(errno) { \
err = errno; \
goto out; \
@@ -546,16 +559,16 @@ out:
* errno error processing request - reason indicated
*
*/
-static int
+static void
atm_aal5_abort(so)
struct socket *so;
{
- ATM_INTRO("abort");
+ ATM_INTRO_NOERR("abort");
so->so_error = ECONNABORTED;
- err = atm_sock_detach(so);
+ atm_sock_detach(so);
- ATM_OUTRO();
+ ATM_OUTRO_NOERR();
}
diff --git a/sys/netatm/atm_proto.c b/sys/netatm/atm_proto.c
index 1702354..0d4697b 100644
--- a/sys/netatm/atm_proto.c
+++ b/sys/netatm/atm_proto.c
@@ -184,3 +184,17 @@ atm_proto_notsupp4(so, i, m, addr, m2, td)
{
return (EOPNOTSUPP);
}
+
+/*
+ * Protocol request not supported
+ *
+ * Arguments:
+ * so pointer to socket
+ *
+ */
+void
+atm_proto_notsupp5(so)
+ struct socket *so;
+{
+
+}
diff --git a/sys/netatm/atm_usrreq.c b/sys/netatm/atm_usrreq.c
index 8baec6a..db5a2ab 100644
--- a/sys/netatm/atm_usrreq.c
+++ b/sys/netatm/atm_usrreq.c
@@ -66,7 +66,7 @@ static int atm_dgram_info(caddr_t);
* New-style socket request routines
*/
struct pr_usrreqs atm_dgram_usrreqs = {
- .pru_abort = atm_proto_notsupp1,
+ .pru_abort = atm_proto_notsupp5,
.pru_attach = atm_dgram_attach,
.pru_bind = atm_proto_notsupp2,
.pru_control = atm_dgram_control,
diff --git a/sys/netatm/atm_var.h b/sys/netatm/atm_var.h
index 4bc6d97..23e43192 100644
--- a/sys/netatm/atm_var.h
+++ b/sys/netatm/atm_var.h
@@ -136,6 +136,7 @@ int atm_proto_notsupp2(struct socket *, struct sockaddr *,
int atm_proto_notsupp3(struct socket *, struct sockaddr **);
int atm_proto_notsupp4(struct socket *, int, KBuffer *,
struct sockaddr *, KBuffer *, struct thread *);
+void atm_proto_notsupp5(struct socket *);
/* atm_signal.c */
int atm_sigmgr_register(struct sigmgr *);
OpenPOWER on IntegriCloud