Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2235744ybi; Thu, 20 Jun 2019 11:20:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6TNfpEhHjzuW9JG3wQy165fYq/oW8C/oGK1hidV+vYzlZYvPXpaJBhXzV7qVMk2ioLHdw X-Received: by 2002:a17:902:8649:: with SMTP id y9mr48712612plt.289.1561054858008; Thu, 20 Jun 2019 11:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054858; cv=none; d=google.com; s=arc-20160816; b=Q9zeVSsl63UlQbLj3ytSf6nQzxDKKbHOXI5BhPqmLKHxAPi3cYUneQ8Hhv/OA3HhQL ilj3bjFIMSpmI1q8VZhqmRQQSB7OyFILpAXqbRQDFw64Ix2XlXFyYoU1GQD51jJloTvc aOAOmdh/PvaEWsSjjB41NeB8rt1xOYw9FfkIQSG17IZkTlq28Si9Gf1hswgB1GqzSZf6 jzkCMX+bzcWKKDLD8rMmTtdNXXzFFANjttWK7BGVaBbtftnGVVfZnpmagC/OmXbGG9+7 pgK0GQw/YpxDtcQQJtUErCloOWyciZWH7FfwKbXFsNdsI2IIPQkJqMumeJ/CFIXqCt4+ NRxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oP2Gr2fiNklo1tVvWBxgmUIHsNt/PrdqOnEjSilO8cc=; b=TJVRw/NbRkJ2QRNf/Z11Oqg8ZmitHn687wQyzNyculoXbiM9gV6plpJOcutKJGyK3v iFh/U/ddLQ1hwXrdhJL8t2+pOc2sMV7RhR6Zq8Kb2V/FLsDyY9IQbCp8X07q6RrbjbYI DA1w2RBshjsrK+w13992X4zRN1MD3PRKtCwCj/cmW9irrMVVhFK1baQx98O7ld2iIzt+ WGLsP8ClMGpPpMUMM523OXcmdQobKz+DIDSauhsl/KMf397eKwIUc9dHf1tDfNwXPyhp 4EO1NCLH2CToHPPCt1rh6VvuZJpcdnQKvy9J/vhpNdSp6NECVyk6YpluGtM5E56Vl9Ly zhXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0I24ZKhC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si415246pjr.46.2019.06.20.11.20.42; Thu, 20 Jun 2019 11:20:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0I24ZKhC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbfFTSN0 (ORCPT + 99 others); Thu, 20 Jun 2019 14:13:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:41308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729253AbfFTSNX (ORCPT ); Thu, 20 Jun 2019 14:13:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CF0A2082C; Thu, 20 Jun 2019 18:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054402; bh=MnLRgpKf8bf7JXa3l3G1EigBR7h3gNLETgMTq6ZJNU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0I24ZKhCnzXtwowSEsl5Uv1o4OsqunqI4zp1fBCEpFAfCmSntFB3b2xDNngqhMF11 zQCkA5ByKsI5Wbge3SR3QyD5mt+5SvOCVJ7jyHq4y4VZuwOkWMvl3nWJsO0bd9OvZK c6BSMn1j4jUfAf0swWHuxHppKMwcvQ6m8PjzG7x4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+afb980676c836b4a0afa@syzkaller.appspotmail.com, Jeremy Sowden , "David S. Miller" Subject: [PATCH 5.1 06/98] lapb: fixed leak of control-blocks. Date: Thu, 20 Jun 2019 19:56:33 +0200 Message-Id: <20190620174349.679064015@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Sowden [ Upstream commit 6be8e297f9bcea666ea85ac7a6cd9d52d6deaf92 ] lapb_register calls lapb_create_cb, which initializes the control- block's ref-count to one, and __lapb_insert_cb, which increments it when adding the new block to the list of blocks. lapb_unregister calls __lapb_remove_cb, which decrements the ref-count when removing control-block from the list of blocks, and calls lapb_put itself to decrement the ref-count before returning. However, lapb_unregister also calls __lapb_devtostruct to look up the right control-block for the given net_device, and __lapb_devtostruct also bumps the ref-count, which means that when lapb_unregister returns the ref-count is still 1 and the control-block is leaked. Call lapb_put after __lapb_devtostruct to fix leak. Reported-by: syzbot+afb980676c836b4a0afa@syzkaller.appspotmail.com Signed-off-by: Jeremy Sowden Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/lapb/lapb_iface.c | 1 + 1 file changed, 1 insertion(+) --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -182,6 +182,7 @@ int lapb_unregister(struct net_device *d lapb = __lapb_devtostruct(dev); if (!lapb) goto out; + lapb_put(lapb); lapb_stop_t1timer(lapb); lapb_stop_t2timer(lapb);