summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-08-15 17:43:27 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-08-15 21:45:05 +0200
commitbddd6bb95ef6eb521e2d3dbb70b368b6430f0552 (patch)
tree7014048e16b597d3de8b1ee83d0a81063f09da9d /pimd/pim_cmd.c
parentpimd: pim_upstream_add up must exist (diff)
downloadfrr-bddd6bb95ef6eb521e2d3dbb70b368b6430f0552.tar.xz
frr-bddd6bb95ef6eb521e2d3dbb70b368b6430f0552.zip
pimd: vrf may be NULL from pim_cmd_lookup_vrf
The call into pim_cmd_lookup_vrf may be NULL and dereferencing it before ensuring that the vrf pointer is non-NULL is a good way to crash. A crash can be initiated in pim: eva# show ip msdp vrf NOEXIST mesh-group vtysh: error reading from pimd: Permission denied (13)Warning: closing connection to pimd because of an I/O error! eva# 2022/08/15 11:47:38 [PHJDC-499N2][EC 100663314] STARVATION: task vtysh_rl_read (560b77f76de6) ran for 16777ms (cpu time 0ms) eva# Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a3188128f..c2453efa0 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5526,12 +5526,13 @@ DEFUN (show_ip_msdp_mesh_group,
int idx = 2;
struct pim_msdp_mg *mg;
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- struct pim_instance *pim = vrf->info;
+ struct pim_instance *pim;
struct json_object *json = NULL;
if (!vrf)
return CMD_WARNING;
+ pim = vrf->info;
/* Quick case: list is empty. */
if (SLIST_EMPTY(&pim->msdp.mglist)) {
if (uj)