diff options
author | hunt <hunt> | 2007-07-09 14:49:15 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-07-09 14:49:15 +0000 |
commit | 150990c50e7e473760d8129c8aac4428932afa6a (patch) | |
tree | 09e9c073ffb3d0c5521424a3188bac6549e46e35 | |
parent | 8a2b19ab2436e4e231302815b6268101878c3073 (diff) | |
download | systemtap-steved-150990c50e7e473760d8129c8aac4428932afa6a.tar.gz systemtap-steved-150990c50e7e473760d8129c8aac4428932afa6a.tar.xz systemtap-steved-150990c50e7e473760d8129c8aac4428932afa6a.zip |
2007-07-09 Martin Hunt <hunt@redhat.com>
* symbols.c (_stp_ins_module): Check for overflow of
modules array.
(_stp_do_module): If _stp_ins_module() fails, return an error.
-rw-r--r-- | runtime/transport/ChangeLog | 6 | ||||
-rw-r--r-- | runtime/transport/symbols.c | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 14e12948..b34dc294 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,9 @@ +2007-07-09 Martin Hunt <hunt@redhat.com> + + * symbols.c (_stp_ins_module): Check for overflow of + modules array. + (_stp_do_module): If _stp_ins_module() fails, return an error. + 2007-07-02 Martin Hunt <hunt@redhat.com> * symbols.c (_stp_do_symbols): Set "data" pointer for kernel to _etext. diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 1c61db7b..323b4872 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -378,15 +378,22 @@ static int _stp_module_exists(struct _stp_module *mod) return 0; } -static void _stp_ins_module(struct _stp_module *mod) +static int _stp_ins_module(struct _stp_module *mod) { - int i, num, res; + int i, num, res, ret = 0; unsigned long flags; // kbug("insert %s\n", mod->name); STP_LOCK_MODULES; + /* check for overflow */ + if (_stp_num_modules == STP_MAX_MODULES) { + errk("Exceeded the limit of %d modules\n", STP_MAX_MODULES); + ret = -ENOMEM; + goto done; + } + /* insert alphabetically in _stp_modules[] */ for (num = 1; num < _stp_num_modules; num++) { res = strcmp(_stp_modules[num]->name, mod->name); @@ -412,7 +419,9 @@ static void _stp_ins_module(struct _stp_module *mod) _stp_num_modules++; +done: STP_UNLOCK_MODULES; + return ret; } @@ -462,7 +471,8 @@ static int _stp_do_module(const char __user *buf, int count) return 0; } - _stp_ins_module(mod); + if (_stp_ins_module(mod) < 0) + return -ENOMEM; return count; } |