Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] qdio: fix broken pointer in case of CONFIG_DEBUG_FS is disabled

If CONFIG_DEBUG_FS is disabled debugfs_create_file returns -ENODEV instead
of zero. Since the return value is stored and used at shutdown to remove
existing entries an OOPS may be triggered.

Add a check of the debugfs_create_file return value and in case of an error
set the entry to NULL so it will be ignored at shutdown.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Jan Glauber and committed by
Martin Schwidefsky
19cdd08b 81ffa041

+2
+2
drivers/s390/cio/qdio_debug.c
··· 169 169 q->nr); 170 170 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, 171 171 debugfs_root, q, &debugfs_fops); 172 + if (IS_ERR(debugfs_queues[i])) 173 + debugfs_queues[i] = NULL; 172 174 } 173 175 174 176 void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev)