mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Fix nfssvc_addsock() to not attempt to free a NULL socket structure
when returning an error. Bug fix was extracted from the PR. The PR is not yet entirely resolved by this commit. PR: kern/13049 Reviewed by: Matt Dillon <dillon@freebsd.org> Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
This commit is contained in:
parent
f506b9af42
commit
6b21e94604
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53022
@ -334,14 +334,16 @@ nfssvc_addsock(fp, mynam, p)
|
||||
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
|
||||
tslp = nfs_udpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#ifdef ISO
|
||||
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
|
||||
tslp = nfs_cltpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#endif /* ISO */
|
||||
@ -352,7 +354,8 @@ nfssvc_addsock(fp, mynam, p)
|
||||
siz = NFS_MAXPACKET;
|
||||
error = soreserve(so, siz, siz);
|
||||
if (error) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -334,14 +334,16 @@ nfssvc_addsock(fp, mynam, p)
|
||||
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
|
||||
tslp = nfs_udpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#ifdef ISO
|
||||
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
|
||||
tslp = nfs_cltpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#endif /* ISO */
|
||||
@ -352,7 +354,8 @@ nfssvc_addsock(fp, mynam, p)
|
||||
siz = NFS_MAXPACKET;
|
||||
error = soreserve(so, siz, siz);
|
||||
if (error) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -334,14 +334,16 @@ nfssvc_addsock(fp, mynam, p)
|
||||
if (so->so_proto->pr_protocol == IPPROTO_UDP) {
|
||||
tslp = nfs_udpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#ifdef ISO
|
||||
} else if (so->so_proto->pr_protocol == ISOPROTO_CLTP) {
|
||||
tslp = nfs_cltpsock;
|
||||
if (tslp->ns_flag & SLP_VALID) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (EPERM);
|
||||
}
|
||||
#endif /* ISO */
|
||||
@ -352,7 +354,8 @@ nfssvc_addsock(fp, mynam, p)
|
||||
siz = NFS_MAXPACKET;
|
||||
error = soreserve(so, siz, siz);
|
||||
if (error) {
|
||||
FREE(mynam, M_SONAME);
|
||||
if (mynam != NULL)
|
||||
FREE(mynam, M_SONAME);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user