From: Julian Anastasov <ja@ssi.bg>
To: Peilin Ye <yepeilin.cs@gmail.com>
Cc: Wensong Zhang <wensong@linux-vs.org>,
coreteam@netfilter.org, syzkaller-bugs@googlegroups.com,
Florian Westphal <fw@strlen.de>,
linux-kernel@vger.kernel.org,
Jozsef Kadlecsik <kadlec@netfilter.org>,
lvs-devel@vger.kernel.org, Simon Horman <horms@verge.net.au>,
netfilter-devel@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Cong Wang <xiyou.wangcong@gmail.com>,
netdev@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
"David S. Miller" <davem@davemloft.net>,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [Linux-kernel-mentees] [PATCH net-next v2] ipvs: Fix uninit-value in do_ip_vs_set_ctl()
Date: Tue, 11 Aug 2020 13:29:04 +0300 (EEST) [thread overview]
Message-ID: <alpine.LFD.2.23.451.2008111324570.7428@ja.home.ssi.bg> (raw)
In-Reply-To: <20200811074640.841693-1-yepeilin.cs@gmail.com>
Hello,
On Tue, 11 Aug 2020, Peilin Ye wrote:
> do_ip_vs_set_ctl() is referencing uninitialized stack value when `len` is
> zero. Fix it.
>
> Reported-by: syzbot+23b5f9e7caf61d9a3898@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?id=46ebfb92a8a812621a001ef04d90dfa459520fe2
> Suggested-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Looks good to me, thanks!
Acked-by: Julian Anastasov <ja@ssi.bg>
> ---
> Changes in v2:
> - Target net-next tree. (Suggested by Julian Anastasov <ja@ssi.bg>)
> - Reject all `len == 0` requests except `IP_VS_SO_SET_FLUSH`, instead
> of initializing `arg`. (Suggested by Cong Wang
> <xiyou.wangcong@gmail.com>, Julian Anastasov <ja@ssi.bg>)
>
> net/netfilter/ipvs/ip_vs_ctl.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 412656c34f20..beeafa42aad7 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -2471,6 +2471,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
> /* Set timeout values for (tcp tcpfin udp) */
> ret = ip_vs_set_timeout(ipvs, (struct ip_vs_timeout_user *)arg);
> goto out_unlock;
> + } else if (!len) {
> + /* No more commands with len == 0 below */
> + ret = -EINVAL;
> + goto out_unlock;
> }
>
> usvc_compat = (struct ip_vs_service_user *)arg;
> @@ -2547,9 +2551,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
> break;
> case IP_VS_SO_SET_DELDEST:
> ret = ip_vs_del_dest(svc, &udest);
> - break;
> - default:
> - ret = -EINVAL;
> }
>
> out_unlock:
> --
> 2.25.1
Regards
--
Julian Anastasov <ja@ssi.bg>
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-08-11 10:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-10 22:07 [Linux-kernel-mentees] [PATCH net] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Peilin Ye
2020-08-11 3:57 ` Cong Wang
2020-08-11 5:09 ` Peilin Ye
2020-08-11 6:58 ` Julian Anastasov
2020-08-11 7:19 ` Peilin Ye
2020-08-11 7:46 ` [Linux-kernel-mentees] [PATCH net-next v2] " Peilin Ye
2020-08-11 10:29 ` Julian Anastasov [this message]
2020-08-11 12:59 ` Simon Horman
2020-08-13 1:28 ` Pablo Neira Ayuso
2020-08-28 17:21 ` Pablo Neira Ayuso
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=alpine.LFD.2.23.451.2008111324570.7428@ja.home.ssi.bg \
--to=ja@ssi.bg \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=horms@verge.net.au \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=wensong@linux-vs.org \
--cc=xiyou.wangcong@gmail.com \
--cc=yepeilin.cs@gmail.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: 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).