From: Horatiu Vultur <horatiu.vultur@microchip.com> To: <nikolay@cumulusnetworks.com>, <roopa@cumulusnetworks.com>, <davem@davemloft.net>, <kuba@kernel.org>, <andrew@lunn.ch>, <UNGLinuxDriver@microchip.com>, <bridge@lists.linux-foundation.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Cc: Horatiu Vultur <horatiu.vultur@microchip.com>, <syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com> Subject: [PATCH] bridge: mrp: Fix out-of-bounds read in br_mrp_parse Date: Mon, 25 May 2020 09:55:41 +0000 [thread overview] Message-ID: <20200525095541.46673-1-horatiu.vultur@microchip.com> (raw) The issue was reported by syzbot. When the function br_mrp_parse was called with a valid net_bridge_port, the net_bridge was an invalid pointer. Therefore the check br->stp_enabled could pass/fail depending where it was pointing in memory. The fix consists of setting the net_bridge pointer if the port is a valid pointer. Reported-by: syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com Fixes: 6536993371fa ("bridge: mrp: Integrate MRP into the bridge") Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- net/bridge/br_mrp_netlink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/bridge/br_mrp_netlink.c b/net/bridge/br_mrp_netlink.c index 397e7f710772a..4a08a99519b04 100644 --- a/net/bridge/br_mrp_netlink.c +++ b/net/bridge/br_mrp_netlink.c @@ -27,6 +27,12 @@ int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p, struct nlattr *tb[IFLA_BRIDGE_MRP_MAX + 1]; int err; + /* When this function is called for a port then the br pointer is + * invalid, therefor set the br to point correctly + */ + if (p) + br = p->br; + if (br->stp_enabled != BR_NO_STP) { NL_SET_ERR_MSG_MOD(extack, "MRP can't be enabled if STP is already enabled"); return -EINVAL; -- 2.26.2
WARNING: multiple messages have this Message-ID (diff)
From: Horatiu Vultur <horatiu.vultur@microchip.com> To: nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com, davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, UNGLinuxDriver@microchip.com, bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com, Horatiu Vultur <horatiu.vultur@microchip.com> Subject: [Bridge] [PATCH] bridge: mrp: Fix out-of-bounds read in br_mrp_parse Date: Mon, 25 May 2020 09:55:41 +0000 [thread overview] Message-ID: <20200525095541.46673-1-horatiu.vultur@microchip.com> (raw) The issue was reported by syzbot. When the function br_mrp_parse was called with a valid net_bridge_port, the net_bridge was an invalid pointer. Therefore the check br->stp_enabled could pass/fail depending where it was pointing in memory. The fix consists of setting the net_bridge pointer if the port is a valid pointer. Reported-by: syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com Fixes: 6536993371fa ("bridge: mrp: Integrate MRP into the bridge") Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- net/bridge/br_mrp_netlink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/bridge/br_mrp_netlink.c b/net/bridge/br_mrp_netlink.c index 397e7f710772a..4a08a99519b04 100644 --- a/net/bridge/br_mrp_netlink.c +++ b/net/bridge/br_mrp_netlink.c @@ -27,6 +27,12 @@ int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p, struct nlattr *tb[IFLA_BRIDGE_MRP_MAX + 1]; int err; + /* When this function is called for a port then the br pointer is + * invalid, therefor set the br to point correctly + */ + if (p) + br = p->br; + if (br->stp_enabled != BR_NO_STP) { NL_SET_ERR_MSG_MOD(extack, "MRP can't be enabled if STP is already enabled"); return -EINVAL; -- 2.26.2
next reply other threads:[~2020-05-25 7:56 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-25 9:55 Horatiu Vultur [this message] 2020-05-25 9:55 ` [Bridge] [PATCH] bridge: mrp: Fix out-of-bounds read in br_mrp_parse Horatiu Vultur 2020-05-25 8:34 ` Nikolay Aleksandrov 2020-05-25 8:34 ` [Bridge] " Nikolay Aleksandrov 2020-05-26 1:10 ` David Miller 2020-05-26 1:10 ` [Bridge] " David Miller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200525095541.46673-1-horatiu.vultur@microchip.com \ --to=horatiu.vultur@microchip.com \ --cc=UNGLinuxDriver@microchip.com \ --cc=andrew@lunn.ch \ --cc=bridge@lists.linux-foundation.org \ --cc=davem@davemloft.net \ --cc=kuba@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=nikolay@cumulusnetworks.com \ --cc=roopa@cumulusnetworks.com \ --cc=syzbot+9c6f0f1f8e32223df9a4@syzkaller.appspotmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.