Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756977AbbDVDun (ORCPT ); Tue, 21 Apr 2015 23:50:43 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:36805 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754528AbbDVDul (ORCPT ); Tue, 21 Apr 2015 23:50:41 -0400 From: Boqun Feng To: linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Boqun Feng , Al Viro , Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Jan Kara Subject: [PATCH 0/2] staging: lustre: Replace ll_getname with vfs' getname Date: Wed, 22 Apr 2015 11:50:22 +0800 Message-Id: <1429674624-25922-1-git-send-email-boqun.feng@gmail.com> X-Mailer: git-send-email 2.3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1955 Lines: 47 As Al Viro pointed out: https://lkml.org/lkml/2015/4/11/243 There are bugs in ll_getname() because of wrong assumptions of returning values from strncpy_from_user(). Moreover, what ll_getname want to do is just to try copy the file name from userland. Since we already have getname() for the same purpose, it's better to replace ll_getname() with getname(). To do that, we need to: 1) export the symbols of getname() and putname() to be used by modules. 2) actually replace ll_getname()/ll_putname() with getname()/putname(). One more thing is that as ll_getname() and getname() both treat a zero-length file name as an error(-ENOENT), and if ll_getname() or getname() has an error, ll_dir_ioctl() will return the error immediately, so checking whether these names are zero-length is unnecessary and -ENIVAL shall not return from that code path, no matter using ll_getname() or getname(). So remove the checking code. This patchset is based on v4.0, and I only did build tests, because I found a little difficult to set up a lustre environment. I'll try to do the testing once I'm able to set up an environment, in the meanwhile, comments, inputs from lustre's point of view and voluntary tests are welcome. Thank you. ;-) Regards, Boqun Feng Boqun Feng (2): vfs: Export symbol 'getname' and 'putname' staging: lustre: replace ll_{get,put}name() with {get,put}name() drivers/staging/lustre/lustre/llite/dir.c | 60 ++++++---------------- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/namei.c | 2 +- fs/namei.c | 18 +++++++ 4 files changed, 36 insertions(+), 46 deletions(-) -- 2.3.5 -- 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/