diff mbox

[SRU,Xenial,2/2] UBUNTU: SAUCE: hv: don't reset hv_context.tsc_page on crash

Message ID 20718fc2fb4a3accba878c619bc4f8937a58078a.1484949432.git.joseph.salisbury@canonical.com
State New
Headers show

Commit Message

Joseph Salisbury Jan. 27, 2017, 7:56 p.m. UTC
From: Vitaly Kuznetsov <vkuznets@redhat.com>

BugLink: http://bugs.launchpad.net/bugs/1630924

It may happen that secondary CPUs are still alive and resetting
hv_context.tsc_page will cause a consequent crash in read_hv_clock_tsc()
as we don't check for it being not NULL there. It is safe as we're not
freeing this page anyways.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 56ef6718a1d8d77745033c5291e025ce18504159)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
---
 drivers/hv/hv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Joseph Salisbury Jan. 27, 2017, 8:26 p.m. UTC | #1
On 01/27/2017 02:56 PM, Joseph Salisbury wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> BugLink: http://bugs.launchpad.net/bugs/1630924
>
> It may happen that secondary CPUs are still alive and resetting
> hv_context.tsc_page will cause a consequent crash in read_hv_clock_tsc()
> as we don't check for it being not NULL there. It is safe as we're not
> freeing this page anyways.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 56ef6718a1d8d77745033c5291e025ce18504159)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> ---
>  drivers/hv/hv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index ab1f466..60db5ff 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -317,9 +317,10 @@ void hv_cleanup(bool crash)
>  
>  		hypercall_msr.as_uint64 = 0;
>  		wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
> -		if (!crash)
> +		if (!crash) {
>  			vfree(hv_context.tsc_page);
> -		hv_context.tsc_page = NULL;
> +			hv_context.tsc_page = NULL;
> +		}
>  	}
>  #endif
>  }

I guess this doesn't need to be SAUCE since it's in linux-next.
Stefan Bader Jan. 30, 2017, 11:25 a.m. UTC | #2
On 27.01.2017 21:26, Joseph Salisbury wrote:
> On 01/27/2017 02:56 PM, Joseph Salisbury wrote:
>> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>>
>> BugLink: http://bugs.launchpad.net/bugs/1630924
>>
>> It may happen that secondary CPUs are still alive and resetting
>> hv_context.tsc_page will cause a consequent crash in read_hv_clock_tsc()
>> as we don't check for it being not NULL there. It is safe as we're not
>> freeing this page anyways.
>>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> (cherry picked from commit 56ef6718a1d8d77745033c5291e025ce18504159)
>> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
>> ---
>>  drivers/hv/hv.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>

> 
> I guess this doesn't need to be SAUCE since it's in linux-next.

I am torn there. Actually the SOB looks like this came via stable. But then it
would not be there if not also would be upstream and only in linux-next?
In the past I tried to use some annotation like (pre-stable) when picking stable
patches before we applied the full stable series. Just to give whomever does
apply the stable set some easy hint that the previously applied version
can/needs to be dropped.

-Stefan
Seth Forshee Jan. 30, 2017, 10:14 p.m. UTC | #3
On Mon, Jan 30, 2017 at 12:25:29PM +0100, Stefan Bader wrote:
> On 27.01.2017 21:26, Joseph Salisbury wrote:
> > On 01/27/2017 02:56 PM, Joseph Salisbury wrote:
> >> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> >>
> >> BugLink: http://bugs.launchpad.net/bugs/1630924
> >>
> >> It may happen that secondary CPUs are still alive and resetting
> >> hv_context.tsc_page will cause a consequent crash in read_hv_clock_tsc()
> >> as we don't check for it being not NULL there. It is safe as we're not
> >> freeing this page anyways.
> >>
> >> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> >> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> >> Cc: <stable@vger.kernel.org>
> >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> (cherry picked from commit 56ef6718a1d8d77745033c5291e025ce18504159)
> >> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> >> ---
> >>  drivers/hv/hv.c | 5 +++--
> >>  1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> 
> > 
> > I guess this doesn't need to be SAUCE since it's in linux-next.
> 
> I am torn there. Actually the SOB looks like this came via stable. But then it
> would not be there if not also would be upstream and only in linux-next?
> In the past I tried to use some annotation like (pre-stable) when picking stable
> patches before we applied the full stable series. Just to give whomever does
> apply the stable set some easy hint that the previously applied version
> can/needs to be dropped.

We typically do change the "cherry picked from ..." line to indicate
where it came from if it came from anywhere but Linus' tree. I.e. in
this case:

(cherry picked from commit 56ef6718a1d8d77745033c5291e025ce18504159 linux-next)

Seth
diff mbox

Patch

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index ab1f466..60db5ff 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -317,9 +317,10 @@  void hv_cleanup(bool crash)
 
 		hypercall_msr.as_uint64 = 0;
 		wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
-		if (!crash)
+		if (!crash) {
 			vfree(hv_context.tsc_page);
-		hv_context.tsc_page = NULL;
+			hv_context.tsc_page = NULL;
+		}
 	}
 #endif
 }