[LEDE-DEV] [PATCH netifd] proto: allow dumping protocol handlers without config_params
Hans Dedecker
dedeckeh at gmail.com
Wed Jan 3 13:14:29 PST 2018
On Wed, Jan 3, 2018 at 10:35 AM, Olof Sivertsson <osivertsson at gmail.com> wrote:
> When ubus invokes proto_dump_handlers, and a struct proto_handler has
> been added with a NULL config_params, a segmentation fault occurs.
>
> Avoid this segmentation fault by checking for a NULL config_params
> before further access.
Hi,
I'm unable to reproduce the reported netifd crash by using a proto
shell handler having no proto_init_config function.
Looking into the code the proto_handler config_params parameter is
always assigned the proto shell handler config pointer in the function
proto_shell_add_handler; afaict the config_parameter is not altered
further in the code.
Can you describe how you triggered the crash using a proto shell
handler implementation ?
Hans
>
> Signed-off-by: Olof Sivertsson <olof.sivertsson at zenterio.com>
> ---
> proto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/proto.c b/proto.c
> index 9eb31c5..6047735 100644
> --- a/proto.c
> +++ b/proto.c
> @@ -591,7 +591,7 @@ proto_dump_handlers(struct blob_buf *b)
> void *v;
>
> c = blobmsg_open_table(b, p->name);
> - if (p->config_params->validate) {
> + if (p->config_params && p->config_params->validate) {
> int i;
>
> v = blobmsg_open_table(b, "validate");
> --
> 2.15.1
>
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
More information about the Lede-dev
mailing list