Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1946797ybv; Fri, 14 Feb 2020 08:41:11 -0800 (PST) X-Google-Smtp-Source: APXvYqylGbzT4cFzQgxZVCwF5VxhTBgkntP4veibSRQTz1DxHeC+oIgkKf1Ar37ULymSMbzfipCy X-Received: by 2002:a05:6830:12c3:: with SMTP id a3mr3085481otq.341.1581698471646; Fri, 14 Feb 2020 08:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698471; cv=none; d=google.com; s=arc-20160816; b=yxTz5X+FQi8+As0gFi9CeVtYypVvB3BPsI+v4SXrdcXpByrOSZDjFd1G7oYAZ7t7Oh hXSNm6a+cM3JrlpMWXS4PG19mKz+IPEolGWR3JWFnrbvDPLUVjkDc/RWD9oXOvilKsCF K8VtKZMRrsH/haPXNbOYFd5Cix9DXOprBNV7XcBRT9b1o0W764/DbjxVnKKGpzS6680/ 98+Infj0HDfy3RKUABSVJTk5JGqtgzmRNJBDl1MFeC8gEd4mQyZs0jov1yFLVy7rEaBV p165I/y4eNygymeMqVckhsc9L3MnRgCgdQcXm+9YmBjyk/PKPLmObjJu4f2nc+rrngG0 SA+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0zIbnpLRA+nI0JWePjpb76u7wCIru9Ra8oUKp4ixVMM=; b=PvyZn7AffvrfYqnWWQXFJUrdR/ddJzXfEeBeC+DUWOWVoacY6J89NsMrtb6Z9xhOfV FldG/NKszLfHYbWCComofl4x5xxID5DExpV7JlolXFF7sLauBeNNZurScGllkPb+zV+s LYZH/mEsxI2mQ5W1QgxhXrDtE1FtZ/kEXjzharAOBMLHZSFnEc+VhukaLoX/FRFo8vEc 09Fsrw9UfV2KY6A6pRMhJczzhw0vacnyuvJf6Tqg4sRt0YLYmHt22fntqbiLzQWlTcIl sEe57oJRDWmZUnNzAHC0OXMQQ2jIQJiYUzO2gsygwNx0O1gIEzfHbfhhMWldwjl55tkl /q7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aqPsiDnE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24si3273837otf.101.2020.02.14.08.41.00; Fri, 14 Feb 2020 08:41:11 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=aqPsiDnE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393292AbgBNQW5 (ORCPT + 99 others); Fri, 14 Feb 2020 11:22:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:56386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393031AbgBNQVi (ORCPT ); Fri, 14 Feb 2020 11:21:38 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A31B246BB; Fri, 14 Feb 2020 16:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697297; bh=dSvF0y23x2RhFBIaj9BU/lA5dSQx65QZcnmoG1PWSJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqPsiDnEv+BNcIRU9b4UXLWUeoufLzpcFjElWycCIfnhz3esJntxiQIFFtOiud2YI S1MSEehHTTDphsy0bXwUPvljeXoG6RQvaIQmAGHNR+w0EW7FBcdgXWvExCJkR3j/64 H1E4ukYvN5f/doTxXMcbRz6l9YkNHxtwIRUshYpU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?H=C3=A5kon=20Bugge?= , Mark Haywood , Leon Romanovsky , Jason Gunthorpe , Sasha Levin , linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 011/141] RDMA/netlink: Do not always generate an ACK for some netlink operations Date: Fri, 14 Feb 2020 11:19:11 -0500 Message-Id: <20200214162122.19794-11-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Håkon Bugge [ Upstream commit a242c36951ecd24bc16086940dbe6b522205c461 ] In rdma_nl_rcv_skb(), the local variable err is assigned the return value of the supplied callback function, which could be one of ib_nl_handle_resolve_resp(), ib_nl_handle_set_timeout(), or ib_nl_handle_ip_res_resp(). These three functions all return skb->len on success. rdma_nl_rcv_skb() is merely a copy of netlink_rcv_skb(). The callback functions used by the latter have the convention: "Returns 0 on success or a negative error code". In particular, the statement (equal for both functions): if (nlh->nlmsg_flags & NLM_F_ACK || err) implies that rdma_nl_rcv_skb() always will ack a message, independent of the NLM_F_ACK being set in nlmsg_flags or not. The fix could be to change the above statement, but it is better to keep the two *_rcv_skb() functions equal in this respect and instead change the three callback functions in the rdma subsystem to the correct convention. Fixes: 2ca546b92a02 ("IB/sa: Route SA pathrecord query through netlink") Fixes: ae43f8286730 ("IB/core: Add IP to GID netlink offload") Link: https://lore.kernel.org/r/20191216120436.3204814-1-haakon.bugge@oracle.com Suggested-by: Mark Haywood Signed-off-by: Håkon Bugge Tested-by: Mark Haywood Reviewed-by: Leon Romanovsky Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/addr.c | 2 +- drivers/infiniband/core/sa_query.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 1baa25e82bdd9..f7d23c1081dc4 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -141,7 +141,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb, if (ib_nl_is_good_ip_resp(nlh)) ib_nl_process_good_ip_rsep(nlh); - return skb->len; + return 0; } static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr, diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 5879a06ada938..1c459725d64e7 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -848,7 +848,7 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, } settimeout_out: - return skb->len; + return 0; } static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh) @@ -920,7 +920,7 @@ int ib_nl_handle_resolve_resp(struct sk_buff *skb, } resp_out: - return skb->len; + return 0; } static void free_sm_ah(struct kref *kref) -- 2.20.1