aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2016-06-19 08:31:29 -0400
committerSumit Semwal <sumit.semwal@linaro.org>2016-06-20 12:56:36 -0400
commiteb0b947e3bf59d263f5bc7c080ce40333b515004 (patch)
tree826a3e829563dcae5e9a10420fee3718fb521231
parent996818869c9cc25581e81ff809d790651129cb4a (diff)
dma-buf: propagate errors from dma_buf_describe() on debugfs read
The callback function dma_buf_describe() returns an int not void so the function pointer cast in dma_buf_show() is wrong. dma_buf_describe() can also fail when acquiring the mutex gets interrupted so always returning 0 in dma_buf_show() is wrong, too. Fix both issues by avoiding the indirection via dma_buf_show() and call dma_buf_describe() directly. Rename it to dma_buf_debug_show() to get it in line with the other functions. This type mismatch was caught by the PaX RAP plugin. Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Brad Spengler <spender@grsecurity.net> Cc: PaX Team <pageexec@freemail.hu> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
-rw-r--r--drivers/dma-buf/dma-buf.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 6355ab38d630..7094b19bb495 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -824,7 +824,7 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
824EXPORT_SYMBOL_GPL(dma_buf_vunmap); 824EXPORT_SYMBOL_GPL(dma_buf_vunmap);
825 825
826#ifdef CONFIG_DEBUG_FS 826#ifdef CONFIG_DEBUG_FS
827static int dma_buf_describe(struct seq_file *s) 827static int dma_buf_debug_show(struct seq_file *s, void *unused)
828{ 828{
829 int ret; 829 int ret;
830 struct dma_buf *buf_obj; 830 struct dma_buf *buf_obj;
@@ -879,17 +879,9 @@ static int dma_buf_describe(struct seq_file *s)
879 return 0; 879 return 0;
880} 880}
881 881
882static int dma_buf_show(struct seq_file *s, void *unused)
883{
884 void (*func)(struct seq_file *) = s->private;
885
886 func(s);
887 return 0;
888}
889
890static int dma_buf_debug_open(struct inode *inode, struct file *file) 882static int dma_buf_debug_open(struct inode *inode, struct file *file)
891{ 883{
892 return single_open(file, dma_buf_show, inode->i_private); 884 return single_open(file, dma_buf_debug_show, NULL);
893} 885}
894 886
895static const struct file_operations dma_buf_debug_fops = { 887static const struct file_operations dma_buf_debug_fops = {
@@ -913,7 +905,7 @@ static int dma_buf_init_debugfs(void)
913 return err; 905 return err;
914 } 906 }
915 907
916 err = dma_buf_debugfs_create_file("bufinfo", dma_buf_describe); 908 err = dma_buf_debugfs_create_file("bufinfo", NULL);
917 909
918 if (err) 910 if (err)
919 pr_debug("dma_buf: debugfs: failed to create node bufinfo\n"); 911 pr_debug("dma_buf: debugfs: failed to create node bufinfo\n");