summaryrefslogtreecommitdiff
path: root/ofproto/bond.c
diff options
context:
space:
mode:
authorYunjian Wang <wangyunjian@huawei.com>2021-09-02 18:47:41 +0800
committerIlya Maximets <i.maximets@ovn.org>2021-09-16 01:18:21 +0200
commit81de3a81a06fd21e0473170f17c831b9ac5c884f (patch)
tree0d82c886d127a0292e669421666600e056e7b95d /ofproto/bond.c
parent3168f328c78cf6e4b3022940452673b0e49f7620 (diff)
downloadopenvswitch-81de3a81a06fd21e0473170f17c831b9ac5c884f.tar.gz
bond: Check for NULL member in bond_member_set_enable().
The function bond_member_lookup() could return NULL, the return value need to be checked. Found by Coverity. Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto/bond.c')
-rw-r--r--ofproto/bond.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ofproto/bond.c b/ofproto/bond.c
index a4116588f..2dcfeda71 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -672,8 +672,13 @@ out:
void
bond_member_set_may_enable(struct bond *bond, void *member_, bool may_enable)
{
+ struct bond_member *member;
+
ovs_rwlock_wrlock(&rwlock);
- bond_member_lookup(bond, member_)->may_enable = may_enable;
+ member = bond_member_lookup(bond, member_);
+ if (member) {
+ member->may_enable = may_enable;
+ }
ovs_rwlock_unlock(&rwlock);
}