Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp830960ybg; Wed, 10 Jun 2020 15:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjptUPH3OUWLATsPLu9y8YyPGphTZ0rUhkI/sSO2lNtUEbuA2YMUSCWpJZejZy+Q3atVz+ X-Received: by 2002:a17:906:3c8:: with SMTP id c8mr5491421eja.129.1591826976977; Wed, 10 Jun 2020 15:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591826976; cv=none; d=google.com; s=arc-20160816; b=KkiK2RFFCLxvEap/HQmDE9XtwjDInpj3wlM8MM4S7hFG1rjyxPj5oVSXhKU34st6rt rJjuPYSzpfTWUv/2m/NoglioBqY4QFY/jmbKADlRgHgZ3V5LQBu7zWAN52r+19wGmE4s JSMGU1HBJL8Gg56E0XL9Oami1R68RUK5vlEaXJJlBMREgcWIsnfnE5Sseb2BJtUqRtii /YuCTuVRPfKeTbbzFBsNY6KhGY79TF2kmuRf13v13n+JJbokMX4z6+0H3VbV57omqrAA PcDf1v9BH6YojNqZpXh9MAzc7JpbnV0wUm3IZYqaWgSosEptMyJLmfi4k+o1tkLwXVLV RsuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bGYLQ72rVrPxc2DQ3sN7sMtcVrZrTtJZv9NCP3xDIqI=; b=eM2H13T+SuOm4GeAKx4d7eGkqjDxPQU3UlkNOh197kRHDwRS62ibLV7VvtkUPL2uLF 9AsLyjqJDbOvTMHM8F+sPLP3rSGUWn+DBdfmSUN7k4uT57Y+/4ENiu97rOwtuS0K5FwF N83R7akpzM/9RafEQRdF5Gs+KZrR01P9fztZOmhmK3IIfsIK29lZWYX3Lf+pD4GYvEZn zcV1Y/OT8Xs6rh3juMxj9OJaRsJlaxi4gt5iCq4D2l9h9jabkpJ310XqzsHAaL/ymWOF u6hrsS/O+jjTBBcSiM90FXsxcVIj6cxPVGdYLL4Fw2Rs9IO33Abqj6kNfgsIwsSxBPSK nUCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lmRyoqoZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh6si749319ejb.689.2020.06.10.15.09.14; Wed, 10 Jun 2020 15:09:36 -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=@gmail.com header.s=20161025 header.b=lmRyoqoZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgFJWHF (ORCPT + 99 others); Wed, 10 Jun 2020 18:07:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgFJWHE (ORCPT ); Wed, 10 Jun 2020 18:07:04 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8935C03E96B; Wed, 10 Jun 2020 15:07:02 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id c194so3580403oig.5; Wed, 10 Jun 2020 15:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bGYLQ72rVrPxc2DQ3sN7sMtcVrZrTtJZv9NCP3xDIqI=; b=lmRyoqoZS7XFqPMHbMA36tr1PwIivP1GxANDWKAtL/fE+lCI9YsNIOKilkwqJC9jMA /qqif1I2BgDVv6Ql6lyENPzOj9I1nwXHdfHCTVgld1ya964zJljfvnk4caZV41LMcKTQ qFtLNILtjwZkN9E05QxRyNOXna5dZHN9NoaJzbAgzcPTuNvmkxGzbDB41vqZqHIRZJiK UIdHivXcWi+mhIXmsKKsJ1ur7nAtxygHHnsdp4vYO6Ekkl/xsKHwYfk8ffI294M6o4m4 YdjULcbgUqgxV48Ua+Sb382l0wKIhMWd9veger3OMHauT8JILe6d5jteq5WScbeV/H8i ciLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bGYLQ72rVrPxc2DQ3sN7sMtcVrZrTtJZv9NCP3xDIqI=; b=IHjkisVwxroW6hQdMvecATHw9ZfUPrGGdK4PVrf8PLwTJFicY6/IkQ06b4xGAS/TCw z7dPeghBbyroLRSVm3iheeO7tNeTitMw9LMW9a9CLiGgcSRDiBbhY7/B6kzX+rXToh7O R4RHnOJqFq/yjDNPSXPJzy8hF+UJuJ98Sgrf155jur2XkupIVh4CKKVDy7SPJrCFzRu3 AZz2/lk1iMudz29qVYrSxxl3h1QUnkYELoTRFnuoxKjZr4oObUL3Keg6pU7ZW4I7fYOB 0OlPHsOFAry8r583UrR1HX7PmXNtUZAxLEtN1y/uod0jRrX8qMW2EvSkEc7lwGQQCcyD SehA== X-Gm-Message-State: AOAM5316jmSLWLcwFtqcxM79WTntkKELpdavv+VMsg9ECDfNtvFUss+P ybHuAVLlKPvafx+rsDrCfxcapwVmSn+rmPgBKb4= X-Received: by 2002:aca:55c1:: with SMTP id j184mr3982909oib.160.1591826821216; Wed, 10 Jun 2020 15:07:01 -0700 (PDT) MIME-Version: 1.0 References: <20200610215713.5319-1-trix@redhat.com> <20200610215713.5319-2-trix@redhat.com> In-Reply-To: <20200610215713.5319-2-trix@redhat.com> From: Stephen Smalley Date: Wed, 10 Jun 2020 18:06:50 -0400 Message-ID: Subject: Re: [PATCH v2 1/1] selinux: fix double free To: trix@redhat.com Cc: Paul Moore , Eric Paris , Ondrej Mosnacek , Jeffrey Vander Stoep , rgb@redhat.com, SElinux list , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 5:57 PM wrote: > > From: Tom Rix > > Clang's static analysis tool reports these double free memory errors. > > security/selinux/ss/services.c:2987:4: warning: Attempt to free released memory [unix.Malloc] > kfree(bnames[i]); > ^~~~~~~~~~~~~~~~ > security/selinux/ss/services.c:2990:2: warning: Attempt to free released memory [unix.Malloc] > kfree(bvalues); > ^~~~~~~~~~~~~~ > > So improve the security_get_bools error handling by freeing these variables > and setting their return pointers to NULL and the return len to 0 > > Signed-off-by: Tom Rix Acked-by: Stephen Smalley