Received: by 2002:a05:6500:1b8a:b0:1ef:a0f1:aef6 with SMTP id df10csp5081lqb; Sun, 10 Mar 2024 01:25:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWXU2byLo6fwFcQe7c6IsV1FLegRh9D7qr7CpEHhj3xJE6/VR+McEpvZikQgcUZug9Yvay+TWOkg9uN4+q1R0mWWADnYrtd9KNi9Jzg2w== X-Google-Smtp-Source: AGHT+IEVmi37KpiS6za13P9z0MWPhbVTaNKe8tgl5WSLiwBg0m2jgz7f/I5zEolDegoZfuEcSva+ X-Received: by 2002:a05:6a20:3b82:b0:1a1:8c25:fe81 with SMTP id b2-20020a056a203b8200b001a18c25fe81mr2885687pzh.56.1710062707365; Sun, 10 Mar 2024 01:25:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1710062707; cv=pass; d=google.com; s=arc-20160816; b=baG6abS1ZAbTjXsaGjqQiyF+d5AiJjth45WtzE0LeBU4fvROKBaKN1uwHXCZjQlhtA Ws6u8y7kU2kQKYgbUXQOfo2xwkcdV0DZJAvZlIOBZGFc+xqEuRzRxH6KL46zCFsyhCgm aKeKTLazFcDSb34ytkIa2tCPoUeiflxHKi1NkDdeZzKfcuRxQIELrryeGik28prJZ094 xCWvwBbD0dc/e7/DvtLWo05EKsbb6GMDjh+/RA4N8e4mAZ9L+662aFYelyfMM1q+Lo5x bGAlKiyZkjg1KJ9csEOUnyJGetVTm/roQS4SEO5HKymnXgvyyEP5rcA4PaBweBtLKopZ C6Lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PHrf+Oxsk1Wm7tY2gteAvKzu730SOP5GcDCf+kmHsRc=; fh=GB3dU5Lnnv/6v/mpZNoQV0u9F8aubc/2GQdTVAtEnoU=; b=Gl6sSqiiFpy8SMug8TH5gqEM9aEOONQZnugBuzo5FxwfiCKSkNaDd3dVk+phWE2tU5 w2wTuwdkD9LdEoTCX85V0Oa4LU3vzxojWt+zJBuia2Nyr8dQns9dkRfWpCmsTjgGuRiB 6Ztnbfvg7HdBU4DOenFmtlBoFeqUaS2YpfNIwBoznCsk43Lh4jj0FqlvsG/G0fwjUMuK TaPow5NXIL8RWR4lJNolnqIrdexItPd0I1vLXL9EtgjyiAwcZhb+bTFQbpaAKb9I1BPd M6sKuMWJmcq8eWyrz25vz0DlwUAcpnkm3W2TpazTLrnbpwsvM7aZ5883mvXlHOx25H44 liXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g1ImGlUR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c7-20020a17090a8d0700b0029b877af560si2887626pjo.172.2024.03.10.01.25.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 01:25:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g1ImGlUR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 11D292825D0 for ; Sun, 10 Mar 2024 09:25:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 472B61EA7D; Sun, 10 Mar 2024 09:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g1ImGlUR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EFCC1DFD2; Sun, 10 Mar 2024 09:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710062699; cv=none; b=WCDMWHDCjARYqdd30e8zw+TWvJ/xdDkll9FYf4VEKo/5w+Hd5u6Iy3e6s1ru/ju0e8JwpQLz/XsMXJ39i1BWsG3RpM8caorWM82B2AnJpVi/F87f/y1iuwgbUKIvOuYaBrBKI/Vs3O+f6iNT4WhClr3V0ibmlyveRdKBdq11p9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710062699; c=relaxed/simple; bh=P4ZM/mizClm/AHwxqWX/09R1OQ5BDYw3G6pF7eCt3Yg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qVt2Lc7Kb+PuURWVqVLpAzT7v3fuMUt3pPgk694QUwbfSCOgD2Nr1bjmMNt9OGh2IeKN9dVixMzlVB9HodtBKxsIRLq91783fqvgZP5+NkGtkQ7c8/3GaTeJNGEPKcXmXHbN9wbxeCP0IsNdWhz8ex272phLUC2AHArASz+Arjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g1ImGlUR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D96C433F1; Sun, 10 Mar 2024 09:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710062698; bh=P4ZM/mizClm/AHwxqWX/09R1OQ5BDYw3G6pF7eCt3Yg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g1ImGlURaLnRTv/IYCL48IuBeXzuto6vTT3xVCYgw9ZZCpWskBmaDuAKqv576m9XX 06XVeZSyIKqI5tFO2eZb5FxOgkSLL18TfzrUO3xXPm8JIXN1mc2WZJcOUv29mKE5qR ufGjfD5/rlUBaz8BAc/V/BaH2uWwVct7tG/K2be5TeFhfpJN8IxEf8R+C3SVTeOm3S ikZQFX0kOTOU5XL4adI+RusxIZqlScqroRAhEtYiRi0yBHmaveDYFxy2g2OTlkH28t pdPt1TqJs+UA1popkuZlBx/AUGZAJRVD8oqA6qutu7GC5ZT4YT1mTgsd+66apJ/XhC exGkyV8NbfYGg== Date: Sun, 10 Mar 2024 11:24:54 +0200 From: Leon Romanovsky To: Wenchao Hao Cc: Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/restrack: Fix potential invalid address access Message-ID: <20240310092454.GA12921@unreal> References: <20240301095514.3598280-1-haowenchao2@huawei.com> <20240307091317.GA8392@unreal> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Mar 07, 2024 at 10:17:59PM +0800, Wenchao Hao wrote: > On 2024/3/7 17:13, Leon Romanovsky wrote: > > On Fri, Mar 01, 2024 at 05:55:15PM +0800, Wenchao Hao wrote: > > > struct rdma_restrack_entry's kern_name was set to KBUILD_MODNAME > > > in ib_create_cq(), while if the module exited but forgot del this > > > rdma_restrack_entry, it would cause a invalid address access in > > > rdma_restrack_clean() when print the owner of this rdma_restrack_entry. > > > > > > Fix this issue by using kstrdup() to set rdma_restrack_entry's > > > kern_name. > > > > I don't like kstrdup() and would like to avoid it, this rdma_restrack_clean() > > is purely for debugging and for a long time all upstream ULPs are "clean" > > from these not-released bugs. > > > > So my suggestion is to delete that part of code and it will be good enough. > > > > It's OK for me. When found this issue, my first plan is to remove the code, but > I do not know why these code is added, so decide to using kstrdup() to work around > it. This code helped us to find one forgotten PD release in one of the ULPs. But it is not needed anymore. > > Then what to do next? Do I need to post another patch or you would fix it by yourself? Please send new patch, thanks.