Re: [PATCH] [RFC] udp: ipv4: fix potential deadlock on sk_dst_lock

From: Jiri Kosina
Date: Mon Dec 16 2013 - 17:45:30 EST


On Mon, 16 Dec 2013, Eric Dumazet wrote:

> > Commit 975022310 ("udp: ipv4: must add synchronization in
> > udp_sk_rx_dst_set()) caused sk_dst_lock to be obtained in udp4 receive
> > path, which is happening in softirq context.
> >
> > inet_bind() is taking sk_dst_lock (through sk_dst_reset()) without turning
> > IRQs off, which results in the lockdep splat below.
> >
> > Fix that by disabling IRQs while taking the lock in sk_dst_reset().
>
> Thanks but I posted this fix instead :
>
> http://patchwork.ozlabs.org/patch/301382/

Right, I missed the incarnation in sk_dst_set(), so my patch is apparently
incomplete anyway.

But using xchg also fixes the issue.

Thanks,

--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/