Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
To: Bjorn Andersson <quic_bjorande@quicinc.com>, <quic_clew@quicinc.com>
Cc: <mani@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>,
	<kuba@kernel.org>, <pabeni@redhat.com>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <quic_viswanat@quicinc.com>
Subject: Re: [PATCH net-next 1/2] net: qrtr: Prevent stale ports from sending
Date: Sun, 3 Sep 2023 17:52:07 +0530	[thread overview]
Message-ID: <d7b7f611-e15b-e7a0-ce99-bd6c90027853@quicinc.com> (raw)
In-Reply-To: <20230901141128.GO818859@hu-bjorande-lv.qualcomm.com>

Hi Bjorn,

On 9/1/2023 7:41 PM, Bjorn Andersson wrote:
> On Fri, Sep 01, 2023 at 03:50:20PM +0530, Sricharan Ramabadhran wrote:
>> From: Vignesh Viswanathan <quic_viswanat@quicinc.com>
>>
>> If qrtr and some other process try to bind to the QMI Control port at
> 
> It's unclear to me which "qrtr" is being referred here, could it be
> "qrtr-ns", if so could we express that as "the name server".
> 

  yes, its name-space server. Will put it explicitly.

> We only allow one bind on the qrtr control port, so could it be that
> "QMI Control port" refer to the control socket in the userspace QC[CS]I
> libraries, if so that's just any random socket sending out a control
> message.
> 
> Can we please rephrase this problem description to make the chain of
> events clear?
> 

   In this case we are talking about a client connecting/sending to QRTR
   socket and the 'NS' doing a qrtr_bind during its init. There is
   possibility that a client tries to send to the 'NS' before  processing
   the ENETRESET. In the case of a NEW_SERVER control message will
   reach the 'NS' and be forwarded to the firmware. The client will then
   process the ENETRESET closing and re-opening the socket which triggers
   a DEL_SERVER and then a second NEW_SERVER. This scenario will give an
   unnecessary disconnect to the clients on the firmware who were able to
   initialize on the first NEW_SERVER.

   Also about the patch #2, i guess QRTR_BYE/DEL_PROC should also be
   broadcasted, right now we are only listening on DEL_PROC sent by
   legacy kernels like SDX modems. Without that modem SSR feature is
   broken on IPQ + SDX targets.

>> the same time, NEW_SERVER might come before ENETRESET is given to the
>> socket. This might cause a socket down/up when ENETRESET is received as
>> per the protocol and this triggers a DEL_SERVER and a second NEW_SERVER.
>>
>> In order to prevent such messages from stale sockets being sent, check
>> if ENETRESET has been set on the socket and drop the packet.
>>
>> Signed-off-by: Chris Lew <quic_clew@quicinc.com>
>> Signed-off-by: Vignesh Viswanathan <quic_viswanat@quicinc.com>
> 
> The first person to certify the patch's origin, must be the author, and
> when you pick the patch to send it you need to add your s-o-b.
> 
> So please fix the author, and add your s-o-b.
> 

  ok sure, will fix.

> 
> Let's add Chris to the recipients list as well.
> 

  ok.

>> ---
>>   net/qrtr/af_qrtr.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
>> index 41ece61..26197a0 100644
>> --- a/net/qrtr/af_qrtr.c
>> +++ b/net/qrtr/af_qrtr.c
>> @@ -851,6 +851,7 @@ static int qrtr_local_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>>   {
>>   	struct qrtr_sock *ipc;
>>   	struct qrtr_cb *cb;
>> +	struct sock *sk = skb->sk;
>>   
>>   	ipc = qrtr_port_lookup(to->sq_port);
>>   	if (!ipc || &ipc->sk == skb->sk) { /* do not send to self */
>> @@ -860,6 +861,15 @@ static int qrtr_local_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>>   		return -ENODEV;
>>   	}
>>   
>> +	/* Keep resetting NETRESET until socket is closed */
>> +	if (sk && sk->sk_err == ENETRESET) {
>> +		sk->sk_err = ENETRESET;
> 
> Isn't this line unnecessary?
> 

  yup, will be removed in V2.

Regards,
  Sricharan

  reply	other threads:[~2023-09-03 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 10:20 [PATCH net-next 0/2] net: qrtr: Few qrtr fixes Sricharan Ramabadhran
2023-09-01 10:20 ` [PATCH net-next 1/2] net: qrtr: Prevent stale ports from sending Sricharan Ramabadhran
2023-09-01 14:11   ` Bjorn Andersson
2023-09-03 12:22     ` Sricharan Ramabadhran [this message]
2023-09-01 10:20 ` [PATCH net-next 2/2] net: qrtr: Add support for processing DEL_PROC type control message Sricharan Ramabadhran
2023-09-01 14:19 ` [PATCH net-next 0/2] net: qrtr: Few qrtr fixes Simon Horman
2023-09-03 12:26   ` Sricharan Ramabadhran

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=d7b7f611-e15b-e7a0-ce99-bd6c90027853@quicinc.com \
    --to=quic_srichara@quicinc.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=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_clew@quicinc.com \
    --cc=quic_viswanat@quicinc.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