Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684488

Re: [Patch] mqueue: fix netlink sock refcnt and skb refcnt

From Cong Wang <xiyou.wangcong@gmail.com>
Newsgroups linux.kernel
Subject Re: [Patch] mqueue: fix netlink sock refcnt and skb refcnt
Date 2017-07-10 19:30 +0200
Message-ID <u1KFr-7Ua-7@gated-at.bofh.it> (permalink)
References <u1z7j-JK-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Jul 9, 2017 at 10:08 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> netlink_sendskb() is problematic, it releases sock refcnt
> silently which could cause troubles we can call it multiple
> times. info->notify_sock is a good example where we
> setup once and use it to send netlink skb's for many times.
> It should not hold or release any refcnt, but needs to rely
> on netlink_attachskb()/netlink_detachskb() to hold/release
> the corresponding refcnt.
>
> Same for the skb attached to this sock, it is allocated once
> and used for multiple times, so we should hold its refcnt
> in netlink_attachskb().
>
> At last, we need to call netlink_detachskb() to release
> both refcnt's after we remove the notification.

Hmm, the info->notify_owner is NULL'ed after sending
the notification, so probably we don't put the sock refcnt
repeatly. Not sure about the skb though...

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Patch] mqueue: fix netlink sock refcnt and skb refcnt Cong Wang <xiyou.wangcong@gmail.com> - 2017-07-10 07:10 +0200
  Re: [Patch] mqueue: fix netlink sock refcnt and skb refcnt Cong Wang <xiyou.wangcong@gmail.com> - 2017-07-10 19:30 +0200
  Re: [Patch] mqueue: fix netlink sock refcnt and skb refcnt Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-10 20:20 +0200
    Re: [Patch] mqueue: fix netlink sock refcnt and skb refcnt Cong Wang <xiyou.wangcong@gmail.com> - 2017-07-11 22:00 +0200

csiph-web