Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp11974186rwb; Sat, 26 Nov 2022 02:21:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf68VqvuSJmIwHFA2FQUh/JPAQBDOtH9hImQz2M5u3F6QY/YGPDigUnu8dMohQvQ1Yyp5oox X-Received: by 2002:a17:907:9852:b0:7a8:a957:5b4e with SMTP id jj18-20020a170907985200b007a8a9575b4emr36860194ejc.305.1669458117264; Sat, 26 Nov 2022 02:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669458117; cv=none; d=google.com; s=arc-20160816; b=Ztf0jdc4izHCqSyY1EAb5nq33ooHmI7acYecso7fNdpe//rWzOoG9Y6F9R0AIn4KKL ILOsMeNgpV4xcrewrlNHagL92pzMfRTYx8QejvvR7fHeQK50IMI4KlTsLkN3mEeoY8Ir +j6Dv6MfJRdibCrQcZfVcLdDiMJ7S6rCazWNRXrVpfwlBcFw+rpr7iyN4SaveXtoa5tr 8PA0pXtqZx0ITfXeb1zj/5udhX3S4IGpv/YeuZ0lOjXZW+d3a6iCwdHUcdyMmQUKak50 hjwrzIf0+XgPokeSU3R1xubY9i0RVs8yDvoWBNsviBAymNkVCA/cwow/FtvKeGoW9pzz sKEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=fbfK9Rex5cNvSnlBAooT2eKkoeUs9ST+QrOqfD2bArM=; b=0TlklqFVUxjD3mwNOUaeelx0zt2GqN+OUMUGttNXeQfjDv8cbhaES37aC/epkHAgP0 OW2GbqUnLSjtOTXSPlexIFJdThrfMOAH4LNIhZnWmj1NL81IDHJvKW/2AvEtEOGuod+P S1cJ5hLMyGrT0I8mI6yxt+mP7G3gSFiRqNvhA4lW0CSZdsKhZywprlrnUsio4WDLFsGK uyL4LIrx2wemLJgt9KH2MQNi9+swES41GZtlvGPjHJLBbsexG9g1Hp4cl+1eOZgn8h5Y N4LnT2Wm3Gekba6jbA4Z0GvmJ+7PgW8PldLQ+utIBDC0Y2qaIt+HQNbx1XHkzhHyNZM+ DQoQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a50e611000000b004599ae68f98si5589488edm.136.2022.11.26.02.21.39; Sat, 26 Nov 2022 02:21:57 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229600AbiKZKIp (ORCPT + 67 others); Sat, 26 Nov 2022 05:08:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiKZKIn (ORCPT ); Sat, 26 Nov 2022 05:08:43 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174A820182; Sat, 26 Nov 2022 02:08:42 -0800 (PST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NK6qn0hNqzmWBt; Sat, 26 Nov 2022 18:08:05 +0800 (CST) Received: from huawei.com (10.175.112.208) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 26 Nov 2022 18:08:40 +0800 From: Yuan Can To: , , , , , , , , CC: Subject: [PATCH 1/2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() Date: Sat, 26 Nov 2022 10:06:33 +0000 Message-ID: <20221126100634.106887-2-yuancan@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221126100634.106887-1-yuancan@huawei.com> References: <20221126100634.106887-1-yuancan@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 As the nla_nest_start() may fail with NULL returned, the return value needs to be checked. Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface") Signed-off-by: Yuan Can --- net/ipv4/udp_tunnel_nic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c index bc3a043a5d5c..75a0caa4aebe 100644 --- a/net/ipv4/udp_tunnel_nic.c +++ b/net/ipv4/udp_tunnel_nic.c @@ -624,6 +624,8 @@ __udp_tunnel_nic_dump_write(struct net_device *dev, unsigned int table, continue; nest = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY); + if (!nest) + goto err_cancel; if (nla_put_be16(skb, ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT, utn->entries[table][j].port) || -- 2.17.1