diff options
author | hunt <hunt> | 2005-05-18 05:37:14 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-05-18 05:37:14 +0000 |
commit | f4ead4c17fd6e680975bbc071138fa829b7f6745 (patch) | |
tree | e7d6b8be8b99d59edf5019369667beeef00fd51b /runtime/relayfs/relay.c | |
parent | f1a8ce9fda66ec5a3295a4b79ff3f3ec0195d994 (diff) | |
download | systemtap-steved-f4ead4c17fd6e680975bbc071138fa829b7f6745.tar.gz systemtap-steved-f4ead4c17fd6e680975bbc071138fa829b7f6745.tar.xz systemtap-steved-f4ead4c17fd6e680975bbc071138fa829b7f6745.zip |
2005-05-17 Martin Hunt <hunt@redhat.com>
* relay.c (relay_switch_subbuf): Applied patch
[PATCH 2.6.12-rc1-mm2] relayfs: properly handle oversized events
Diffstat (limited to 'runtime/relayfs/relay.c')
-rw-r--r-- | runtime/relayfs/relay.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/relayfs/relay.c b/runtime/relayfs/relay.c index 35a5f31d..5998db80 100644 --- a/runtime/relayfs/relay.c +++ b/runtime/relayfs/relay.c @@ -378,7 +378,10 @@ unsigned relay_switch_subbuf(struct rchan_buf *buf, unsigned length) int new, old, produced = atomic_read(&buf->subbufs_produced); unsigned padding; - if (atomic_read(&buf->unfull)) { + if (unlikely(length > buf->chan->subbuf_size)) + goto toobig; + + if (unlikely(atomic_read(&buf->unfull))) { atomic_set(&buf->unfull, 0); new = produced % buf->chan->n_subbufs; old = (produced - 1) % buf->chan->n_subbufs; @@ -410,7 +413,15 @@ unsigned relay_switch_subbuf(struct rchan_buf *buf, unsigned length) new = (produced + 1) % buf->chan->n_subbufs; do_switch(buf, new, old); + if (unlikely(length + buf->offset > buf->chan->subbuf_size)) + goto toobig; + return length; + + toobig: + printk(KERN_WARNING "relayfs: event too large (%u)\n", length); + WARN_ON(1); + return 0; } /** |