Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp203159ybb; Tue, 7 Apr 2020 20:41:57 -0700 (PDT) X-Google-Smtp-Source: APiQypJtZIGk/28uVAtKmNJ6sW+rUu9siDIUQn1bGrniEPhyc1X3mi1cH5kmefjs2qpo4XQ9+Lcv X-Received: by 2002:aca:4243:: with SMTP id p64mr1056909oia.21.1586317317649; Tue, 07 Apr 2020 20:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586317317; cv=none; d=google.com; s=arc-20160816; b=I4X11LF6Af9UZ/WEAx7QfEW5BR43n/iKgDgxjXp+D0HXkHXE/QZCbKt6DeFNtj3lZq Epg4nYU4SXyeQ0o1zh59bdcRkpJkvBjXEpt9rhNPuO3551dx99FLTqcYi3N/mTHgq14W uPfWGGBoxFSiGWfJaEIUc+q74KQFzRBRzJw57K4SKJWry05oHN2Ff9t2pIfN2OAfJlp3 ADiIG4BB0mvYdyZKI2BHV/zK9PlFHEP2zpHpc/0knQ+6c66m91riDBO6bUDYjvKQlYRu kTfD1xSaANPdxjwnpBo6NfhxIT51hOGZmrM2aDZNFGznh/2/Uy5y9Zx6oMHCTfRhvA1J shbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=KBZ0Z/tbSAkMsrpaFQU0HrQgIVrt7wsHcAufcbWKJSQ=; b=ZRy58SkXH7zrdJZ5P+3ATqoefeo2pm9tNBi2kDH/jwOJnpWT3cI9Fw6M3pQPpO7lU9 NlMtHxwWrPPvPW8Lr/cB2tDFe3Tr+x3PJFmSnHshKoNvKDoiLSB9ERuvP67a6mO5LywS 3im85BN+HdF6PgeaWKaACReNsxd8mYjN3QS5bNgFE9NdGDs06wiMmzuv1fKuSr7TZd+a guWf0Khf3gyzXbmolPeiwQhAiS9Hfk5O/+DRvJLeTePg3J/51qdATi9Lh9nETU9E58EL rwrpLTkmJutXnTUZvVzSHqCRiupKrVrPu8Ochgt92VDupA5GpLaBmV8z8R+BkJgATk1l xD3Q== 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 w203si1357729oie.193.2020.04.07.20.41.43; Tue, 07 Apr 2020 20:41:57 -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 S1726575AbgDHDj5 (ORCPT + 99 others); Tue, 7 Apr 2020 23:39:57 -0400 Received: from m17618.mail.qiye.163.com ([59.111.176.18]:43179 "EHLO m17618.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbgDHDj5 (ORCPT ); Tue, 7 Apr 2020 23:39:57 -0400 X-Greylist: delayed 413 seconds by postgrey-1.27 at vger.kernel.org; Tue, 07 Apr 2020 23:39:55 EDT Received: from ubuntu.localdomain (unknown [58.251.74.227]) by m17618.mail.qiye.163.com (Hmail) with ESMTPA id 43C6C4E1D77; Wed, 8 Apr 2020 11:32:57 +0800 (CST) From: WANG Wenhu To: "David S. Miller" , Jakub Kicinski , Bjorn Andersson , Carl Huang , Thomas Gleixner , Arnd Bergmann , Nicholas Mc Guire , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@vivo.com, Wang Wenhu Subject: [PATCH v2] net: qrtr: send msgs from local of same id as broadcast Date: Tue, 7 Apr 2020 20:32:47 -0700 Message-Id: <20200408033249.120608-1-wenhu.wang@vivo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407132930.109738-1-wenhu.wang@vivo.com> References: <20200407132930.109738-1-wenhu.wang@vivo.com> X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSFVLTE9LS0tITkNOQ0pOT1lXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NSI6KSo6Ojg#DhALSzY2CUxL CQgKFB1VSlVKTkNNSEpNTExCTE1PVTMWGhIXVQweFRMOVQwaFRw7DRINFFUYFBZFWVdZEgtZQVlO Q1VJTkpVTE9VSUlMWVdZCAFZQUhLSU43Bg++ X-HM-Tid: 0a7157d9189d9376kuws43c6c4e1d77 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Wenhu 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 --- Changlog: - For coding style, line up the newline of the if conditional judgement with the one exists before. 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..545a61f8ef75 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