Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2571545ybh; Fri, 24 Jul 2020 16:59:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsotpqGH/BykNeR8JHocjA/o9ZZgxL026dnRjtz24bepOaftBQl1hMJ4Ga6VOWUMaQmhwp X-Received: by 2002:a17:906:95cb:: with SMTP id n11mr5601791ejy.506.1595635144383; Fri, 24 Jul 2020 16:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595635144; cv=none; d=google.com; s=arc-20160816; b=e3axL8cZgltQtaX/eloWj35kfZFOqRNQbPFqiaTNZ24kIX5kJ389HxrZIFwHHZ2LGq XgGzpEXUpbHp8pIz2asHPFup1ng3ri/4m5tGwMtc3g7cWwJyIGXpVR+NpbCvpx7y/3v4 CU1VZz7xytydHwwtjs4O0AbbdlvMm7IY2D0Vq7kRYkQixnSA5YfGYRB/vwYFvDqsSn0b 9bDMqIQ20U4B7hhjT60JDffgwo55ghkLn8feHLanPSuRepCI7JmGax+8ssa+D9Nq3zkx Imf3Ll67tYc41kCS8wt+jRmehpVzkFzExrSRWVaTnrBNzZoR/C3PVv0o40CdoW2iwOUK J/UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=1zjsPmArJQm31yq+WiUVVYtJYaR7LlSchw5cfG5umKI=; b=aW4MG1g6k+ENZTCdSGCFypJSmKTI3d/M9MyfevAqjk27SFJ7i96iQrEeJdfHa0Pftb jnqVqVDeQJgRy5XLFAuv2veYUCd2Oid258rd8k1VG3BRtlEQPVdmlmBb+T+iYWN+4Lxh k+mU3ox9GHwea4xW74SWMpBqVgbjWd2AWjdGfOX33BA3kMRjfHcAA7XVcVjxkIemuccp 9dFBdv6gQl5XTcr2IlqRni8SJXA2NZ0GgFMpN8fPzO1rWbqyKCeqaAweVPOecQCLXLTr e5X2QtYi2qEbpq/FVr3onEHTawi+qh29+32nqCTjPYPHAe2/YOJXbY+ljg4iqMKykgTc bAmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u29si1385784edi.469.2020.07.24.16.58.39; Fri, 24 Jul 2020 16:59:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726769AbgGXX5Y (ORCPT + 99 others); Fri, 24 Jul 2020 19:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgGXX5Y (ORCPT ); Fri, 24 Jul 2020 19:57:24 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F4BC0619D3; Fri, 24 Jul 2020 16:57:23 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 2E89612756FCF; Fri, 24 Jul 2020 16:40:38 -0700 (PDT) Date: Fri, 24 Jul 2020 16:57:22 -0700 (PDT) Message-Id: <20200724.165722.526735468993909990.davem@davemloft.net> To: dinghao.liu@zju.edu.cn Cc: kjlu@umn.edu, sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com, jerinj@marvell.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] octeontx2-af: Fix use of uninitialized pointer bmap From: David Miller In-Reply-To: <20200724080657.19182-1-dinghao.liu@zju.edu.cn> References: <20200724080657.19182-1-dinghao.liu@zju.edu.cn> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 24 Jul 2020 16:40:38 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu Date: Fri, 24 Jul 2020 16:06:57 +0800 > If req->ctype does not match any of NIX_AQ_CTYPE_CQ, > NIX_AQ_CTYPE_SQ or NIX_AQ_CTYPE_RQ, pointer bmap will remain > uninitialized and be accessed in test_bit(), which can lead > to kernal crash. This can never happen. > Fix this by returning an error code if this case is triggered. > > Signed-off-by: Dinghao Liu I strongly dislike changes like this. Most callers of nix_lf_hwctx_disable() inside of rvu_nix.c set req->ctype to one of the handled values. The only other case, rvu_mbox_handler_nix_hwctx_disable(), is a completely unused function and should be removed. There is no functional problem in this code at all. It is not possible show a code path where the stated problem can actually occur.