Thread (1 message) 1 message, 1 author, 2023-07-14

Re: [PATCH] can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock

From: Astra Joan <hidden>
Date: 2023-07-14 05:59:04

Hi Stephen,

Thank you for your reply!

Changing the lock sequence may be difficult here since the function

- j1939_sk_errqueue

has may call sites. However, this function attempts to hold the

- j1939_socks_lock

whose hierchy is pretty high in the given code logic. On the other hand,
this function only reads from the

- j1939_socks_list

which the above lock protects against. Therefore, it seems appropriate to
lock the above list inside the function for read access only.

The RCU approach makes sense here, but I probably need to use RCU in
conjunction with other spinlocks and rwlocks in the codebase. Would that
be okay? If not, should I be looking into replacing all the locks with
RCU? I'm actually a mentee for the bug fixing mentorship this summer.
So please bear with me if some of these questions seem a bit naive :D
Thank you so much for your time!

Best regards,
Ziqi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help