Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3292828rwa; Tue, 23 Aug 2022 02:08:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dw4z8pxTIyzRQCX0oui2gr0CeDkQf7PUQVcsEsoKwle/fhJ2roP99RPDOTLV4vk2TDAON X-Received: by 2002:a05:6402:3694:b0:446:93e0:eed3 with SMTP id ej20-20020a056402369400b0044693e0eed3mr2791892edb.323.1661245696745; Tue, 23 Aug 2022 02:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661245696; cv=none; d=google.com; s=arc-20160816; b=qpKlvQ9yMAa6IkmqB/vnBaYbCvaKzGbqTktKfwPpUdji8F5vs5zObilpllU4HKQO3n L7zZV2DV+kp1yywc0efM943bnZNMcZya0fBITJm4XgFttHZP5XV23KMhZM2ZwgoIbvFB j92vPQc3QBk2cvH8IkaoN7YzZU+/BnwSb59gq9rM0a7s3K97d6jaeSf/fPmEZ092qqIh oA0VEB4eJpLkEaLT//q0npl2igXrygeIxRpuerXtaWgmAyIzLedNQ/ndw38EYUfuyB6v jGy/W/3vGsVqB9e21VgFe0Icnn9cmb0mdu+GEZzCLITAEZOugXaCUiEEmjXc9uoOPE13 xKUw== 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=JTsO2wdal5aHP7LY29Bha0uFb51gI4yPd8wcA8sBsOw=; b=IMs0qyCMA2S3V7UL39Q/s6s99Upbv1EypUO3lb2DqMK8/ULMkN39lG5C5pdD/kto/D L4nW34vwfa/rXB3XVoBmeHMFjDiGGMEgJ0hSHr31Mu1IDa6PJn/ZWSw6DMMsEZIVDTFO C3jViSV7lCOj3y0QfEPIpjmkveacOv22X7x0zQ8BhrmVGIjKvrg+uiR0tOvGvKAQEhDx Bem8J5toHV1rtJVkfe9JKlUecQQJbZozLnQFqu4lxYH92fKQ34wnO17MszpcnthnIEyZ edFc0FKxu7oTbyPrq6BvALyKjRN4lP+0+Kr3al2NWsqo6qR6/YOyCw8JP7sfeFkPbekv lKEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qc+2YOId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056402350700b0043c8f3fe2ebsi1919745edd.74.2022.08.23.02.07.49; Tue, 23 Aug 2022 02:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qc+2YOId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347100AbiHWIn2 (ORCPT + 99 others); Tue, 23 Aug 2022 04:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347175AbiHWIkq (ORCPT ); Tue, 23 Aug 2022 04:40:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25855785AF; Tue, 23 Aug 2022 01:19:07 -0700 (PDT) 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 C4A14612FE; Tue, 23 Aug 2022 08:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8976C433D6; Tue, 23 Aug 2022 08:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242746; bh=nKU8y2dvnO/CDH+Ggz7JkTDok6mbH9SjMtG+BKseyec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qc+2YOIdnD96U/rKkhQRqnzLcIOtNXyCn3L6btanHdg3hhOxOxoDjfuP2fOzjSs0B qD8JuslSo6T5tJSCPxGqpu0wcpki23/om6loIQNZzlw4CHPCEdpIf5gy364hjemZhI VIrB3IlPMJEYiZwS2VNX0nWLjAJiDWLMskd2J5TY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Potnuri Bharat Teja , Rahul Lakkireddy , Kees Cook , Leon Romanovsky Subject: [PATCH 5.19 187/365] RDMA/cxgb4: fix accept failure due to increased cpl_t5_pass_accept_rpl size Date: Tue, 23 Aug 2022 10:01:28 +0200 Message-Id: <20220823080126.041595996@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Potnuri Bharat Teja commit ef0162298abf46b881e4a4d0c604d1a066228647 upstream. Commit 'c2ed5611afd7' has increased the cpl_t5_pass_accept_rpl{} structure size by 8B to avoid roundup. cpl_t5_pass_accept_rpl{} is a HW specific structure and increasing its size will lead to unwanted adapter errors. Current commit reverts the cpl_t5_pass_accept_rpl{} back to its original and allocates zeroed skb buffer there by avoiding the memset for iss field. Reorder code to minimize chip type checks. Fixes: c2ed5611afd7 ("iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl") Link: https://lore.kernel.org/r/20220809184118.2029-1-rahul.lakkireddy@chelsio.com Signed-off-by: Potnuri Bharat Teja Signed-off-by: Rahul Lakkireddy Reviewed-by: Kees Cook Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/cxgb4/cm.c | 25 ++++++++------------- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index c16017f6e8db..14392c942f49 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -2468,31 +2468,24 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, opt2 |= CCTRL_ECN_V(1); } - skb_get(skb); - rpl = cplhdr(skb); if (!is_t4(adapter_type)) { - BUILD_BUG_ON(sizeof(*rpl5) != roundup(sizeof(*rpl5), 16)); - skb_trim(skb, sizeof(*rpl5)); - rpl5 = (void *)rpl; - INIT_TP_WR(rpl5, ep->hwtid); - } else { - skb_trim(skb, sizeof(*rpl)); - INIT_TP_WR(rpl, ep->hwtid); - } - OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL, - ep->hwtid)); - - if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) { u32 isn = (prandom_u32() & ~7UL) - 1; + + skb = get_skb(skb, roundup(sizeof(*rpl5), 16), GFP_KERNEL); + rpl5 = __skb_put_zero(skb, roundup(sizeof(*rpl5), 16)); + rpl = (void *)rpl5; + INIT_TP_WR_CPL(rpl5, CPL_PASS_ACCEPT_RPL, ep->hwtid); opt2 |= T5_OPT_2_VALID_F; opt2 |= CONG_CNTRL_V(CONG_ALG_TAHOE); opt2 |= T5_ISS_F; - rpl5 = (void *)rpl; - memset_after(rpl5, 0, iss); if (peer2peer) isn += 4; rpl5->iss = cpu_to_be32(isn); pr_debug("iss %u\n", be32_to_cpu(rpl5->iss)); + } else { + skb = get_skb(skb, sizeof(*rpl), GFP_KERNEL); + rpl = __skb_put_zero(skb, sizeof(*rpl)); + INIT_TP_WR_CPL(rpl, CPL_PASS_ACCEPT_RPL, ep->hwtid); } rpl->opt0 = cpu_to_be64(opt0); diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h index 26433a62d7f0..fed5f93bf620 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h @@ -497,7 +497,7 @@ struct cpl_t5_pass_accept_rpl { __be32 opt2; __be64 opt0; __be32 iss; - __be32 rsvd[3]; + __be32 rsvd; }; struct cpl_act_open_req { -- 2.37.2