From: John Fastabend <john.r.fastabend@xxxxxxxxx> This adds the sock lock around setting the sk_err field in sock struct. Without the lock multiple threads may write to this field. Signed-off-by: John Fastabend <john.r.fastabend@xxxxxxxxx> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx> --- net/netlink/af_netlink.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index aa74011..1669dfc 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -732,7 +732,9 @@ static void netlink_overrun(struct sock *sk) if (!(nlk->flags & NETLINK_RECV_NO_ENOBUFS)) { if (!test_and_set_bit(0, &nlk_sk(sk)->state)) { + lock_sock(sk); sk->sk_err = ENOBUFS; + release_sock(sk); sk->sk_error_report(sk); } } @@ -1101,7 +1103,9 @@ static inline int do_one_set_err(struct sock *sk, !test_bit(p->group - 1, nlk->groups)) goto out; + lock_sock(sk); sk->sk_err = p->code; + release_sock(sk); sk->sk_error_report(sk); out: return 0; @@ -1780,7 +1784,9 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) in_skb->sk->sk_protocol, NETLINK_CB(in_skb).pid); if (sk) { + lock_sock(sk); sk->sk_err = ENOBUFS; + release_sock(sk); sk->sk_error_report(sk); sock_put(sk); } -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html