c519a68e3a
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl8ynf8ACgkQONu9yGCS aT7/9hAAoTxKWdbp0peN5sGh6GqDix6M3H9Z5dexW/XIVk9Eg+pzBLOT0BWoM/qB xnTOxu5yu2pYkMIoYSQc1cTNXeFeHU5qKiltgLmUTFFEolNcEHzWvSOb/uSUcvGR x6r78cGm30qSyu7PCPcotzu/J95JUtzWraIB4sy1qVeU+rastRIcRDz7ZcUjFQ/b PhDUusGY+d7ZA6+7vgLlT9LTmIlr/vQQA2kGxCkXZiKRLbJMmwm/IsS0G7NQMKMn nnMg+qzrveaTDnuKYhsTSSTLn2WOQmYZmevYOZjrrwiBaksCW8ygaq9UGArUcsnq PLgZGfhhoERmDp0mXxV9kngTkkgZ4OIlXP4sZiVbKiKNTnqTrMxCFPLpBqS2t0Eo RPoGyjcIkKHGKq1KwnrX5esMyaZb76aYUhO3tFZrgDhIDa193SxH9Znyp7tr5Znz 3b5oH53wIA4k1kBkpA9ibhIhPjYeCDughI/oWC0ExcQAbWkPhIYqbmgWfbfzKVxo Yq8VBlqfuZply1POmkgoge1oDD0A0LBk2mSLOl6wpzDN1umS0HtQLjWpbdEuugCq S7wF+zDKJAz+O76ufyqv81KO5vAH4QcVSOBCH/HVGvsPZKwWvnWFQJ3cfXSm5iiA Uj++z6jI4suc1Y4unjLHmr3EdXEUSSq7Kbi+mXj1GL1gi1qM8rE= =ZQmS -----END PGP SIGNATURE----- Merge 4.19.139 into android-4.19-stable Changes in 4.19.139 USB: serial: qcserial: add EM7305 QDL product ID USB: iowarrior: fix up report size handling for some devices usb: xhci: define IDs for various ASMedia host controllers usb: xhci: Fix ASMedia ASM1142 DMA addressing Revert "ALSA: hda: call runtime_allow() for all hda controllers" ALSA: seq: oss: Serialize ioctls staging: android: ashmem: Fix lockdep warning for write operation Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt() Bluetooth: Prevent out-of-bounds read in hci_inquiry_result_evt() Bluetooth: Prevent out-of-bounds read in hci_inquiry_result_with_rssi_evt() omapfb: dss: Fix max fclk divider for omap36xx binder: Prevent context manager from incrementing ref 0 vgacon: Fix for missing check in scrollback handling mtd: properly check all write ioctls for permissions leds: wm831x-status: fix use-after-free on unbind leds: da903x: fix use-after-free on unbind leds: lm3533: fix use-after-free on unbind leds: 88pm860x: fix use-after-free on unbind net/9p: validate fds in p9_fd_open drm/nouveau/fbcon: fix module unload when fbcon init has failed for some reason drm/nouveau/fbcon: zero-initialise the mode_cmd2 structure i2c: slave: improve sanity check when registering i2c: slave: add sanity check when unregistering usb: hso: check for return value in hso_serial_common_create() firmware: Fix a reference count leak. cfg80211: check vendor command doit pointer before use igb: reinit_locked() should be called with rtnl_lock atm: fix atm_dev refcnt leaks in atmtcp_remove_persistent tools lib traceevent: Fix memory leak in process_dynamic_array_len Drivers: hv: vmbus: Ignore CHANNELMSG_TL_CONNECT_RESULT(23) xattr: break delegations in {set,remove}xattr ipv4: Silence suspicious RCU usage warning ipv6: fix memory leaks on IPV6_ADDRFORM path net: ethernet: mtk_eth_soc: fix MTU warnings vxlan: Ensure FDB dump is performed under RCU net: lan78xx: replace bogus endpoint lookup hv_netvsc: do not use VF device if link is down net: gre: recompute gre csum for sctp over gre tunnels net: thunderx: use spin_lock_bh in nicvf_set_rx_mode_task() openvswitch: Prevent kernel-infoleak in ovs_ct_put_key() Revert "vxlan: fix tos value before xmit" selftests/net: relax cpu affinity requirement in msg_zerocopy test rxrpc: Fix race between recvmsg and sendmsg on immediate call failure i40e: add num_vectors checker in iwarp handler i40e: Wrong truncation from u16 to u8 i40e: Fix of memory leak and integer truncation in i40e_virtchnl.c i40e: Memory leak in i40e_config_iwarp_qvlist Smack: fix use-after-free in smk_write_relabel_self() Linux 4.19.139 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: If64996b6bc365365c5f06165ed8c7648336731bf
116 lines
3.6 KiB
C
116 lines
3.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
File: linux/xattr.h
|
|
|
|
Extended attributes handling.
|
|
|
|
Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
|
|
Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
|
|
Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
|
|
*/
|
|
#ifndef _LINUX_XATTR_H
|
|
#define _LINUX_XATTR_H
|
|
|
|
|
|
#include <linux/slab.h>
|
|
#include <linux/types.h>
|
|
#include <linux/spinlock.h>
|
|
#include <uapi/linux/xattr.h>
|
|
|
|
struct inode;
|
|
struct dentry;
|
|
|
|
/*
|
|
* struct xattr_handler: When @name is set, match attributes with exactly that
|
|
* name. When @prefix is set instead, match attributes with that prefix and
|
|
* with a non-empty suffix.
|
|
*/
|
|
struct xattr_handler {
|
|
const char *name;
|
|
const char *prefix;
|
|
int flags; /* fs private flags */
|
|
bool (*list)(struct dentry *dentry);
|
|
int (*get)(const struct xattr_handler *handler, struct dentry *dentry,
|
|
struct inode *inode, const char *name, void *buffer,
|
|
size_t size);
|
|
int (*__get)(const struct xattr_handler *handler, struct dentry *dentry,
|
|
struct inode *inode, const char *name, void *buffer,
|
|
size_t size);
|
|
int (*set)(const struct xattr_handler *handler, struct dentry *dentry,
|
|
struct inode *inode, const char *name, const void *buffer,
|
|
size_t size, int flags);
|
|
};
|
|
|
|
const char *xattr_full_name(const struct xattr_handler *, const char *);
|
|
|
|
struct xattr {
|
|
const char *name;
|
|
void *value;
|
|
size_t value_len;
|
|
};
|
|
|
|
ssize_t __vfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
|
|
ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
|
|
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
|
|
int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int);
|
|
int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
|
|
int __vfs_setxattr_locked(struct dentry *, const char *, const void *, size_t, int, struct inode **);
|
|
int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
|
|
int __vfs_removexattr(struct dentry *, const char *);
|
|
int __vfs_removexattr_locked(struct dentry *, const char *, struct inode **);
|
|
int vfs_removexattr(struct dentry *, const char *);
|
|
|
|
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
|
|
ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
|
|
char **xattr_value, size_t size, gfp_t flags);
|
|
|
|
static inline const char *xattr_prefix(const struct xattr_handler *handler)
|
|
{
|
|
return handler->prefix ?: handler->name;
|
|
}
|
|
|
|
struct simple_xattrs {
|
|
struct list_head head;
|
|
spinlock_t lock;
|
|
};
|
|
|
|
struct simple_xattr {
|
|
struct list_head list;
|
|
char *name;
|
|
size_t size;
|
|
char value[0];
|
|
};
|
|
|
|
/*
|
|
* initialize the simple_xattrs structure
|
|
*/
|
|
static inline void simple_xattrs_init(struct simple_xattrs *xattrs)
|
|
{
|
|
INIT_LIST_HEAD(&xattrs->head);
|
|
spin_lock_init(&xattrs->lock);
|
|
}
|
|
|
|
/*
|
|
* free all the xattrs
|
|
*/
|
|
static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
|
|
{
|
|
struct simple_xattr *xattr, *node;
|
|
|
|
list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
|
|
kfree(xattr->name);
|
|
kfree(xattr);
|
|
}
|
|
}
|
|
|
|
struct simple_xattr *simple_xattr_alloc(const void *value, size_t size);
|
|
int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
|
|
void *buffer, size_t size);
|
|
int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
|
|
const void *value, size_t size, int flags);
|
|
ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer,
|
|
size_t size);
|
|
void simple_xattr_list_add(struct simple_xattrs *xattrs,
|
|
struct simple_xattr *new_xattr);
|
|
|
|
#endif /* _LINUX_XATTR_H */
|