summaryrefslogtreecommitdiffstats
path: root/sys/coda/coda_fbsd.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-07-11 20:39:53 +0000
committerrwatson <rwatson@FreeBSD.org>2007-07-11 20:39:53 +0000
commit3287a2c53fcfb6141e98f687b8bc2a5df5fdc418 (patch)
tree72d4595c5d531da5e33d28a645ab6f54df2c401c /sys/coda/coda_fbsd.c
parent33e96346efa30f1edc600237f9c28416c1364c7b (diff)
downloadFreeBSD-src-3287a2c53fcfb6141e98f687b8bc2a5df5fdc418.zip
FreeBSD-src-3287a2c53fcfb6141e98f687b8bc2a5df5fdc418.tar.gz
Avoid crash when opening Coda device: when allocating coda_mntinfo, we
need to initialize dev so that we can actually find the allocated coda_mntinfo structure later on. Submitted by: Jan Harkes <jaharkes@cs.cmu.edu> Approved by: re (kensmith)
Diffstat (limited to 'sys/coda/coda_fbsd.c')
-rw-r--r--sys/coda/coda_fbsd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c
index dd379d7..fe3dcb8 100644
--- a/sys/coda/coda_fbsd.c
+++ b/sys/coda/coda_fbsd.c
@@ -124,6 +124,7 @@ static void coda_fbsd_clone(arg, cred, name, namelen, dev)
dev_ref(*dev);
mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO);
LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list);
+ mnt->dev = *dev;
}
struct coda_mntinfo *
@@ -133,8 +134,8 @@ dev2coda_mntinfo(struct cdev *dev)
LIST_FOREACH(mnt, &coda_mnttbl, mi_list) {
if (mnt->dev == dev)
- break;
+ return mnt;
}
- return mnt;
+ return NULL;
}
OpenPOWER on IntegriCloud