Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1213401rdb; Mon, 4 Sep 2023 06:38:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMNo+Q2B+rZI25m5TETy6hKq7ZL6sLkADCFfINzJdxATmKf4C0I56mP1HhqpWyW3tj2qjt X-Received: by 2002:a17:902:d505:b0:1bd:f71c:3af3 with SMTP id b5-20020a170902d50500b001bdf71c3af3mr10678210plg.32.1693834715948; Mon, 04 Sep 2023 06:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693834715; cv=none; d=google.com; s=arc-20160816; b=N2MNKOkHabPpSNco/fgtQr7CUxobsMpTDmhFo/9K0ZUGDQepHFqPdxyKQ0bCzcDOKQ jydmEfPB+a/TsT/X4eqUBmnNWaEub1lyYswFAc/hXCUHyMfHDNmDjbBpyMhtGr1IVdt1 NHz6VAJMD76H3NKV57bPs5tBxdhaXN6hh06pN7qUvk3ixO4Cdcyimq+8xc0EZhdJqEOM 3cNoPtfNiV8xigCyMkgeScv0ei+LSYIAyRPYUkEpkwCphAchxFmzKwCtE07VHYQuS55m lc+/aD7EoWJVjdCH9RJP0xvRXMGQaBLiI1nbv4/ydp6qVP2ealhCwAlrguCwPSlDjBri PCYg== 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 :message-id:date:subject:cc:to:from; bh=dMGwGWwVmhxsFmjHJhnpeLWiM9JX/U7ZtZmZZwS3sh8=; fh=1auB8KIxuQVsYKOY/sPEJ+ksBqPSqt66FIwZ+QgC9ls=; b=OlN7747CMfHmxQZ4UGr9W7WUZYx5R68m4wFzbf2x+x87HTKej+KHSb9eWmr4BfAD45 +UPusKJ6/bEjo3y2Div5ymU7FQMaZzohsVZ0vkkLGQEiAVjDfZ3IZjrzTFgRnD+Sx0ET NjscFG5iJnAmQzW+kspsySwcRlCwkq4tMys5nialKn0xpTmIuZVyNWLrq9CjMdagMVsC Y073IpsOH+a7MqZ6OkZMG+r4Ow3Nz43Rh9f9pZ4wdEPBQ3NT+anwD2nTS7c4hxnvfRbY 03xVwRZrTAi2VeSQNo1nGqGfYwrry2kSN7wcZBHwwpJP1wIAoOXP1ThZ/1HqatHXJuNp Zu6A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=red-soft.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a17090332d200b001c3323ff53asi3186805plr.139.2023.09.04.06.38.09; Mon, 04 Sep 2023 06:38:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=red-soft.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238901AbjIDMFp (ORCPT + 99 others); Mon, 4 Sep 2023 08:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbjIDMFp (ORCPT ); Mon, 4 Sep 2023 08:05:45 -0400 X-Greylist: delayed 359 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 04 Sep 2023 05:05:40 PDT Received: from gw.red-soft.ru (red-soft.ru [188.246.186.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BF9D197; Mon, 4 Sep 2023 05:05:40 -0700 (PDT) Received: from localhost.biz (unknown [10.81.81.211]) by gw.red-soft.ru (Postfix) with ESMTPA id 1068A3E1938; Mon, 4 Sep 2023 14:59:33 +0300 (MSK) From: Artem Chernyshev To: Leon Romanovsky Cc: Artem Chernyshev , Potnuri Bharat Teja , Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] infiniband: cxgb4: cm: Check skb value Date: Mon, 4 Sep 2023 14:59:25 +0300 Message-Id: <20230904115925.261974-1-artem.chernyshev@red-soft.ru> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 179619 [Sep 04 2023] X-KLMS-AntiSpam-Version: 5.9.59.0 X-KLMS-AntiSpam-Envelope-From: artem.chernyshev@red-soft.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 529 529 a773548e495283fecef97c3e587259fde2135fef, {Tracking_from_domain_doesnt_match_to}, red-soft.ru:7.1.1;localhost.biz:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2023/09/04 09:25:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2023/09/04 02:08:00 #21786649 X-KLMS-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 get_skb() can't allocate skb in case of OOM. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Artem Chernyshev --- drivers/infiniband/hw/cxgb4/cm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index ced615b5ea09..775da62b38ec 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -1965,6 +1965,10 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) int win; skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); + if (!skb) { + pr_err("%s - cannot alloc skb!\n", __func__); + return -ENOMEM; + } req = __skb_put_zero(skb, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16))); -- 2.37.3 z