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

Re: [PATCH] tools/libs/light: Fix nic->vlan memory allocation


  • To: Leigh Brown <leigh@xxxxxxxxxxxxx>, Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 20 May 2024 13:08:03 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=solinno.co.uk smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UCxy5wlf43fGF5cch2iu/1Mi+Qa0MXpy3LB2q4FujXo=; b=Amejcxp+2Pd6iJnXk6vW85O+WC/yOJbIl4EIs39//dSGbXM1E/TWrWJLnFHORUY9nBSq5ehRO4Isq4whTCuzouYiQVzVaYC6+AK/0uUDxr4EJSZYwpdvpPk6XKV5T04C0pHtxDhm5HD3YFG7SeXo5bBgJ384dJdGna9a1O5noyhq1JM6+5PhtLIuafqAzsHDRuwQkCnFQ/LNytjgsfPzCjvUGNQLplTH2ktX0gdtd6nG+8DD1CFp+SteD9J4bYX9j2FU8fBFPRnXdmjNbHm5y7ru74WLWE6FqMqfOVlMm6NI1o0YPQBl2e08dQfvyTgJRT8nJBzbo8pOfFAONHukbA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aPx+vZqd5fh6a+fn0pMfmqQlSjbXCirP6jgTFM6CAb0zwsFNWub957mVPVFyDl10G4f040e5Rtghhjjmjtm1L1KMKS/l0ZXITuoO4zO4JDRXvn9UfSCE24A28DZWH3qHNm0F0CBitMxBDE8IhV0NM9gXzcJNXMeRL7F/W5PC8baebBkiG3R+3WFKWMNWNOEkpC5IZzZtR2+m89jSq5Bvk9gNxEe0Fzzgzh4LWMsl+hkV2dLE5y4gyF1lk9arHiVrCvQpEYnX58APunEhR+PnuM/NxyxJCOUQBFbL7FtsW41Wn9Aspyo+iyMRHp9h4iGyWqQRItTDTDoeZHjXwyUuLQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jason Andryuk <jandryuk@xxxxxxxxx>
  • Delivery-date: Mon, 20 May 2024 17:08:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-05-20 12:44, Leigh Brown wrote:
After the following commit:
3bc14e4fa4b9 ("tools/libs/light: Add vlan field to libxl_device_nic")
xl list -l aborts with a double free error if a domain has at least
one vif defined:

   $ sudo xl list -l
   free(): double free detected in tcache 2
   Aborted

Orginally, the vlan field was called vid and was defined as an integer.
It was appropriate to call libxl__xs_read_checked() with gc passed as
the string data was copied to a different variable.  However, the final
version uses a string data type and the call should have been changed
to use NOGC instead of gc to allow that data to live past the gc
controlled lifetime, in line with the other string fields.

This patch makes the change to pass NOGC instead of gc and moves the
new code to be next to the other string fields (fixing a couple of
errant tabs along the way), as recommended by Jason.

Fixes: 3bc14e4fa4b9 ("tools/libs/light: Add vlan field to libxl_device_nic")
Signed-off-by: Leigh Brown <leigh@xxxxxxxxxxxxx>

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.