Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1220253ybb; Wed, 8 Apr 2020 19:58:19 -0700 (PDT) X-Google-Smtp-Source: APiQypIZHhDqPsQhg0thPUP2jmQwZpo6646GtHBNEzrYti8oKDu66vx1asL24w3D3O+ngq0/d6q/ X-Received: by 2002:a9d:3d84:: with SMTP id l4mr2196291otc.351.1586401099167; Wed, 08 Apr 2020 19:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586401099; cv=none; d=google.com; s=arc-20160816; b=KScIFrRg/dThgQFPpW3XU8fFtLUNYNEyH6S4HYCP6GgJpOZhSTHHQ6cbBGa2Ncv7C+ Qr8if0ASwE66DZeaH4YEIpBI+sSCKVz4alJtnrBMWxBrjegfnQoeWjvSq3xT6pu05PIg gI1YXd4EYZOLUaoIF6w/aOMQzF3VREg6OoJCmOtMSOm1XPeDvjHr+A0FCzhiAyJW2adZ vKx9rnUkfJg1j1E7MVbQKtqqKlYydwPN5tpTCPRiTZWyEVqosysWO9RPy30fHA56f+kS dTUPM81po9DgmokAK8/Fh60yDKvnpSjGianwi+DvQJc8IhKrqXfM24RYTgh4kHYAiwzT S2Kg== 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=A736kPbySSr9eN/Y86SqNedkz7lfYJKpbA5jBRvd284=; b=Hgs0ErEnQy8sWXmg2Ob0GhhBFUxDej7u50Qi7SiV3u9EAezDLJtqBRiKFLbOx0wc1U FEcwbWFwr0ImHwWdGcZ7t2v5PQh/EvbQxiGac5GILIZMriGqWURHLRJu0kSFp7hXnyUZ Mu1XXDD45M8LCC1QzQJ0R9nyNxLjI/NFL+7qBfRxhBfM+8X0ivOOy52qNpXxci5/oyVv ++Cak6607mpcntpBeTDjo6Z/omDS6LNUsw7Q8GOCjlFO+890E4svh5d07IYfY7ABxBED IYd1j+HH76oGQccdLutSmJJOMf1qMs5TJmobwJjhSP8rKBB39mmP2ccn+9xcCMNDuGwM DBXQ== 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 r205si2804295oig.174.2020.04.08.19.57.47; Wed, 08 Apr 2020 19:58:19 -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 S1726620AbgDICzH (ORCPT + 99 others); Wed, 8 Apr 2020 22:55:07 -0400 Received: from m17618.mail.qiye.163.com ([59.111.176.18]:33214 "EHLO m17618.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbgDICzG (ORCPT ); Wed, 8 Apr 2020 22:55:06 -0400 Received: from ubuntu.localdomain (unknown [58.251.74.226]) by m17618.mail.qiye.163.com (Hmail) with ESMTPA id 3953B4E18B4; Thu, 9 Apr 2020 10:54:59 +0800 (CST) From: Wang Wenhu To: "David S. Miller" , Jakub Kicinski , Bjorn Andersson , Wen Gong , Allison Randal , Willem de Bruijn , Arnd Bergmann , Johannes Berg , Carl Huang , Wang Wenhu , Thomas Gleixner , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@vivo.com Subject: [PATCH v3] net: qrtr: send msgs from local of same id as broadcast Date: Wed, 8 Apr 2020 19:53:53 -0700 Message-Id: <20200409025414.19376-1-wenhu.wang@vivo.com> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZT1VPTklLS0tKT0pKT0hDWVdZKFlBSE 83V1ktWUFJV1kJDhceCFlBWTU0KTY6NyQpLjc#WQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OjI6Pgw*MTg0EhcPCg01VkkZ LDkKCTNVSlVKTkNNT0tLQktKQ0xDVTMWGhIXVQweFRMOVQwaFRw7DRINFFUYFBZFWVdZEgtZQVlO Q1VJTkpVTE9VSUlNWVdZCAFZQUhKSUo3Bg++ X-HM-Tid: 0a715cdcb2a59376kuws3953b4e18b4 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; #define QRTR_NODE_BCAST 0xffffffffu Fixes: commit fdf5fd397566 ("net: qrtr: Broadcast messages only from control port") Signed-off-by: Wang Wenhu --- Changlog: - v3 Use whitespace rather than tabs to make the line up correct. - v2 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..b7b854621c26 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