aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback/xenbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/xen-netback/xenbus.c')
-rw-r--r--drivers/net/xen-netback/xenbus.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 580517d857bf..9c47b897b6d2 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -116,6 +116,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v)
116} 116}
117 117
118#define XENVIF_KICK_STR "kick" 118#define XENVIF_KICK_STR "kick"
119#define BUFFER_SIZE 32
119 120
120static ssize_t 121static ssize_t
121xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count, 122xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
@@ -124,22 +125,24 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
124 struct xenvif_queue *queue = 125 struct xenvif_queue *queue =
125 ((struct seq_file *)filp->private_data)->private; 126 ((struct seq_file *)filp->private_data)->private;
126 int len; 127 int len;
127 char write[sizeof(XENVIF_KICK_STR)]; 128 char write[BUFFER_SIZE];
128 129
129 /* don't allow partial writes and check the length */ 130 /* don't allow partial writes and check the length */
130 if (*ppos != 0) 131 if (*ppos != 0)
131 return 0; 132 return 0;
132 if (count < sizeof(XENVIF_KICK_STR) - 1) 133 if (count >= sizeof(write))
133 return -ENOSPC; 134 return -ENOSPC;
134 135
135 len = simple_write_to_buffer(write, 136 len = simple_write_to_buffer(write,
136 sizeof(write), 137 sizeof(write) - 1,
137 ppos, 138 ppos,
138 buf, 139 buf,
139 count); 140 count);
140 if (len < 0) 141 if (len < 0)
141 return len; 142 return len;
142 143
144 write[len] = '\0';
145
143 if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1)) 146 if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1))
144 xenvif_interrupt(0, (void *)queue); 147 xenvif_interrupt(0, (void *)queue);
145 else { 148 else {
@@ -171,10 +174,9 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
171 .write = xenvif_write_io_ring, 174 .write = xenvif_write_io_ring,
172}; 175};
173 176
174static void xenvif_debugfs_addif(struct xenvif_queue *queue) 177static void xenvif_debugfs_addif(struct xenvif *vif)
175{ 178{
176 struct dentry *pfile; 179 struct dentry *pfile;
177 struct xenvif *vif = queue->vif;
178 int i; 180 int i;
179 181
180 if (IS_ERR_OR_NULL(xen_netback_dbg_root)) 182 if (IS_ERR_OR_NULL(xen_netback_dbg_root))
@@ -733,10 +735,11 @@ static void connect(struct backend_info *be)
733 be->vif->num_queues = queue_index; 735 be->vif->num_queues = queue_index;
734 goto err; 736 goto err;
735 } 737 }
738 }
739
736#ifdef CONFIG_DEBUG_FS 740#ifdef CONFIG_DEBUG_FS
737 xenvif_debugfs_addif(queue); 741 xenvif_debugfs_addif(be->vif);
738#endif /* CONFIG_DEBUG_FS */ 742#endif /* CONFIG_DEBUG_FS */
739 }
740 743
741 /* Initialisation completed, tell core driver the number of 744 /* Initialisation completed, tell core driver the number of
742 * active queues. 745 * active queues.