Re: [PATCH v14 03/13] x86/sev: Add Secure TSC support for SNP guests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/11/2024 12:33 PM, Nikunj A. Dadhania wrote:
> On 11/1/2024 9:30 PM, Borislav Petkov wrote:
>> On Mon, Oct 28, 2024 at 11:04:21AM +0530, Nikunj A Dadhania wrote:

>>> +	BUILD_BUG_ON(sizeof(buf) < (sizeof(tsc_resp) + AUTHTAG_LEN));
>>> +
>>> +	mdesc = snp_msg_alloc();
>>> +	if (IS_ERR_OR_NULL(mdesc))
>>> +		return -ENOMEM;
>>> +
>>> +	rc = snp_msg_init(mdesc, snp_vmpl);
>>> +	if (rc)
>>> +		return rc;
>>> +
>>> +	tsc_req = kzalloc(sizeof(struct snp_tsc_info_req), GFP_KERNEL);
>>> +	if (!tsc_req)
>>> +		return -ENOMEM;
>>
>> You return here and you leak mdesc. 

mdesc is allocated only once in snp_msg_alloc() and is stored in static
variable snp_mdesc, subsequent snp_msg_alloc() calls from the sev-guest
driver will return snp_mdesc.

>> Where are those mdesc things even freed?

snp_mdesc is initialized once and is not freed.

>> I see snp_msg_alloc() but not a "free" counterpart...

That was the reason I had not implemented "free" counterpart.

Regards
Nikunj






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux