From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331AbcAYBGq (ORCPT ); Sun, 24 Jan 2016 20:06:46 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:32439 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753558AbcAYBGo (ORCPT ); Sun, 24 Jan 2016 20:06:44 -0500 Date: Mon, 25 Jan 2016 02:06:27 +0100 From: Willy Tarreau To: Eric Dumazet Cc: Eric Dumazet , Dmitry Vyukov , netdev , Rainer Weikusat , Michal Hocko , Andrew Morton , "Paul E. McKenney" , Vladimir Davydov , Johannes Weiner , LKML , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin Subject: Re: [PATCH net] af_unix: fix struct pid memory leak Message-ID: <20160125010627.GB14576@1wt.eu> References: <1453481401.1223.396.camel@edumazet-glaptop2.roam.corp.google.com> <20160123180010.GB1609@1wt.eu> <20160123184007.GE1609@1wt.eu> <20160124021145.GA12367@1wt.eu> <20160124023824.GA13942@1wt.eu> <20160124030412.GA13949@1wt.eu> <1453672430.1223.456.camel@edumazet-glaptop2.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453672430.1223.456.camel@edumazet-glaptop2.roam.corp.google.com> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On Sun, Jan 24, 2016 at 01:53:50PM -0800, Eric Dumazet wrote: > From: Eric Dumazet > > Dmitry reported a struct pid leak detected by a syzkaller program. > > Bug happens in unix_stream_recvmsg() when we break the loop when a > signal is pending, without properly releasing scm. > > Fixes: b3ca9b02b007 ("net: fix multithreaded signal handling in unix recv routines") > Reported-by: Dmitry Vyukov > Signed-off-by: Eric Dumazet > Cc: Rainer Weikusat > --- > net/unix/af_unix.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c > index c5bf5ef2bf89..49d5093eb055 100644 > --- a/net/unix/af_unix.c > +++ b/net/unix/af_unix.c > @@ -2339,6 +2339,7 @@ again: > > if (signal_pending(current)) { > err = sock_intr_errno(timeo); > + scm_destroy(&scm); > goto out; > } Good job on this one! FWIW, I managed to test it on 3.14 and I confirm it completely fixes the leak there as well. I had to modify it a little bit however since there's no scm local variable there : - scm_destroy(&scm); + scm_destroy(siocb->scm); Cheers, Willy