diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/transport/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/transport/control.c | 5 | ||||
-rw-r--r-- | runtime/transport/transport.h | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index b720b112..b03b4b0a 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,8 @@ +2007-09-20 Martin Hunt <hunt@redhat.com> + + * transport.h: Increase default buffer size. + * control.c (_stp_ctl_read_cmd): Check buffer size. + 2007-09-10 Martin Hunt <hunt@redhat.com> * procfs.c (_stp_register_ctl_channel): Call diff --git a/runtime/transport/control.c b/runtime/transport/control.c index 5242af49..6df9a8af 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -195,8 +195,6 @@ _stp_ctl_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *pp int len; unsigned long flags; - /* FIXME FIXME FIXME. assuming count is large enough to hold buffer!! */ - /* wait for nonempty ready queue */ spin_lock_irqsave(&_stp_ready_lock, flags); while (list_empty(&_stp_ready_q)) { @@ -215,11 +213,12 @@ _stp_ctl_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *pp /* write it out */ len = bptr->len + 4; - if (copy_to_user(buf, &bptr->type, len)) { + if (len > count || copy_to_user(buf, &bptr->type, len)) { /* now what? We took it off the queue then failed to send it */ /* we can't put it back on the queue because it will likely be out-of-order */ /* fortunately this should never happen */ /* FIXME need to mark this as a transport failure */ + errk("Supplied buffer too small. count:%d len:%d\n", count, len); return -EFAULT; } diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h index 78b01181..0a83001e 100644 --- a/runtime/transport/transport.h +++ b/runtime/transport/transport.h @@ -14,8 +14,8 @@ void _stp_warn (const char *fmt, ...); /* how often the work queue wakes up and checks buffers */ #define STP_WORK_TIMER (HZ/100) -static unsigned _stp_nsubbufs = 4; -static unsigned _stp_subbuf_size = 65536*2; +static unsigned _stp_nsubbufs = 8; +static unsigned _stp_subbuf_size = 65536*4; extern void _stp_transport_close(void); extern int _stp_print_init(void); extern void _stp_print_cleanup(void); |