]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/relay.c
cpufreq: Avoid leaving stale IRQ work items during CPU offline
[mirror_ubuntu-bionic-kernel.git] / kernel / relay.c
index 39a9dfc69486b57a85d115dcefee75d35907a74d..61d37e6da22dd1c30a7f15f28ec3bdfc5c17f9b0 100644 (file)
@@ -163,7 +163,7 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan)
 {
        struct rchan_buf *buf;
 
-       if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
+       if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *))
                return NULL;
 
        buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
@@ -427,6 +427,8 @@ static struct dentry *relay_create_buf_file(struct rchan *chan,
        dentry = chan->cb->create_buf_file(tmpname, chan->parent,
                                           S_IRUSR, buf,
                                           &chan->is_global);
+       if (IS_ERR(dentry))
+               dentry = NULL;
 
        kfree(tmpname);
 
@@ -460,7 +462,7 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
                dentry = chan->cb->create_buf_file(NULL, NULL,
                                                   S_IRUSR, buf,
                                                   &chan->is_global);
-               if (WARN_ON(dentry))
+               if (IS_ERR_OR_NULL(dentry))
                        goto free_buf;
        }
 
@@ -611,7 +613,6 @@ free_bufs:
 
        kref_put(&chan->kref, relay_destroy_channel);
        mutex_unlock(&relay_channels_mutex);
-       kfree(chan);
        return NULL;
 }
 EXPORT_SYMBOL_GPL(relay_open);