Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1366115ybi; Fri, 31 May 2019 19:27:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuVaLte+UJCDJcGGUQYthg+KqZ6PkNjpJ6potErgfE4SVqmMyKsQdIHGfJdueS3c/qyluo X-Received: by 2002:a63:c006:: with SMTP id h6mr8617717pgg.368.1559356031025; Fri, 31 May 2019 19:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559356031; cv=none; d=google.com; s=arc-20160816; b=eaK8yPcoAJ15zfkqwOax0ThlBfDSzpkM2NqrKQoNgdDX7ykE3nJrpCSY9AVpxGC5KD 2qGXMh1cCDpGY3gDcqDGfA8CgwbvWDNSDEcOSuhgb2q6xCHWQWAKCJNpb9Q7aTfqp+bn 624jWB+y1n2gr97Tt4uhksCGmjeK3aTYCyIps6JRDxKJDd/NqLEeX38ZogQZk8zA4rpA 7dGCe8T5D0YERfYTXx08HRmVq4Jm/OMXD7gFNx0gcQObLVFhaofVWNE6XSLZ/ufUexXP n1OHR6NEWWqUSY3EinFN0ZVIWZCdZj4OiIdVO5TCY571dm0tgqAs+pKWUp5ln7bU2gAL NuYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6xECxg7AtydhWpweoCRVKqCaEd3TBIvUXBCkCosX32k=; b=NGUEUXjdfAkDGFclaAkFZVEmrD/klsvy4Y/wTuHc/Pv+I9mpMFw80GaDGbCi38OvdX CqZ9q3gR0QWLZ/InEja5zkrqFzi0RDRA7LeLpwb2HmavQ7w47a/70LZdQsVRjiwuhStS L55fg3Q2mPSKqw/VvIZP8z5rMZyxAuJSaSwZoC9DzFHbmbIssuW+1ygWSk1TkS1NZR7F +wsjy53Ph4JIbVXqaxesVENr5Je7RrTh5k0baW7c+JihoeAN+p6DQmzohFJ6hwIcdZjl yuKebD5oSjz6lhCj9Y7TzOwq/xz57KPPCko3InUQmkuCYN2/ObTYzx3DBF4h9OwLVwlV +x2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si7961588pjl.64.2019.05.31.19.26.52; Fri, 31 May 2019 19:27:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbfFACZl (ORCPT + 99 others); Fri, 31 May 2019 22:25:41 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:37646 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfFACZk (ORCPT ); Fri, 31 May 2019 22:25:40 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hWti3-0004WW-Up; Sat, 01 Jun 2019 02:25:28 +0000 Date: Sat, 1 Jun 2019 03:25:27 +0100 From: Al Viro To: Gen Zhang Cc: paul@paul-moore.com, sds@tycho.nsa.gov, eparis@parisplace.org, omosnace@redhat.com, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH v3] selinux: lsm: fix a missing-check bug in selinux_sb_eat_lsm_opts() Message-ID: <20190601022527.GR17978@ZenIV.linux.org.uk> References: <20190601021526.GA8264@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190601021526.GA8264@zhanggen-UX430UQ> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 01, 2019 at 10:15:26AM +0800, Gen Zhang wrote: > In selinux_sb_eat_lsm_opts(), 'arg' is allocated by kmemdup_nul(). It > returns NULL when fails. So 'arg' should be checked. And 'mnt_opts' > should be freed when error. What's the latter one for? On failure we'll get to put_fs_context() pretty soon, so security_free_mnt_opts(&fc->security); will be called just fine. Leaving it allocated on failure is fine...