Re: [PATCH v2] mm: mmap_lock: fix use-after-free race and css ref leak in tracepoints

From: Steven Rostedt
Date: Tue Dec 01 2020 - 16:32:06 EST


On Tue, 1 Dec 2020 16:28:47 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Tue, 1 Dec 2020 12:32:49 -0800
> Axel Rasmussen <axelrasmussen@xxxxxxxxxx> wrote:
>
> > +/* Called with reg_lock held. */
>
> The above comment is reduntant, as the lockdep_is_held() below also suggest
> that it is ;-)
>


>
> > static inline char *get_memcg_path_buf(void)
> > {
> > + char *buf;
> > int idx;
> >
> > + rcu_read_lock();
>
> The caller of get_mm_memcg_path() has preemption disabled, which is also
> now an RCU lock. So the rcu_read_lock() is somewhat redundant.


BTW, both of these comments are FYI. You can keep the comment and keep the
rcu_read_lock(). I was just stating that they are redundant, but keeping
them may make the code a bit more robust.

-- Steve