/* * linux/fs/hfsplus/posix_acl.c * * Vyacheslav Dubeyko * * Handler for Posix Access Control Lists (ACLs) support. */ #include "hfsplus_fs.h" #include "xattr.h" #include "acl.h" struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type) { struct posix_acl *acl; char *xattr_name; char *value = NULL; ssize_t size; hfs_dbg(ACL_MOD, "[%s]: ino %lu\n", __func__, inode->i_ino); switch (type) { case ACL_TYPE_ACCESS: xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; break; case ACL_TYPE_DEFAULT: xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT; break; default: return ERR_PTR(-EINVAL); } size = __hfsplus_getxattr(inode, xattr_name, NULL, 0); if (size > 0) { value = (char *)hfsplus_alloc_attr_entry(); if (unlikely(!value)) return ERR_PTR(-ENOMEM); size = __hfsplus_getxattr(inode, xattr_name, value, size); } if (size > 0) acl = posix_acl_from_xattr(&init_user_ns, value, size); else if (size == -ENODATA) acl = NULL; else acl = ERR_PTR(size); hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value); return acl; } int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, int type) { int err; char *xattr_name; size_t size = 0; char *value = NULL; hfs_dbg(ACL_MOD, "[%s]: ino %lu\n", __func__, inode->i_ino); switch (type) { case ACL_TYPE_ACCESS: xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { err = posix_acl_update_mode(inode, &inode->i_mode, &acl); if (err) return err; } err = 0; break; case ACL_TYPE_DEFAULT: xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT; if (!S_ISDIR(inode->i_mode)) return acl ? -EACCES : 0; break; default: return -EINVAL; } if (acl) { size = posix_acl_xattr_size(acl->a_count); if (unlikely(size > HFSPLUS_MAX_INLINE_DATA_SIZE)) return -ENOMEM; value = (char *)hfsplus_alloc_attr_entry(); if (unlikely(!value)) return -ENOMEM; err = posix_acl_to_xattr(&init_user_ns, acl, value, size); if (unlikely(err < 0)) goto end_set_acl; } err = __hfsplus_setxattr(inode, xattr_name, value, size, 0); end_set_acl: hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value); if (!err) set_cached_acl(inode, type, acl); return err; } int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) { int err = 0; struct posix_acl *default_acl, *acl; hfs_dbg(ACL_MOD, "[%s]: ino %lu, dir->ino %lu\n", __func__, inode->i_ino, dir->i_ino); if (S_ISLNK(inode->i_mode)) return 0; err = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); if (err) return err; if (default_acl) { err = hfsplus_set_posix_acl(inode, default_acl, ACL_TYPE_DEFAULT); posix_acl_release(default_acl); } if (acl) { if (!err) err = hfsplus_set_posix_acl(inode, acl, ACL_TYPE_ACCESS); posix_acl_release(acl); } return err; } ref='/cgit.cgi/linux/net-next.git/log/net/bridge?id=00300b2aac27556e2829cfd047b787af0f13b081'>bridge/br_sysfs_br.c
AgeCommit message (Expand)AuthorFilesLines
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-01-31 09:37:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2017-01-31 21:47:58 +0100
commit0becc0ae5b42828785b589f686725ff5bc3b9b25 (patch)
treebe6d0e1f37c38ed0a7dd5da2d4b1e93f0fb43101 /net/ieee802154/nl-mac.c
parent24c2503255d35c269b67162c397a1a1c1e02f6ce (diff)
x86/mce: Make timer handling more robust
Erik reported that on a preproduction hardware a CMCI storm triggers the BUG_ON in add_timer_on(). The reason is that the per CPU MCE timer is started by the CMCI logic before the MCE CPU hotplug callback starts the timer with add_timer_on(). So the timer is already queued which triggers the BUG. Using add_timer_on() is pretty pointless in this code because the timer is strictlty per CPU, initialized as pinned and all operations which arm the timer happen on the CPU to which the timer belongs. Simplify the whole machinery by using mod_timer() instead of add_timer_on() which avoids the problem because mod_timer() can handle already queued timers. Use __start_timer() everywhere so the earliest armed expiry time is preserved. Reported-by: Erik Veijola <erik.veijola@intel.com> Tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@alien8.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701310936080.3457@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/ieee802154/nl-mac.c')