From 6e6b7d44efaa9e08b86ae2a97d2c1a9b2ef3ee31 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Wed, 21 Feb 2007 08:50:06 +0000 Subject: [PATCH] The functions that set and delete external attributes must check that the filesystem is not mounted read-only before proceeding. Reported by: Ryan Beasley MFC after: 1 week --- sys/ufs/ffs/ffs_vnops.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 77c5958347e..0e323f7598f 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1358,6 +1358,9 @@ struct vop_closeextattr_args { if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); + if (ap->a_commit && (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)) + return (EROFS); + return (ffs_close_ea(ap->a_vp, ap->a_commit, ap->a_cred, ap->a_td)); } @@ -1392,6 +1395,9 @@ vop_deleteextattr { if (strlen(ap->a_name) == 0) return (EINVAL); + if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) + return (EROFS); + error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, IWRITE); if (error) { @@ -1613,6 +1619,9 @@ vop_setextattr { if (ap->a_uio == NULL) return (EOPNOTSUPP); + if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) + return (EROFS); + error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, IWRITE); if (error) {