Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1272451rdb; Wed, 6 Dec 2023 13:43:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTRtB8UFbu6r5UnI6sMX9CFsebruU42lFRw3RvM1vCaLibZ8WjKWR21i61aZAy0kzRseUi X-Received: by 2002:a17:902:c950:b0:1d0:6ffd:610e with SMTP id i16-20020a170902c95000b001d06ffd610emr2309993pla.48.1701899016579; Wed, 06 Dec 2023 13:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701899016; cv=none; d=google.com; s=arc-20160816; b=udsa18riEnCs7weawQEP92eDAvLjzZvz7W2cei4xRyviDRq5XruN2e1Vhpma9Sooqb 0IMLDBDdm4Cs9/HW05Ttp5fLM61njKqIBWNXq1oMjqQGDHX9L36JOAvoAznP9/ZTmsxP aFGZ8eSbBS7uNYgGkzR2iSbzuPsxv5UorhByEpCuPI+wicz1xcsgLztqakd4XsmWtYJA t4CFq806NG31GCvHW5vV5/+pASN1GHt5tRDdQyNNIhG35ISAbj3WbSoBLQdemt9Zih6a dE2PcVq7vGFbkN+9GrSVRq6Px9pBO/MIgnqiSPS827QJR9ssv23G6a3fMf7cVLoiCWh4 QXzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N3UIqlZjUcdW+OareJnEFx8attSrDQcXUao4EGjKqqM=; fh=cOhTH+43Zz1KwFwVIIQ2HnizQS8KZIP9ZzKGkenQHus=; b=NeU6OnmUn6pYv19biQqA8897yd5E0NQLkrHKCkVEwsLhqbGHneD8hoAGU8GDTkgsxG aznN74LMtmbNkfR8ffu5gIQQwi+v1Kqpj+d4BCfdO3RtaKiJpZIipVKxhb8K9Z/UAd2M PKTJTVRNITovS6h2NB9zI/VvsGxXcCyQPt7/mr6IyrQIcegC6IWj/OJVDPpKqnd7PVRM g7rlXZjDHY3Y04xqAVnlZeljkqxziyimW67XKgXLmmaodH+T1NYiVqcQlUl0AYD96L6c MHPZIb6XGH4pIaS1xCSJ134IsNBUeWfL+5njwWhA25kynet/ujizuLrEX8UJDFU5BoxB M/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4Woje4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i7-20020a17090332c700b001d076ffeecdsi426694plr.198.2023.12.06.13.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 13:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4Woje4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 705AF8280834; Wed, 6 Dec 2023 13:43:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbjLFVnS (ORCPT + 99 others); Wed, 6 Dec 2023 16:43:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbjLFVnQ (ORCPT ); Wed, 6 Dec 2023 16:43:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AC2D3 for ; Wed, 6 Dec 2023 13:43:23 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D12B7C433C8; Wed, 6 Dec 2023 21:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701899002; bh=M6QR7jmJtF0bi+CXOH3OmbL5+zqx/nverCaKK0xbSJc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e4Woje4H3pBspHNglsWdUfKEDsITiAguirACEeOB+nqS0EleDRko9eC3FTNEmZxrm k2RVbczUh6NvmBWNDME12TNRybekES9cIp0la/HrIFuqIVv8MEm8bMk6P2mXPvPNza /jTxkuMRyXbTk5skJJm4R2MzFjYKNvEeq9+WpsClvQQ/Llxuz4rcRhuwGnxknRm41L oBpiPXbWHTLIaDx9Ly5W9+YkU1T5EEW1dSgfmlfEo9/jg+C1lSVeKqfLM5yvtK9QZx jxvKf3K4amREpeI6Mc6Pleotq4rNjCe98hDVQ+ghmYkoufZ61ZBPv/2n5LtiShIzvW XMB+6Ys/OVxoQ== Date: Wed, 6 Dec 2023 13:43:22 -0800 From: Saeed Mahameed To: Shifeng Li Cc: saeedm@nvidia.com, leon@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ogerlitz@mellanox.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dinghui@sangfor.com.cn, lishifeng1992@126.com Subject: Re: [PATCH] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list() Message-ID: References: <20231130094656.894412-1-lishifeng@sangfor.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20231130094656.894412-1-lishifeng@sangfor.com.cn> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 13:43:34 -0800 (PST) On 30 Nov 01:46, Shifeng Li wrote: >Out_sz that the size of out buffer is calculated using query_nic_vport >_context_in structure when driver query the MAC list. However query_nic >_vport_context_in structure is smaller than query_nic_vport_context_out. >When allowed_list_size is greater than 96, calling ether_addr_copy() will >trigger an slab-out-of-bounds. > >[ 1170.055866] BUG: KASAN: slab-out-of-bounds in mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core] >[ 1170.055869] Read of size 4 at addr ffff88bdbc57d912 by task kworker/u128:1/461 >[ 1170.055870] >[ 1170.055932] Workqueue: mlx5_esw_wq esw_vport_change_handler [mlx5_core] >[ 1170.055936] Call Trace: >[ 1170.055949] dump_stack+0x8b/0xbb >[ 1170.055958] print_address_description+0x6a/0x270 >[ 1170.055961] kasan_report+0x179/0x2c0 >[ 1170.056061] mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core] >[ 1170.056162] esw_update_vport_addr_list+0x2c5/0xcd0 [mlx5_core] >[ 1170.056257] esw_vport_change_handle_locked+0xd08/0x1a20 [mlx5_core] >[ 1170.056377] esw_vport_change_handler+0x6b/0x90 [mlx5_core] >[ 1170.056381] process_one_work+0x65f/0x12d0 >[ 1170.056383] worker_thread+0x87/0xb50 >[ 1170.056390] kthread+0x2e9/0x3a0 >[ 1170.056394] ret_from_fork+0x1f/0x40 > >Fixes: e16aea2744ab ("net/mlx5: Introduce access functions to modify/query vport mac lists") >Cc: Ding Hui >Signed-off-by: Shifeng Li Applied to net-mlx5. Thanks, Saeed.