Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbdHQAIK (ORCPT ); Wed, 16 Aug 2017 20:08:10 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:32935 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbdHQAII (ORCPT ); Wed, 16 Aug 2017 20:08:08 -0400 MIME-Version: 1.0 In-Reply-To: <87ziazqdfr.fsf@xmission.com> References: <20170816171211.4021-1-christian.brauner@ubuntu.com> <20170816194805.hnof3aqiqykwki7p@gmail.com> <87pobvruzt.fsf@xmission.com> <87ziazqdfr.fsf@xmission.com> From: Linus Torvalds Date: Wed, 16 Aug 2017 17:08:07 -0700 X-Google-Sender-Auth: k0IO9yIlXPIWfo_Iv8iSCnSK90I Message-ID: Subject: Re: [PATCH 0/1] devpts: use dynamic_dname() to generate proc name To: "Eric W. Biederman" Cc: Christian Brauner , Christian Brauner , Linux Kernel Mailing List , "Serge E. Hallyn" , Al Viro Content-Type: multipart/mixed; boundary="001a113cc6b6a566c30556e7cef4" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4888 Lines: 83 --001a113cc6b6a566c30556e7cef4 Content-Type: text/plain; charset="UTF-8" On Wed, Aug 16, 2017 at 4:51 PM, Eric W. Biederman wrote: > > *Blink* You are right I missed that. > > In which case I am concerned about failures that make it to err_release. > Unless I am missing something (again) failures that jump to err_release > won't call mntput and will result in a mnt leak. Yes, I think you're right. Maybe this attached patch is better anyway. It's smaller, because it keeps more closely to the old code, and just adds a mntput() in all the exit cases, and depends on the "path_get()" to have incremented the mnt refcount one extra time. Can you find something in this one? ENTIRELY UNTESTED! Linus --001a113cc6b6a566c30556e7cef4 Content-Type: text/plain; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j6fotc8s0 IGRyaXZlcnMvdHR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