From: Paolo Abeni <pabeni@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
stable <stable@kernel.org>
Subject: Re: [PATCH net] ipv4: clamp MCAST_MSFILTER getsockopt to optlen, not gf_numsrc
Date: Thu, 23 Apr 2026 15:57:55 +0200 [thread overview]
Message-ID: <17e348e1-b551-41e4-a512-906109dded4d@redhat.com> (raw)
In-Reply-To: <2026042054-dime-spectator-820e@gregkh>
On 4/20/26 9:26 PM, Greg Kroah-Hartman wrote:
> @@ -1486,8 +1491,12 @@ static int compat_ip_get_mcast_msfilter(struct sock *sk, sockptr_t optval,
> gf.gf_interface = gf32.gf_interface;
> gf.gf_fmode = gf32.gf_fmode;
> num = gf.gf_numsrc = gf32.gf_numsrc;
> - gf.gf_group = gf32.gf_group;
>
> + if (num > (len - size0) / sizeof(struct sockaddr_storage))
> + num = (len - size0) / sizeof(struct sockaddr_storage);
> + gf.gf_numsrc = num;
Since this is exactly the same code added above, likely a common helper
would be useful.
I guess we don't care if this would break bad application passing optval
area properly sized for gf_numsrc sockets and a small optval, right? I
don't see how to eventually save them.
/P
next prev parent reply other threads:[~2026-04-23 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 19:26 [PATCH net] ipv4: clamp MCAST_MSFILTER getsockopt to optlen, not gf_numsrc Greg Kroah-Hartman
2026-04-23 13:57 ` Paolo Abeni [this message]
2026-04-23 14:18 ` Greg Kroah-Hartman
2026-04-23 14:29 ` Paolo Abeni
2026-04-23 15:06 ` Greg Kroah-Hartman
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=17e348e1-b551-41e4-a512-906109dded4d@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@kernel.org \
/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