Date: Mon, 15 Apr 2013 14:23:02 GMT From: Luiz Otavio O Souza <loos.br@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/177872: [etherswitchcfg] [patch] etherswitchcfg(8) crashes if called with no argument for vlangroups members Message-ID: <201304151423.r3FEN2Q5034086@red.freebsd.org> Resent-Message-ID: <201304151430.r3FEU0iO056428@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 177872 >Category: kern >Synopsis: [etherswitchcfg] [patch] etherswitchcfg(8) crashes if called with no argument for vlangroups members >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Apr 15 14:30:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Luiz Otavio O Souza >Release: -HEAD r248943 >Organization: >Environment: FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013 root@devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U mips >Description: etherswitchcfg(8) crashes when you don't set vlangroup members. >How-To-Repeat: root@rb433:~ # etherswitchcfg vlangroup1 members Apr 15 14:11:50 rb433 kernel: BAD_PAGE_FAULT: pid 973 tid 100050 (etherswitchcfg), uid 0: pc 0x405837e0 got a read fault (type 0x2) at 0 Apr 15 14:11:50 rb433 kernel: Trapframe Register Dump: Apr 15 14:11:50 rb433 kernel: zero: 0 at: 0x405dd5fc v0: 0x414058 v1: 0x414018 Apr 15 14:11:50 rb433 kernel: a0: 0 a1: 0x4031a0 a2: 0 a3: 0 Apr 15 14:11:50 rb433 kernel: t0: 0 t1: 0 t2: 0xccccccc t3: 0xffffffffcccccccc Apr 15 14:11:50 rb433 kernel: t4: 0x1 t5: 0 t6: 0x738 t7: 0x401de0 Apr 15 14:11:50 rb433 kernel: t8: 0x18 t9: 0x405837e0 s0: 0 s1: 0x2 Apr 15 14:11:50 rb433 kernel: s2: 0x4 s3: 0x7ffedc20 s4: 0x1 s5: 0x7fffdd1c Apr 15 14:11:50 rb433 kernel: s6: 0x7ffedc20 s7: 0x401984 k0: 0 k1: 0 Apr 15 14:11:50 rb433 kernel: gp: 0x41c980 sp: 0x7ffedbc0 s8: 0x403504 ra: 0x400c8c Apr 15 14:11:50 rb433 kernel: sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 Apr 15 14:11:51 rb433 kernel: cause: 0x8 pc: 0x405837e0 Apr 15 14:11:51 rb433 kernel: Page table info for pc address 0x405837e0: pde = 0x827c6000, pte = 0xa0044f1a Apr 15 14:11:51 rb433 kernel: Dumping 4 words starting at pc address 0x405837e0: Apr 15 14:11:51 rb433 kernel: 90880000 1100000b 90a90000 15090007 Apr 15 14:11:51 rb433 kernel: Page table info for bad address 0: pde = 0, pte = 0 Segmentation fault (core dumped) >Fix: Apply the attached patch which check for this condition and exit cleanly. Patch attached with submission follows: Index: sbin/etherswitchcfg/etherswitchcfg.c =================================================================== --- sbin/etherswitchcfg/etherswitchcfg.c (revision 241720) +++ sbin/etherswitchcfg/etherswitchcfg.c (working copy) @@ -216,7 +216,9 @@ int member, untagged; char *c, *d; int v; - + + if (!argv[1]) + errx(EX_USAGE, "Members option need an argument"); member = untagged = 0; if (strcmp(argv[1], "none") != 0) { for (c=argv[1]; *c; c=d) { >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304151423.r3FEN2Q5034086>