Re: [RFC][PATCH 10/13] get rid of audit_reusename()
Linus Torvalds <[email protected]>
| Newsgroups | org.kernel.vger.audit,org.kernel.vger.io-uring,org.kernel.vger.linux-fsdevel |
|---|---|
| Message-ID | <CAHk-=whxqWfNmPuE59P56Q-U29he2x3BO9C0Q4bUPphBtNdQpg@mail.gmail.com> |
On Sun, 9 Nov 2025 at 22:37, Al Viro <[email protected]> wrote: > > > @@ -258,13 +264,13 @@ struct filename *getname_kernel(const char * filename) > > > > tmp = kmalloc(size, GFP_KERNEL); > > if (unlikely(!tmp)) { > > - __putname(result); > > + free_filename(result); > > return ERR_PTR(-ENOMEM); > > } > > tmp->name = (char *)result; > > result = tmp; > > That's wrong - putname() will choke on that (free_filename() on result of > kmalloc()). Yeah, that's me not doing the right conversion from the old crazy "turn allocations around". It should just do char *tmp = kmalloc(len, GFP_KERNEL); .... NULL check .. result->name = tmp; without any odd games with types. And yeah, that code could be re-organized to be clearer. Linus