Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp688037ybv; Thu, 13 Feb 2020 07:47:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzw+H605cDcWodep7ZeoTHyMG3kx4hIESQlrEN489moHRa0AlvEx+PlMjX+8Tz9x2vjioVt X-Received: by 2002:aca:4f4c:: with SMTP id d73mr3389244oib.107.1581608857140; Thu, 13 Feb 2020 07:47:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608857; cv=none; d=google.com; s=arc-20160816; b=IzmXEeusO1kaouXxWuOMzMloXsZ7BSmFpOAGnr9i3RaVHx1CjT20PBPSFiZNDFxdeR fuaaPrRaSzTR3kVK4Rs0dZUomS0OfilkShcBYOnQxoPwqzCNkJ6xNNR3LvoK4VG3H7L4 FCNMnBO+mQxW3JnDkpWvmuaTsXpBpOKyo2h+CSKB3VN+mzxKJgILCOe5B0wcoZXtjL0e xQ1nBA6HR0Ejl2QWpmiVXKG82zbtaodxsguNH97gX/bXSzFYrzaCwMpV6iEee4D4cTAA FLXjBMiFpUygKvbz3eeaR9Ydy263oYKTLpDeLajkbl0Bne4EYnt1u3bSjFJ1i20rzekd T+Cg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fM54g1TVWaRuKlBdLvWgEYPKqrSGvRG0iA3U02Zk0QQ=; b=lorl08IIYN4EiOB4XEeaNS05D+nQd6RGk0lCb0jYhoLxaDVG1E9WHyH6tbXcR5RaM3 r2b2nrSRXfGXLcCcTTb0jQ1NNtL6/uZygxVAs4Qr9A5miuDJiGD9PWRDInfkyUrZqcRk cHioWM6ELEKgcPraAFTGQOFZibz2/t5N0EcpvQSnqPMwoqSzLOx8kHsYayT5/aB0u0V4 TaE6xo7b1usPBLuyTvWbzxTdpacQwYeAREODlMSPZjceethZNqny3UpeDbpUCjt76KoE MGZAR3PUlRVeHVQirumO2nSJTW4kMN9INOfEOluQ3OUrm4cg70kW0UveOMiZ0Bj6Xqk7 W7dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mb+3vlMf; 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 x197si1230721oix.174.2020.02.13.07.47.24; Thu, 13 Feb 2020 07:47:37 -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=Mb+3vlMf; 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 S2387677AbgBMPrW (ORCPT + 99 others); Thu, 13 Feb 2020 10:47:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:48702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728105AbgBMP1G (ORCPT ); Thu, 13 Feb 2020 10:27:06 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 753F4218AC; Thu, 13 Feb 2020 15:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607624; bh=jOzQoKaNoUzmDAcE2f1lJ1Vju69MQpsJT9S2YdQl15U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mb+3vlMfqndt4S9nvvJOReStQdiC9Ui4LrC98OeYEhX8lmz7sh5GyYpAbhzuM2+Eb Yk+UAHp2M0E4Y0rEzkEeR6Kw9Zg1h58B7tVQtyHhrYdo6yOwVBtd0uXaqxaz3RH6hS 1lXUD/K8qC56BzMklPDAIrXAzNQgG58BO5/C0W3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Haywood , =?UTF-8?q?H=C3=A5kon=20Bugge?= , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 5.4 06/96] RDMA/netlink: Do not always generate an ACK for some netlink operations Date: Thu, 13 Feb 2020 07:20:13 -0800 Message-Id: <20200213151841.439767118@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 commit a242c36951ecd24bc16086940dbe6b522205c461 upstream. 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: Greg Kroah-Hartman --- drivers/infiniband/core/addr.c | 2 +- drivers/infiniband/core/sa_query.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -139,7 +139,7 @@ int ib_nl_handle_ip_res_resp(struct sk_b 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, --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -1068,7 +1068,7 @@ int ib_nl_handle_set_timeout(struct sk_b } settimeout_out: - return skb->len; + return 0; } static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh) @@ -1139,7 +1139,7 @@ int ib_nl_handle_resolve_resp(struct sk_ } resp_out: - return skb->len; + return 0; } static void free_sm_ah(struct kref *kref)