Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1942363rdb; Tue, 5 Sep 2023 09:23:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyGTTZPZkry973CaCDfG/bUNwJlRAVsHSKZp3jnY+9m5+VLE0TxKZBE+sq7nBGkDXUqctq X-Received: by 2002:a17:906:cc5c:b0:9a2:1ce5:1243 with SMTP id mm28-20020a170906cc5c00b009a21ce51243mr234838ejb.60.1693931027536; Tue, 05 Sep 2023 09:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693931027; cv=none; d=google.com; s=arc-20160816; b=sB7ejDNn8fXyNjZHlgFk7zIuN5iLIbP5SxGyl75r/9rpVxMu/4rq+Q5NhTPfZlZ2XZ tBO5ODO/eavMqCaj8DqrAITU+Tw0hKdkg4py5oua0hd3qTxtOMeTPNY4Y7CAepIGqI6X 6BqdZMg4AAJiGPd8RtRKJmuQDqVmkZ9P+omLxF6lMVTHZfiPdWNqu3rzXCX7NpkwfdyJ A6fCpTc54Z7UroTFHkA9Iu133Jnras/HHNhTtaWLcnMY/znFzUm5Gd8LNMjfh2WZPLKV efx3FUYPeJW4OGb07lM30pcIho/FYr1YN4m+/RLkQwJWKNwaaeFVnSDl4ChYpuDi7gaR OOFQ== 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:dkim-signature; bh=4f6bHYegSQwLCn6VtkijdaC7TwfrnHHXgXJt1Fm7i68=; fh=nOhpvWtzVmvTDhgdpCWra+nDWwohWfgPP8SWhm6gG50=; b=yWmB53EeJyAZ5kV2YHBPVAYII77bIpyW8KXHNsjMsw9NZyvC0XsxNal95p2a/l3iTH CMXO5iSlp+KXN2XZFYBTmlHqo5yth9FDfoHdZ4r7TQ920WbB0gPvU8jzxUuO3K+g+gpB QpG2MnUD/7ZyK0VO3W8a1snYX6urU29vQvbmfveg8noP5+5EBKF0ityaSOYWQIHMx0VL zl/Rk8WXq5qmqC4Kz1mP+gpszbjSANlGfeOqrsMWraNa84au6kRdq32fMmXk5ZPmO1W/ fON57W9Gr6kd+I50/tzMrWQqDcXyVsA2PGftc9L6abY4gRbr7WdIqkpsE9Ppi2x7Kzsd 5FvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=KgCaNl7Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv14-20020a17090710ce00b00991fcf4687dsi7579080ejb.186.2023.09.05.09.23.36; Tue, 05 Sep 2023 09:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@yandex.ru header.s=mail header.b=KgCaNl7Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238111AbjIAIWB (ORCPT + 40 others); Fri, 1 Sep 2023 04:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233068AbjIAIWA (ORCPT ); Fri, 1 Sep 2023 04:22:00 -0400 Received: from forward205b.mail.yandex.net (forward205b.mail.yandex.net [178.154.239.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0ECD7 for ; Fri, 1 Sep 2023 01:21:53 -0700 (PDT) Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [IPv6:2a02:6b8:c03:500:1:45:d181:d103]) by forward205b.mail.yandex.net (Yandex) with ESMTP id 8708C67A05 for ; Fri, 1 Sep 2023 11:21:50 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:9396:0:640:dd2a:0]) by forward103c.mail.yandex.net (Yandex) with ESMTP id 392406028E; Fri, 1 Sep 2023 11:20:56 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id sKOYUPfDWSw0-6NnMzerT; Fri, 01 Sep 2023 11:20:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1693556455; bh=4f6bHYegSQwLCn6VtkijdaC7TwfrnHHXgXJt1Fm7i68=; h=Message-ID:Date:Cc:Subject:To:From; b=KgCaNl7Y6g+eBCudZcpYO/5ZhQpfYFR4NkSA11lbg0KPmcxZ+SpjU5BdWNlZ1dxBK /IDSYj0SeBY7VVx8NZ9HQ/AlqVjz2twZSEJ+khIrmiGdTIwl7ek8hBS/hag/cLXCMf EfppGVUpL8uHO1SAKSwwIUr4klhxIxMQ7yKRM5gE= Authentication-Results: mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Felix Fietkau Cc: Kalle Valo , linux-mediatek@lists.infradead.org, linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: mt76: add DMA mapping error check in mt76_alloc_txwi() Date: Fri, 1 Sep 2023 11:19:04 +0300 Message-ID: <20230901081908.44399-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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-wireless@vger.kernel.org Add 'dma_mapping_error()' check in 'mt76_alloc_txwi()'. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/mediatek/mt76/dma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 05d9ab3ce819..5af666f03398 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -53,6 +53,11 @@ mt76_alloc_txwi(struct mt76_dev *dev) addr = dma_map_single(dev->dma_dev, txwi, dev->drv->txwi_size, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(dev->dma_dev, addr))) { + kfree(txwi); + return NULL; + } + t = (struct mt76_txwi_cache *)(txwi + dev->drv->txwi_size); t->dma_addr = addr; -- 2.41.0