Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755047AbZLVVZh (ORCPT ); Tue, 22 Dec 2009 16:25:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754132AbZLVVZg (ORCPT ); Tue, 22 Dec 2009 16:25:36 -0500 Received: from mail-fx0-f213.google.com ([209.85.220.213]:41850 "EHLO mail-fx0-f213.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752AbZLVVZg (ORCPT ); Tue, 22 Dec 2009 16:25:36 -0500 Subject: Re: [PATCH 04/27] Driver core: devtmpfs: prevent concurrent subdirectory creation and removal From: Kay Sievers To: "Kirill A. Shutemov" Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org In-Reply-To: References: <20091211212642.GA6624@kroah.com> <1260570289-6997-4-git-send-email-gregkh@suse.de> Content-Type: text/plain; charset="UTF-8" Date: Tue, 22 Dec 2009 22:25:16 +0100 Message-Id: <1261517116.2101.2.camel@yio.site> Mime-Version: 1.0 X-Mailer: Evolution 2.28.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1804 Lines: 62 On Tue, 2009-12-22 at 20:56 +0200, Kirill A. Shutemov wrote: > On Tue, Dec 22, 2009 at 6:57 PM, Kay Sievers wrote: > > On Tue, Dec 22, 2009 at 15:10, Kirill A. Shutemov wrote: > >> On Mon, Dec 21, 2009 at 4:37 PM, Kay Sievers wrote: > >>> On Mon, Dec 21, 2009 at 14:37, Kirill A. Shutemov wrote: > >>>> v2.6.33-rc1-96-gdd59f6c: > >>>> I guess it can be related to this commit. > >>> > >>> The fix is already pending here: > >>> http://patchwork.kernel.org/patch/68337/ > >> > >> One more problem: you don't unlock dirlock if kstrdup() failed. > > > > Oh right, will send a fix tomorrow. > > Reported-by Kirill A. Shutemov Thanks! Kay From: Kay Sievers Subject: devtmpfs: unlock mutex in case of string allocation error Reported-by: Kirill A. Shutemov Signed-off-by: Kay Sievers --- drivers/base/devtmpfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -101,8 +101,10 @@ static int create_path(const char *nodep /* parent directories do not exist, create them */ path = kstrdup(nodepath, GFP_KERNEL); - if (!path) - return -ENOMEM; + if (!path) { + err = -ENOMEM; + goto out; + } s = path; for (;;) { s = strchr(s, '/'); @@ -117,6 +119,7 @@ static int create_path(const char *nodep } kfree(path); } +out: mutex_unlock(&dirlock); return err; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/