From: David Miller <davem@davemloft.net>
To: phil@philpotter.co.uk
Cc: kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: tun: set tun->dev->addr_len during TUNSETLINK processing
Date: Mon, 05 Apr 2021 14:59:21 -0700 (PDT) [thread overview]
Message-ID: <20210405.145921.1248097047641627556.davem@davemloft.net> (raw)
In-Reply-To: <20210405113555.9419-1-phil@philpotter.co.uk>
From: Phillip Potter <phil@philpotter.co.uk>
Date: Mon, 5 Apr 2021 12:35:55 +0100
> When changing type with TUNSETLINK ioctl command, set tun->dev->addr_len
> to match the appropriate type, using new tun_get_addr_len utility function
> which returns appropriate address length for given type. Fixes a
> KMSAN-found uninit-value bug reported by syzbot at:
> https://syzkaller.appspot.com/bug?id=0766d38c656abeace60621896d705743aeefed51
>
> Reported-by: syzbot+001516d86dbe88862cec@syzkaller.appspotmail.com
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
> drivers/net/tun.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 978ac0981d16..56c26339ee3b 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -69,6 +69,14 @@
> #include <linux/bpf.h>
> #include <linux/bpf_trace.h>
> #include <linux/mutex.h>
> +#include <linux/ieee802154.h>
> +#include <linux/if_ltalk.h>
> +#include <uapi/linux/if_fddi.h>
> +#include <uapi/linux/if_hippi.h>
> +#include <uapi/linux/if_fc.h>
> +#include <net/ax25.h>
> +#include <net/rose.h>
> +#include <net/6lowpan.h>
>
> #include <linux/uaccess.h>
> #include <linux/proc_fs.h>
> @@ -2925,6 +2933,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> return __tun_set_ebpf(tun, prog_p, prog);
> }
>
> +/* Return correct value for tun->dev->addr_len based on tun->dev->type. */
> +static inline unsigned char tun_get_addr_len(unsigned short type)
> +{
Please do not use inline in foo.c files, let the compiler decide.
Thanks.
next prev parent reply other threads:[~2021-04-05 21:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 11:35 [PATCH] net: tun: set tun->dev->addr_len during TUNSETLINK processing Phillip Potter
2021-04-05 21:59 ` David Miller [this message]
2021-04-06 10:18 ` Phillip Potter
2021-04-06 17:26 ` Eric Dumazet
2021-04-06 17:38 ` Phillip Potter
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=20210405.145921.1248097047641627556.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=phil@philpotter.co.uk \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).