Re: [PATCH 2/2] ksmbd: centralize ksmbd_conn final release to plug transport leak

CharSyam
2026-04-27T01:32:30Z

The intent was to snapshot the key returned by idr_get_next() so
that the idr_remove() target was a separate name from the
iteration cursor — the body grew with the two branches and the
unlock/relock around session_fd_check(), and I wanted "the
key we just resolved" to read independently of "the cursor we bump
at the end of the loop".

That said, on re-reading the final shape, id is not modified between
idr_get_next() and either idr_remove() call site, so
saved_id is functionally just an alias. I'll drop it in v3 and pass
id directly.

2026년 4월 27일 (월) 오전 10:07, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> > -
> > - if (skip(tcon, fp, sess->user) ||
> > - !atomic_dec_and_test(&fp->refcount)) {
> > + saved_id = id;
> What is the reason for backing up the id to saved_id?
>
> > + if (!atomic_inc_not_zero(&fp->refcount)) {
> > id++;
> > write_unlock(&ft->lock);
> > continue;
> > }