From: Simon Horman <horms@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-arm-msm@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
andersson@kernel.org, yimingqian591@gmail.com,
chris.lew@oss.qualcomm.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] net: qrtr: ns: Limit the maximum server registration per node
Date: Fri, 3 Apr 2026 09:52:26 +0100 [thread overview]
Message-ID: <20260403085226.GA26061@horms.kernel.org> (raw)
In-Reply-To: <20260403083009.GA11973@horms.kernel.org>
On Fri, Apr 03, 2026 at 09:30:09AM +0100, Simon Horman wrote:
> On Fri, Mar 27, 2026 at 03:40:01PM +0530, Manivannan Sadhasivam wrote:
> > On Fri, Mar 27, 2026 at 09:58:32AM +0000, Simon Horman wrote:
> > > On Wed, Mar 25, 2026 at 04:14:14PM +0530, Manivannan Sadhasivam wrote:
> > > > Current code does no bound checking on the number of servers added per
> > > > node. A malicious client can flood NEW_SERVER messages and exhaust memory.
> > > >
> > > > Fix this issue by limiting the maximum number of server registrations to
> > > > 256 per node. If the NEW_SERVER message is received for an old port, then
> > > > don't restrict it as it will get replaced.
> > > >
> > > > Note that the limit of 256 is chosen based on the current platform
> > > > requirements. If requirement changes in the future, this limit can be
> > > > increased.
> > > >
> > > > Cc: stable@vger.kernel.org
> > > > Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
> > > > Reported-by: Yiming Qian <yimingqian591@gmail.com>
> > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> > >
> > > Reviewed-by: Simon Horman <horms@kernel.org>
> > >
> > > > ---
> > > > net/qrtr/ns.c | 24 ++++++++++++++++++++----
> > > > 1 file changed, 20 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
> > > > index 3203b2220860..fb4e8a2d370d 100644
> > > > --- a/net/qrtr/ns.c
> > > > +++ b/net/qrtr/ns.c
> > > > @@ -67,8 +67,14 @@ struct qrtr_server {
> > > > struct qrtr_node {
> > > > unsigned int id;
> > > > struct xarray servers;
> > > > + u32 server_count;
> > > > };
> > > >
> > > > +/* Max server limit is chosen based on the current platform requirements. If the
> > > > + * requirement changes in the future, this value can be increased.
> > > > + */
> > > > +#define QRTR_NS_MAX_SERVERS 256
> > > > +
> > > > static struct qrtr_node *node_get(unsigned int node_id)
> > > > {
> > > > struct qrtr_node *node;
> > > > @@ -229,6 +235,17 @@ static struct qrtr_server *server_add(unsigned int service,
> > > > if (!service || !port)
> > > > return NULL;
> > > >
> > > > + node = node_get(node_id);
> > > > + if (!node)
> > > > + return NULL;
> > >
> > > This is not new behaviour added by patch, but If I understand things
> > > correctly, node_get will allocate a new node if one doesn't already exist
> > > for the node_id.
> > >
> >
> > Yes!
> >
> > > I am wondering if any bounds are placed on the number of nodes that can be
> > > created. And, if not, is this a point of concern from a memory exhaustion
> > > perspective?
> > >
> >
> > That's true. I plan to send a followup for that. This series just limits the
> > scope in addressing the reported issue.
>
> Thanks, sounds good to me.
>
> For this patch, feel free to add:
>
> Reviewed-by: Simon Horman <horms@kernel.org>
Sorry, I now see Jakub's comment on this.
So I'll review the revised series, addressing the concern above,
when it becomes available.
Feel free to include my Reviewed-by tags on patches that
don't change in a material way.
next prev parent reply other threads:[~2026-04-03 8:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260325104415.104972-1-manivannan.sadhasivam@oss.qualcomm.com>
2026-03-25 10:44 ` [PATCH 1/2] net: qrtr: ns: Limit the maximum server registration per node Manivannan Sadhasivam
2026-03-27 9:58 ` Simon Horman
2026-03-27 10:10 ` Manivannan Sadhasivam
2026-03-29 20:33 ` Jakub Kicinski
2026-04-03 8:30 ` Simon Horman
2026-04-03 8:52 ` Simon Horman [this message]
2026-03-29 20:33 ` Jakub Kicinski
2026-03-25 10:44 ` [PATCH 2/2] net: qrtr: ns: Limit the maximum lookups per socket Manivannan Sadhasivam
2026-03-27 10:07 ` Simon Horman
2026-03-27 10:17 ` Manivannan Sadhasivam
2026-04-03 8:32 ` Simon Horman
2026-03-29 20:33 ` Jakub Kicinski
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=20260403085226.GA26061@horms.kernel.org \
--to=horms@kernel.org \
--cc=andersson@kernel.org \
--cc=chris.lew@oss.qualcomm.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=yimingqian591@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