Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / sound / core / info.c
index 895362a..8ab72e0 100644 (file)
@@ -325,10 +325,15 @@ static ssize_t snd_info_text_entry_write(struct file *file,
        size_t next;
        int err = 0;
 
+       if (!entry->c.text.write)
+               return -EIO;
        pos = *offset;
        if (!valid_pos(pos, count))
                return -EIO;
        next = pos + count;
+       /* don't handle too large text inputs */
+       if (next > 16 * 1024)
+               return -EIO;
        mutex_lock(&entry->access);
        buf = data->wbuffer;
        if (!buf) {
@@ -366,7 +371,9 @@ static int snd_info_seq_show(struct seq_file *seq, void *p)
        struct snd_info_private_data *data = seq->private;
        struct snd_info_entry *entry = data->entry;
 
-       if (entry->c.text.read) {
+       if (!entry->c.text.read) {
+               return -EIO;
+       } else {
                data->rbuffer->buffer = (char *)seq; /* XXX hack! */
                entry->c.text.read(entry, data->rbuffer);
        }