Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbbEDWTj (ORCPT ); Mon, 4 May 2015 18:19:39 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:4193 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbbEDWTa (ORCPT ); Mon, 4 May 2015 18:19:30 -0400 From: Yann Droneaud To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yann Droneaud Subject: [PATCH 0/3] seq_file allocation in seq_open() Date: Tue, 5 May 2015 00:19:12 +0200 Message-Id: X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1308 Lines: 39 Hi, I found myself trying to use seq_open() and experiencing crash as seq_open() was using my private data in file->private_data as its own struct seq_file. It should be noted such behavior is not documented. It's also an issue if seq_release() is used in release handler, as it will kfree() a pointer which was not allocated by seq_open(). So, please find a patchset that drop the support for pre-allocated struct seq_file in seq_open(): it's only of use in proc_namespace.c and can be easily replaced by using seq_open_private()/seq_release_private(). Additionally, it documents the use of file->private_data to hold pointer to struct seq_file. Yann Droneaud (3): fs: use seq_open_private() for proc_mounts fs: allocate structure unconditionally in seq_open() fs: documents seq_open()'s usage of file->private_data fs/mount.h | 3 --- fs/namespace.c | 6 +++--- fs/proc_namespace.c | 34 ++++++++++++++++------------------ fs/seq_file.c | 18 +++++++++++------- 4 files changed, 30 insertions(+), 31 deletions(-) -- 2.1.0 -- 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/