diff mbox series

[net] net: rtnetlink: address is mandatory for rtnl_fdb_get

Message ID 20181230123320.32484-1-nikolay@cumulusnetworks.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net] net: rtnetlink: address is mandatory for rtnl_fdb_get | expand

Commit Message

Nikolay Aleksandrov Dec. 30, 2018, 12:33 p.m. UTC
We must have an address to lookup otherwise we'll derefence a null
pointer in the ndo_fdb_get callbacks.

CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: David Ahern <dsa@cumulusnetworks.com>
Reported-by: syzbot+017b1f61c82a1c3e7efd@syzkaller.appspotmail.com
Fixes: 5b2f94b27622 ("net: rtnetlink: support for fdb get")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 net/core/rtnetlink.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Roopa Prabhu Dec. 30, 2018, 7:10 p.m. UTC | #1
On Sun, Dec 30, 2018 at 4:33 AM Nikolay Aleksandrov
<nikolay@cumulusnetworks.com> wrote:
>
> We must have an address to lookup otherwise we'll derefence a null
> pointer in the ndo_fdb_get callbacks.
>
> CC: Roopa Prabhu <roopa@cumulusnetworks.com>
> CC: David Ahern <dsa@cumulusnetworks.com>
> Reported-by: syzbot+017b1f61c82a1c3e7efd@syzkaller.appspotmail.com
> Fixes: 5b2f94b27622 ("net: rtnetlink: support for fdb get")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>

Thanks Nikolay!.



> ---
>  net/core/rtnetlink.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 48f61885fd6f..5ea1bed08ede 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -4104,6 +4104,11 @@ static int rtnl_fdb_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
>         if (err < 0)
>                 return err;
>
> +       if (!addr) {
> +               NL_SET_ERR_MSG(extack, "Missing lookup address for fdb get request");
> +               return -EINVAL;
> +       }
> +
>         if (brport_idx) {
>                 dev = __dev_get_by_index(net, brport_idx);
>                 if (!dev) {
> --
> 2.19.2
>
David Miller Dec. 30, 2018, 7:36 p.m. UTC | #2
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Sun, 30 Dec 2018 14:33:20 +0200

> We must have an address to lookup otherwise we'll derefence a null
> pointer in the ndo_fdb_get callbacks.
> 
> CC: Roopa Prabhu <roopa@cumulusnetworks.com>
> CC: David Ahern <dsa@cumulusnetworks.com>
> Reported-by: syzbot+017b1f61c82a1c3e7efd@syzkaller.appspotmail.com
> Fixes: 5b2f94b27622 ("net: rtnetlink: support for fdb get")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 48f61885fd6f..5ea1bed08ede 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4104,6 +4104,11 @@  static int rtnl_fdb_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 	if (err < 0)
 		return err;
 
+	if (!addr) {
+		NL_SET_ERR_MSG(extack, "Missing lookup address for fdb get request");
+		return -EINVAL;
+	}
+
 	if (brport_idx) {
 		dev = __dev_get_by_index(net, brport_idx);
 		if (!dev) {