OSDN Git Service

crypto: talitos - HMAC SNOOP NO AFEU mode requires SW icv checking.
[android-x86/kernel.git] / kernel / relay.c
index da79a10..91e8fbf 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);
@@ -611,7 +611,6 @@ free_bufs:
 
        kref_put(&chan->kref, relay_destroy_channel);
        mutex_unlock(&relay_channels_mutex);
-       kfree(chan);
        return NULL;
 }
 EXPORT_SYMBOL_GPL(relay_open);
@@ -809,11 +808,11 @@ void relay_subbufs_consumed(struct rchan *chan,
 {
        struct rchan_buf *buf;
 
-       if (!chan)
+       if (!chan || cpu >= NR_CPUS)
                return;
 
        buf = *per_cpu_ptr(chan->buf, cpu);
-       if (cpu >= NR_CPUS || !buf || subbufs_consumed > chan->n_subbufs)
+       if (!buf || subbufs_consumed > chan->n_subbufs)
                return;
 
        if (subbufs_consumed > buf->subbufs_produced - buf->subbufs_consumed)