aboutsummaryrefslogtreecommitdiff
path: root/fs/proc/generic.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-07-22 08:17:15 -0700
committerKevin Hilman <khilman@linaro.org>2015-07-22 08:17:15 -0700
commit2447e09699cca5db52f86182f163f3a25d1089ab (patch)
treee16730dba489e5ea0f16737597525724daa5c770 /fs/proc/generic.c
parent5a277b6839c4ef6c6ccacff49b64f302598264bf (diff)
parentc8bde72f9af412de57f0ceae218d648640118b0b (diff)
Merge branch 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-linaro-lsk-v4.1lsk-v4.1-15.07
* 'linux-4.1.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (126 commits) Linux 4.1.3 Input: pixcir_i2c_ts - fix receive error of/pci: Fix pci_address_to_pio() conversion of CPU address to I/O port PCI: pciehp: Wait for hotplug command completion where necessary PCI: Add pci_bus_addr_t PCI: Propagate the "ignore hotplug" setting to parent mtd: dc21285: use raw spinlock functions for nw_gpio_lock mtd: fix: avoid race condition when accessing mtd->usecount leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger video: mxsfb: Make sure axi clock is enabled when accessing registers genirq: devres: Fix testing return value of request_any_context_irq() IB/srp: Fix reconnection failure handling IB/srp: Fix connection state tracking IB/srp: Fix a connection setup race IB/srp: Remove an extraneous scsi_host_put() from an error path scsi_transport_srp: Fix a race condition scsi_transport_srp: Introduce srp_wait_for_queuecommand() spi: pl022: Specify 'num-cs' property as required in devicetree binding spi: orion: Fix maximum baud rates for Armada 370/XP spi: fix race freeing dummy_tx/rx before it is unmapped ...
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r--fs/proc/generic.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index df6327a2b865..e5dee5c3188e 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -373,6 +373,10 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
WARN(1, "create '/proc/%s' by hand\n", qstr.name);
return NULL;
}
+ if (is_empty_pde(*parent)) {
+ WARN(1, "attempt to add to permanently empty directory");
+ return NULL;
+ }
ent = kzalloc(sizeof(struct proc_dir_entry) + qstr.len + 1, GFP_KERNEL);
if (!ent)
@@ -455,6 +459,25 @@ struct proc_dir_entry *proc_mkdir(const char *name,
}
EXPORT_SYMBOL(proc_mkdir);
+struct proc_dir_entry *proc_create_mount_point(const char *name)
+{
+ umode_t mode = S_IFDIR | S_IRUGO | S_IXUGO;
+ struct proc_dir_entry *ent, *parent = NULL;
+
+ ent = __proc_create(&parent, name, mode, 2);
+ if (ent) {
+ ent->data = NULL;
+ ent->proc_fops = NULL;
+ ent->proc_iops = NULL;
+ if (proc_register(parent, ent) < 0) {
+ kfree(ent);
+ parent->nlink--;
+ ent = NULL;
+ }
+ }
+ return ent;
+}
+
struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
struct proc_dir_entry *parent,
const struct file_operations *proc_fops,