aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Popov <bp@FreeBSD.org>1999-12-28 16:14:54 +0000
committerBoris Popov <bp@FreeBSD.org>1999-12-28 16:14:54 +0000
commit687fce03619ba355d08a6a09d9cbd33a794b21d4 (patch)
tree60df5a3916bb20cc976b87045766d9fb6346e916
parentdc22f85f340a807c7e5b9210a5e9c3038fc6a993 (diff)
downloadsrc-687fce03619ba355d08a6a09d9cbd33a794b21d4.tar.gz
src-687fce03619ba355d08a6a09d9cbd33a794b21d4.zip
Avoid to write garbage if uiomove fails.
Notes
Notes: svn path=/head/; revision=55190
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c4
-rw-r--r--sys/msdosfs/msdosfs_vnops.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 3ad5135481d0..d72a4cddd1c1 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -780,6 +780,10 @@ msdosfs_write(ap)
* Copy the data from user space into the buf header.
*/
error = uiomove(bp->b_data + croffset, n, uio);
+ if (error) {
+ brelse(bp);
+ break;
+ }
/*
* If they want this synchronous then write it and wait for
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 3ad5135481d0..d72a4cddd1c1 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -780,6 +780,10 @@ msdosfs_write(ap)
* Copy the data from user space into the buf header.
*/
error = uiomove(bp->b_data + croffset, n, uio);
+ if (error) {
+ brelse(bp);
+ break;
+ }
/*
* If they want this synchronous then write it and wait for