Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751594AbbKMFnD (ORCPT ); Fri, 13 Nov 2015 00:43:03 -0500 Received: from mail-ob0-f170.google.com ([209.85.214.170]:36594 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbbKMFnB (ORCPT ); Fri, 13 Nov 2015 00:43:01 -0500 MIME-Version: 1.0 Reply-To: rajatxjain@gmail.com Date: Thu, 12 Nov 2015 21:43:00 -0800 Message-ID: Subject: Anonymous inode cleanup? From: Rajat Jain To: linux-fsdevel@vger.kernel.org, Alexander Viro , Davide Libenzi Cc: "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 934 Lines: 34 Hello, I'm writing a module that wants to get anonymous fd [using anon_inode_getfd()] and my code looks like this: fd = anon_inode_getfd(...) if (fd < 0) return -EINVAL; if (foobar_fail()) { /* undo everything */ return -EINVAL; } My question is that in case of a failure after the anon_inode_getfd(), I want to cleanup and undo whatever needs to be done w.r.t. anodnymous fd I just allocated. (May be put a reference, or return the fd to the free pool or whatever). Can some one please let me know what cleanup needs to be done? However neither I see a cleanup function, nor I see any of the drivers attempting to free the fd in case of failure. Thanks, Thanks, Rajat -- 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/