aboutsummaryrefslogtreecommitdiff
path: root/sys/netsmb
diff options
context:
space:
mode:
authorDavide Italiano <davide@FreeBSD.org>2013-05-04 16:55:48 +0000
committerDavide Italiano <davide@FreeBSD.org>2013-05-04 16:55:48 +0000
commit90e19ee8be1ab14aa53cb917a3b1153fac887bee (patch)
tree83c314f264ae782ec22a41e6b83d4047d828a2c4 /sys/netsmb
parentcd5810229da55c8030d09ca1133baf811751f761 (diff)
downloadsrc-90e19ee8be1ab14aa53cb917a3b1153fac887bee.tar.gz
src-90e19ee8be1ab14aa53cb917a3b1153fac887bee.zip
If the kernel is compiled with VMIMAGE support, the first attempt of
mounting smbfs share will cause a panic. Fix setting setting/restoring vnet context when needed. PR: kern/168077 Submitted by: dteske
Notes
Notes: svn path=/head/; revision=250243
Diffstat (limited to 'sys/netsmb')
-rw-r--r--sys/netsmb/smb_trantcp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/netsmb/smb_trantcp.c b/sys/netsmb/smb_trantcp.c
index dd39ac5fed8c..a22e0643a5ef 100644
--- a/sys/netsmb/smb_trantcp.c
+++ b/sys/netsmb/smb_trantcp.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/route.h>
+#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -79,13 +80,17 @@ static int
nb_setsockopt_int(struct socket *so, int level, int name, int val)
{
struct sockopt sopt;
+ int error;
bzero(&sopt, sizeof(sopt));
sopt.sopt_level = level;
sopt.sopt_name = name;
sopt.sopt_val = &val;
sopt.sopt_valsize = sizeof(val);
- return sosetopt(so, &sopt);
+ CURVNET_SET(so->so_vnet);
+ error = sosetopt(so, &sopt);
+ CURVNET_RESTORE();
+ return error;
}
static int
@@ -299,8 +304,10 @@ nbssn_recvhdr(struct nbpcb *nbp, int *lenp,
auio.uio_offset = 0;
auio.uio_resid = sizeof(len);
auio.uio_td = td;
+ CURVNET_SET(so->so_vnet);
error = soreceive(so, (struct sockaddr **)NULL, &auio,
(struct mbuf **)NULL, (struct mbuf **)NULL, &flags);
+ CURVNET_RESTORE();
if (error)
return error;
if (auio.uio_resid > 0) {
@@ -384,8 +391,10 @@ nbssn_recv(struct nbpcb *nbp, struct mbuf **mpp, int *lenp,
*/
do {
rcvflg = MSG_WAITALL;
+ CURVNET_SET(so->so_vnet);
error = soreceive(so, (struct sockaddr **)NULL,
&auio, &tm, (struct mbuf **)NULL, &rcvflg);
+ CURVNET_RESTORE();
} while (error == EWOULDBLOCK || error == EINTR ||
error == ERESTART);
if (error)