From: Lu Baolu <baolu.lu@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
dwmw2@infradead.org, joro@8bytes.org, will@kernel.org,
kevin.tian@intel.com
Cc: iommu@lists.linux-foundation.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/vt-d: Fix an unbalanced rcu_read_lock/rcu_read_unlock()
Date: Mon, 8 Nov 2021 10:18:17 +0800 [thread overview]
Message-ID: <c7ac5f27-d7b6-6f19-75cc-c047ad590696@linux.intel.com> (raw)
In-Reply-To: <40cc077ca5f543614eab2a10e84d29dd190273f6.1636217517.git.christophe.jaillet@wanadoo.fr>
On 11/7/21 12:53 AM, Christophe JAILLET wrote:
> If we return -EOPNOTSUPP, the rcu lock remains lock. This is spurious.
> Go through the end of the function instead. This way, the missing
> 'rcu_read_unlock()' is called.
>
> Fixes: 7afd7f6aa21a ("iommu/vt-d: Check FL and SL capability sanity in scalable mode")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, review with care.
> ---
> drivers/iommu/intel/cap_audit.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/intel/cap_audit.c b/drivers/iommu/intel/cap_audit.c
> index b39d223926a4..71596fc62822 100644
> --- a/drivers/iommu/intel/cap_audit.c
> +++ b/drivers/iommu/intel/cap_audit.c
> @@ -144,6 +144,7 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)
> {
> struct dmar_drhd_unit *d;
> struct intel_iommu *i;
> + int rc = 0;
>
> rcu_read_lock();
> if (list_empty(&dmar_drhd_units))
> @@ -169,11 +170,11 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)
> */
> if (intel_cap_smts_sanity() &&
> !intel_cap_flts_sanity() && !intel_cap_slts_sanity())
> - return -EOPNOTSUPP;
> + rc = -EOPNOTSUPP;
>
> out:
> rcu_read_unlock();
> - return 0;
> + return rc;
> }
>
> int intel_cap_audit(enum cap_audit_type type, struct intel_iommu *iommu)
>
Nice catch! Thank you!
I will queue this for v5.16.
Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2021-11-08 2:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 16:53 [PATCH] iommu/vt-d: Fix an unbalanced rcu_read_lock/rcu_read_unlock() Christophe JAILLET
2021-11-08 2:18 ` Lu Baolu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7ac5f27-d7b6-6f19-75cc-c047ad590696@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox