Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1743352pxb; Wed, 9 Feb 2022 03:38:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxc05iqdrEV2j0rZTsNu37c4L+Ux1RsS3KdWtsl6XkTnZwHhXqrk9V2RjCBpJuxR+ObvZav X-Received: by 2002:a62:8c57:: with SMTP id m84mr1788072pfd.28.1644406716711; Wed, 09 Feb 2022 03:38:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644406716; cv=none; d=google.com; s=arc-20160816; b=SUq7u4IMef9rB4n6rwvddwIF8FNBDAVJdgEou/VRB8IWf+FAX44coqFz6zYfZviXS2 oW2TVgn1qnK4FSQF6VrQQIp3HEPK2MYcS6G4E1/CspEoMFiT9ro4xAkSRkt2C05GarWB nZvTlymdXa41pBcrXhsHwBxJ4QOQCsZmxq5YutrGETVxRRDUDa+UuUIQXlJiAuUxStpf VydnTij6tKIcVYfE58GL3fxi1xICiAF6bNlCk7ykMee9D4NXSlTYnf/lJKiUsglp1xv9 EbsFzKwHzJBxoTxALQQL+J2VUd0ZNAADEvfxlCEfE9yBkfhy2Nputv/r/mydTlMYAHSa +f8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zEq1IZj1is3vxBY/SpzF1zElIh/KQyYY4wE/ur+l2l4=; b=XNW+POeZdRxp9ocmCeqB34PAuFUgLZY3sEBnJFr4wgR3NJUZrRgspvPC3pzbPqNQVE wTEd3JGVLzWdHg83BZMIqAMxxP1eut5QPgRVddY472/TeAHzxwwuRCfhnYhvhBf2JbLj tIQvk+S0WuFhqfgckhyBiHGYf6Zom2RylYuPwwfIHe7TEfy3ewBdNSY+3G9jxQZobUmY tZafiMCFk27H64rAZCiYII9tv5Mf5hhbYrS+30SwdMGyI3ChXGOS4lWmHmou16U0I4F8 Eb6Ls5Q9uVn8SyBJBx6HZIs5DkdXKLXHJnoL1pJm2A3FlVoOsy8u996OrmjV8AyGmHKx rGNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tPcuJzdF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x23si15983091pgk.771.2022.02.09.03.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 03:38:36 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tPcuJzdF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD1C8E07AD1B; Wed, 9 Feb 2022 01:55:19 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381764AbiBGL4f (ORCPT + 99 others); Mon, 7 Feb 2022 06:56:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384900AbiBGLab (ORCPT ); Mon, 7 Feb 2022 06:30:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42886C03C193; Mon, 7 Feb 2022 03:28:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 382B06006F; Mon, 7 Feb 2022 11:28:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F227FC004E1; Mon, 7 Feb 2022 11:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233324; bh=7QUCjhG7b2OWuM/D+SKi0gaN56aTrCQMmg2TU98RO+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPcuJzdFirvmXUL/TljN7v+TYRpLxFnSpWLE1PK9+TvO2hK9pJXI2RWUUhDr1QUq2 kMsHUuQ+ieOUn7C6oFd4b9QJlDmNHAtsii5sorf7rxINvSvAGmu3Z/W9Ek9s2ypU4x sJKw9MdtNddTG55J5dH0bQnzVmyQLFzjjRNnrqjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mark Zhang , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 5.15 055/110] IB/cm: Release previously acquired reference counter in the cm_id_priv Date: Mon, 7 Feb 2022 12:06:28 +0100 Message-Id: <20220207103804.145489928@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Zhang commit b856101a1774b5f1c8c99e8dfdef802856520732 upstream. In failure flow, the reference counter acquired was not released, and the following error was reported: drivers/infiniband/core/cm.c:3373 cm_lap_handler() warn: inconsistent refcounting 'cm_id_priv->refcount.refs.counter': Fixes: 7345201c3963 ("IB/cm: Improve the calling of cm_init_av_for_lap and cm_init_av_by_path") Link: https://lore.kernel.org/r/7615f23bbb5c5b66d03f6fa13e1c99d51dae6916.1642581448.git.leonro@nvidia.com Reported-by: Dan Carpenter Signed-off-by: Mark Zhang Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -3322,7 +3322,7 @@ static int cm_lap_handler(struct cm_work ret = cm_init_av_by_path(param->alternate_path, NULL, &alt_av); if (ret) { rdma_destroy_ah_attr(&ah_attr); - return -EINVAL; + goto deref; } spin_lock_irq(&cm_id_priv->lock);