Re: [PATCH net v5] net: lapb: Add locking to the lapb module

2021-01-24 Thread Martin Schiller
On 2021-01-24 05:45, Jakub Kicinski wrote: On Fri, 22 Jan 2021 10:07:05 +0100 Martin Schiller wrote: On 2021-01-21 01:21, Xie He wrote: > In the lapb module, the timers may run concurrently with other code in > this module, and there is currently no locking to prevent the code from > racing on

Re: [PATCH net v5] net: lapb: Add locking to the lapb module

2021-01-24 Thread Xie He
On Sat, Jan 23, 2021 at 8:45 PM Jakub Kicinski wrote: > > > > @@ -178,11 +182,23 @@ int lapb_unregister(struct net_device *dev) > > > goto out; > > > lapb_put(lapb); > > > > > > + /* Wait for other refs to "lapb" to drop */ > > > + while (refcount_read(>refcnt) > 2) > > > +

Re: [PATCH net v5] net: lapb: Add locking to the lapb module

2021-01-23 Thread Jakub Kicinski
On Fri, 22 Jan 2021 10:07:05 +0100 Martin Schiller wrote: > On 2021-01-21 01:21, Xie He wrote: > > In the lapb module, the timers may run concurrently with other code in > > this module, and there is currently no locking to prevent the code from > > racing on "struct lapb_cb". This patch adds

Re: [PATCH net v5] net: lapb: Add locking to the lapb module

2021-01-22 Thread Xie He
On Fri, Jan 22, 2021 at 1:07 AM Martin Schiller wrote: > > I don't have the opportunity to test this at the moment, but code looks > reasonable so far. Have you tested this at runtime? Thanks! Yes, I have tested this using hdlc_x25.c, lapbether.c and (the deleted) x25_asy.c drivers.

Re: [PATCH net v5] net: lapb: Add locking to the lapb module

2021-01-22 Thread Martin Schiller
On 2021-01-21 01:21, Xie He wrote: In the lapb module, the timers may run concurrently with other code in this module, and there is currently no locking to prevent the code from racing on "struct lapb_cb". This patch adds locking to prevent racing. 1. Add "spinlock_t lock" to "struct lapb_cb";