diff options
| author | Roopa Prabhu <roopa@cumulusnetworks.com> | 2015-02-06 01:24:45 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-02-08 01:49:47 -0500 |
| commit | 1fd0bddb618aa970b87e7907a5703682aa119a6f (patch) | |
| tree | d8ed10105a874cdee1f6a7aa290ccc655c22d257 /net/bridge/br_netlink.c | |
| parent | d78f802f18ed100c53f331cd59791cd82ccb9438 (diff) | |
bridge: add missing bridge port check for offloads
This patch fixes a missing bridge port check caught by smatch.
setlink/dellink of attributes like vlans can come for a bridge device
and there is no need to offload those today. So, this patch adds a bridge
port check. (In these cases however, the BRIDGE_SELF flags will always be set
and we may not hit a problem with the current code).
smatch complaint:
The patch 68e331c785b8: "bridge: offload bridge port attributes to
switch asic if feature flag set" from Jan 29, 2015, leads to the
following Smatch complaint:
net/bridge/br_netlink.c:552 br_setlink()
error: we previously assumed 'p' could be null (see line 518)
net/bridge/br_netlink.c
517
518 if (p && protinfo) {
^
Check for NULL.
Reported-By: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_netlink.c')
| -rw-r--r-- | net/bridge/br_netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index b93f42c515da..4fbcea0e7ecb 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
| @@ -543,7 +543,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags) | |||
| 543 | afspec, RTM_SETLINK); | 543 | afspec, RTM_SETLINK); |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | if (!(flags & BRIDGE_FLAGS_SELF)) { | 546 | if (p && !(flags & BRIDGE_FLAGS_SELF)) { |
| 547 | /* set bridge attributes in hardware if supported | 547 | /* set bridge attributes in hardware if supported |
| 548 | */ | 548 | */ |
| 549 | ret_offload = netdev_switch_port_bridge_setlink(dev, nlh, | 549 | ret_offload = netdev_switch_port_bridge_setlink(dev, nlh, |
| @@ -583,7 +583,7 @@ int br_dellink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags) | |||
| 583 | */ | 583 | */ |
| 584 | br_ifinfo_notify(RTM_NEWLINK, p); | 584 | br_ifinfo_notify(RTM_NEWLINK, p); |
| 585 | 585 | ||
| 586 | if (!(flags & BRIDGE_FLAGS_SELF)) { | 586 | if (p && !(flags & BRIDGE_FLAGS_SELF)) { |
| 587 | /* del bridge attributes in hardware | 587 | /* del bridge attributes in hardware |
| 588 | */ | 588 | */ |
| 589 | ret_offload = netdev_switch_port_bridge_dellink(dev, nlh, | 589 | ret_offload = netdev_switch_port_bridge_dellink(dev, nlh, |
