lkml.org 
[lkml]   [2023]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Buggy __free(kfree) usage pattern already in tree
On Fri, Sep 15, 2023 at 11:08:51PM +0200, Peter Zijlstra wrote:

> But a little later in that same function I then have:
>
> do {
> struct rw_semaphore *exec_update_lock __free(up_read) = NULL;
> if (task) {
> err = down_read_interruptible(&task->signal->exec_update_lock);
> if (err)
> return err;
>
> exec_update_lock = &task->signal->exec_update_lock;
>
> if (!perf_check_permissions(&attr, task))
> return -EACCESS;
> }
>
> ... stuff serialized against exec *if* this is a task event ...
>
> } while (0);
>
>
> And that might be a little harder to 'fix'.

Hmm, perhaps I can do a class for it and write the thing like:

do {
CLASS(cond_exec_update_lock, exec_lock_guard)(task); /* allow task == NULL */
if (task && !exec_lock_guard)
return -EINTR;

if (task && !perf_check_permissions(&attr, task))
return -EACCESS;

... the rest ...

} while (0);

that might be nicer..

\
 
 \ /
  Last update: 2023-09-15 23:19    [W:0.059 / U:2.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site