diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/fs/namei.c b/fs/namei.c index c283a1ec008e..208c6aa4a989 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -140,21 +140,19 @@ static int do_getname(const char __user *filename, char *page) | |||
140 | 140 | ||
141 | static char *getname_flags(const char __user *filename, int flags, int *empty) | 141 | static char *getname_flags(const char __user *filename, int flags, int *empty) |
142 | { | 142 | { |
143 | char *tmp, *result; | 143 | char *result = __getname(); |
144 | 144 | int retval; | |
145 | result = ERR_PTR(-ENOMEM); | 145 | |
146 | tmp = __getname(); | 146 | if (!result) |
147 | if (tmp) { | 147 | return ERR_PTR(-ENOMEM); |
148 | int retval = do_getname(filename, tmp); | 148 | |
149 | 149 | retval = do_getname(filename, result); | |
150 | result = tmp; | 150 | if (retval < 0) { |
151 | if (retval < 0) { | 151 | if (retval == -ENOENT && empty) |
152 | if (retval == -ENOENT && empty) | 152 | *empty = 1; |
153 | *empty = 1; | 153 | if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) { |
154 | if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) { | 154 | __putname(result); |
155 | __putname(tmp); | 155 | return ERR_PTR(retval); |
156 | result = ERR_PTR(retval); | ||
157 | } | ||
158 | } | 156 | } |
159 | } | 157 | } |
160 | audit_getname(result); | 158 | audit_getname(result); |