Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp773848ybg; Wed, 10 Jun 2020 13:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQEGlL2WU4ZQkVM4wNV9KrObXwJuZGnFWc7imHRW6CG6e8FfHH4527wrEel+/hMzDyfg9P X-Received: by 2002:a17:906:4e59:: with SMTP id g25mr5020056ejw.60.1591820523778; Wed, 10 Jun 2020 13:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591820523; cv=none; d=google.com; s=arc-20160816; b=ogyJCu18f8iBhNRuDa1jmlYoHAyKXJK7xXXzAHeZSsRbpZzivOtPYcQfrO9TbQl/R/ mHu7TFs+7jHITk3/6PAp9ZRga9Cf9SlJfUnMrErY+nqzEQXbIlGh242TEwweowKgJ8dS hAzjhZui6ALRdADsJB0aMl7VDfMSjw/h303aXr+aMEWPtrEnZoKOQ/m0hPxWK4HKYft6 XvIrwvwWrM9r0cNoK8QK3waYBrck2uPfCliISnzGrKnKJ14TDNz0Ri3qU/hc1K0REaWc FDgi7oApajRs4kDevQkBf4UycMRmhAtGDYkpSLoWyXSu1cP9POJnBu3huK9xyBEDpUcC BiLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pRtsgZAxObyymDLOXZptKopgjPDlNKhyefsEXrzQ/I4=; b=GurB/dlw096KfFgyK5vrNJDLLc+yJFohVqYP7i4lCPhUTQZDaTosnhRE9xPpuT6BR9 /fREx3hpDOUsq3nLQpKd4XNrdkqWXCYkdUby0VRfXphG7V1m+GM354BUjn8JdO1CBnx7 7REHrooWI5wQqeGqR6lsNc+QPc2bH58qBRsemftjC7aOD8YKzBZ+l0o2GJPV+ptZUVQE +swCZlY6qk/zrf05CXcHhoT8h1RjgGvkzeNOragGMBMwSb4J5KAvqvy00T51cyp8rIRl WPqdKum/O+zFQ45k1tr6Ij/hmYBWqeks1Iu5TLzluyN544ZJxD1YVi5c3d9ey1GDVfir K7FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=REEPlBea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si398691edq.423.2020.06.10.13.21.41; Wed, 10 Jun 2020 13:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=REEPlBea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730358AbgFJUAm (ORCPT + 99 others); Wed, 10 Jun 2020 16:00:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40262 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727038AbgFJUAm (ORCPT ); Wed, 10 Jun 2020 16:00:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591819241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pRtsgZAxObyymDLOXZptKopgjPDlNKhyefsEXrzQ/I4=; b=REEPlBeapTnOJ99+6AYXpAK9WtaIgDHE9kqGJ1Q2ByNTB+3YQkTkpOVqvNL0meAw/KdFSc i9EywTQJc3yj8f98LHvP+n+jzpp3PaWvTToBPMp1pbtLKbf8Om/UCRsONOsdn2333NEMdJ zBbfJF34giq91cokN55Bei5Q8ZvWztc= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-go6NgsaPMV-6tsRiaGSi5Q-1; Wed, 10 Jun 2020 16:00:39 -0400 X-MC-Unique: go6NgsaPMV-6tsRiaGSi5Q-1 Received: by mail-qt1-f197.google.com with SMTP id y5so2899937qtd.0 for ; Wed, 10 Jun 2020 13:00:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=pRtsgZAxObyymDLOXZptKopgjPDlNKhyefsEXrzQ/I4=; b=THhnZP7c8rxnTShf5YAlmNEU8hY/4UtRIvvkafkcnFLUDwbcJgJgpVdVvXby/im0mw aL6mlRTJREJyzloXGsfcRxaX4Njm1dalQnt0hq27M+v/AHaSbdfVRRT3sDgTbL5x5yUY ItzUFT345rqDzasgf37zyPAzwWAtQfSetq/HCjqIfw1SFq+XYyu9eB2SFCZQAXLrtVgu k4iFpP+8enc2bqlvr7XXQU2Mrq5EHKAsv/dL/D7PnQBgalwSD4bMikZOn0kbXmZgOg+y LkxVzeEVms1d5PSs3TMO/IiG/ua1XeirkbNQjwryixTR5DY34Rvm6fJlTPHttzJ4rzyf 7hjg== X-Gm-Message-State: AOAM531oF+OZOs1uExZdwzjpHTvaNVLYqvDN08vDxAGAMdDY/FSjcUXP pcXTfgXt0lLme5qIw/0yU/oAZFNbHXLZ7LNoGsp6BGmzHEjdpbAsvNx00iXoS9oGMp7tzz+Z11E 3GzFzLq+vE2Vi9f1MI0pvRJlp X-Received: by 2002:ac8:fb4:: with SMTP id b49mr5027937qtk.323.1591819238494; Wed, 10 Jun 2020 13:00:38 -0700 (PDT) X-Received: by 2002:ac8:fb4:: with SMTP id b49mr5027914qtk.323.1591819238304; Wed, 10 Jun 2020 13:00:38 -0700 (PDT) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id x11sm693401qti.60.2020.06.10.13.00.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 13:00:37 -0700 (PDT) Subject: Re: [PATCH 1/1] selinux: fix double free To: Stephen Smalley Cc: Paul Moore , Eric Paris , Ondrej Mosnacek , Jeffrey Vander Stoep , rgb@redhat.com, SElinux list , linux-kernel References: <20200610181021.19209-1-trix@redhat.com> <20200610181021.19209-2-trix@redhat.com> From: Tom Rix Message-ID: <5bfa5213-7d1b-684a-9e21-488fcbf14b91@redhat.com> Date: Wed, 10 Jun 2020 13:00:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> +++ b/security/selinux/ss/services.c >> @@ -2888,8 +2888,12 @@ int security_get_bools(struct selinux_state *state, >> if (*names) { >> for (i = 0; i < *len; i++) >> kfree((*names)[i]); >> + kfree(names); > kfree(*names)? Yes. > kfree(*values); >> + *len = 0; >> + *names = NULL; >> + *values = NULL; >> goto out; >> } > Wondering if the caller handling ought to be changed too even though > this should avoid the problem. > The poisoning of the returns avoids this.