Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4383220ybb; Tue, 7 Apr 2020 06:31:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJydHXMLBN7yVZvXH63v3X2e6nT7t/LQkRz/b4KgA+X4wWE8XuDzn9gT8wxPrdiPL7h/i6N X-Received: by 2002:a05:6830:148c:: with SMTP id s12mr1452830otq.147.1586266268080; Tue, 07 Apr 2020 06:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586266268; cv=none; d=google.com; s=arc-20160816; b=eX6xfVrmhlBYjrMu2XxpRWv9CSuNXovG0Sf6ZGiAKM9Gzs5DvSEr3cxvO1hf0YoZQJ 5fCbYoqhvw+f6D7pJvJiKMgoJAhMDazt6ctYRCF/eF3Am3174cRgIaGCaTHn2jBCzV1S L+kQlSScaziYJ9C8YGXp5uEdHO+PweEm1Mn2TrGl9DbowkrdvITyc6XE3eR16Hpz6Xw/ YQQRDesCcPBufbq9CL5VW4kq4t7zSKEk0Cw0b49sa5SOQi9JXIgyMHceuxaORyrrfli9 SFjo9rO+u5ffQLdjcDCvuClyGxpjKVOmQSSa3Qx6jRSxNRQeIrlBiClBQrqs747q5k91 l2BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=5WHXgucnQwUccS38KsB2TDdOXoxo1usvpmG0A7rGymo=; b=ea9aPazPorI3G/ewVHOOMMqSJHgUGcMT0oXiySZbwPGotRtmtvvDgmWBGlIQS9deTr GZgyse8pXEc1wnBLpMZbc35UkPLUjyHAH/eiQBwCaQleSANRjkET9LuCqSjUiZWkcz0q rmQJxB5aopNT41ESyEKFlKP13eSscf7mCNE+u7xgA3uKBPYB7k2MapVEzg8vzUsTmCTe Bo9I5WUsdlr6B1+IoO167NkK5KO1KRHxVMXUx6jnUz48/DbKEfIGiZn8AdJKULiC4Ht5 yDiEj9L9+bfY9UEzLyLA/sbB3u3dwwT7aXJRanl4ktritu90T/AybT9mWJu3t5J7p67n i24A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si664892oim.179.2020.04.07.06.30.54; Tue, 07 Apr 2020 06:31:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728869AbgDGNaR (ORCPT + 99 others); Tue, 7 Apr 2020 09:30:17 -0400 Received: from m177134.mail.qiye.163.com ([123.58.177.134]:60028 "EHLO m177134.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbgDGNaQ (ORCPT ); Tue, 7 Apr 2020 09:30:16 -0400 Received: from ubuntu.localdomain (unknown [58.251.74.227]) by m17618.mail.qiye.163.com (Hmail) with ESMTPA id 870F74E0EBF; Tue, 7 Apr 2020 21:30:07 +0800 (CST) From: WANG Wenhu To: "David S. Miller" , Jakub Kicinski , Bjorn Andersson , Allison Randal , Nicholas Mc Guire , Marc Kleine-Budde , WANG Wenhu , Thomas Gleixner , Arnd Bergmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.org Subject: [PATCH] net: qrtr: send msgs from local of same id as broadcast Date: Tue, 7 Apr 2020 06:29:28 -0700 Message-Id: <20200407132930.109738-1-wenhu.wang@vivo.com> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUlXWQgYFAkeWUFZTVVITENCQkJMSktLQ0hLSllXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NTY6Axw*GDgwTxEdCDZWPEki HhAaFB9VSlVKTkNNSU1NSUpLS0xCVTMWGhIXVQweFRMOVQwaFRw7DRINFFUYFBZFWVdZEgtZQVlO Q1VJTkpVTE9VSUlMWVdZCAFZQUlMTk03Bg++ X-HM-Tid: 0a7154d576ed9376kuws870f74e0ebf Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the local node id(qrtr_local_nid) is not modified after its initialization, it equals to the broadcast node id(QRTR_NODE_BCAST). So the messages from local node should not be taken as broadcast and keep the process going to send them out anyway. The definitions are as follow: static unsigned int qrtr_local_nid = NUMA_NO_NODE; Fixes: commit fdf5fd397566 ("net: qrtr: Broadcast messages only from control port") Signed-off-by: Wang Wenhu --- net/qrtr/qrtr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 5a8e42ad1504..5dbd248c5ffb 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -907,20 +907,21 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) node = NULL; if (addr->sq_node == QRTR_NODE_BCAST) { - enqueue_fn = qrtr_bcast_enqueue; - if (addr->sq_port != QRTR_PORT_CTRL) { + if (addr->sq_port != QRTR_PORT_CTRL && + qrtr_local_nid != QRTR_NODE_BCAST) { release_sock(sk); return -ENOTCONN; } + enqueue_fn = qrtr_bcast_enqueue; } else if (addr->sq_node == ipc->us.sq_node) { enqueue_fn = qrtr_local_enqueue; } else { - enqueue_fn = qrtr_node_enqueue; node = qrtr_node_lookup(addr->sq_node); if (!node) { release_sock(sk); return -ECONNRESET; } + enqueue_fn = qrtr_node_enqueue; } plen = (len + 3) & ~3; -- 2.17.1