From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH] KVM: X86: Fix dereference null cpufreq policy
Date: Mon, 2 Mar 2020 08:55:12 +0100 [thread overview]
Message-ID: <ab51f6c9-a67d-0107-772a-7fe57a2319cf@redhat.com> (raw)
In-Reply-To: <1583133336-7832-1-git-send-email-wanpengli@tencent.com>
On 02/03/20 08:15, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> cpufreq policy which is get by cpufreq_cpu_get() can be NULL if it is failure,
> this patch takes care of it.
>
> Fixes: aaec7c03de (KVM: x86: avoid useless copy of cpufreq policy)
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
My bad, I checked kobject_put but didn't check that kobj is first in
struct cpufreq_policy.
I think we should do this in cpufreq_cpu_put or, even better, move the
kobject struct first in struct cpufreq_policy. Rafael, Viresh, any
objection?
Paolo
> policy = cpufreq_cpu_get(cpu);
> - if (policy && policy->cpuinfo.max_freq)
> - max_tsc_khz = policy->cpuinfo.max_freq;
> + if (policy) {
> + if (policy->cpuinfo.max_freq)
> + max_tsc_khz = policy->cpuinfo.max_freq;
> + cpufreq_cpu_put(policy);
> + }
next prev parent reply other threads:[~2020-03-02 7:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 7:15 [PATCH] KVM: X86: Fix dereference null cpufreq policy Wanpeng Li
2020-03-02 7:55 ` Paolo Bonzini [this message]
2020-03-02 8:12 ` Viresh Kumar
2020-03-02 8:39 ` Paolo Bonzini
2020-03-02 9:14 ` Viresh Kumar
2020-03-02 10:23 ` Paolo Bonzini
2020-03-02 8:58 ` Naresh Kamboju
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=ab51f6c9-a67d-0107-772a-7fe57a2319cf@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=rjw@rjwysocki.net \
--cc=sean.j.christopherson@intel.com \
--cc=viresh.kumar@linaro.org \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/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;
as well as URLs for NNTP newsgroup(s).