[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpW+3w28v6VVvAPrtmKh_Y7UXfFvna9ey77f9m3mDn7tZQ@mail.gmail.com>
Date: Thu, 8 Oct 2020 10:44:56 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Xin Long <lucien.xin@...il.com>
Cc: network dev <netdev@...r.kernel.org>,
syzbot <syzbot+e96a7ba46281824cc46a@...kaller.appspotmail.com>,
Jon Maloy <jmaloy@...hat.com>,
Ying Xue <ying.xue@...driver.com>
Subject: Re: [Patch net] tipc: fix the skb_unshare() in tipc_buf_append()
On Thu, Oct 8, 2020 at 1:45 AM Xin Long <lucien.xin@...il.com> wrote:
>
> On Thu, Oct 8, 2020 at 12:12 PM Cong Wang <xiyou.wangcong@...il.com> wrote:
> >
> > skb_unshare() drops a reference count on the old skb unconditionally,
> > so in the failure case, we end up freeing the skb twice here.
> > And because the skb is allocated in fclone and cloned by caller
> > tipc_msg_reassemble(), the consequence is actually freeing the
> > original skb too, thus triggered the UAF by syzbot.
> Do you mean:
> frag = skb_clone(skb, GFP_ATOMIC);
> frag = skb_unshare(frag) will free the 'skb' too?
Yes, more precisely, I mean:
new = skb_clone(old)
kfree_skb(new)
kfree_skb(new)
would free 'old' eventually when 'old' is a fast clone. The skb_clone()
sets ->fclone_ref to 2 and returns the clone, whose skb->fclone is
SKB_FCLONE_CLONE. So, the first call of kfree_skbmem() will
just decrease ->fclone_ref by 1, but the second call will trigger
kmem_cache_free() which frees _both_ skb's.
Thanks.
Powered by blists - more mailing lists