From patchwork Mon Nov 26 14:16:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommi Rantala X-Patchwork-Id: 201703 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7786D2C008C for ; Tue, 27 Nov 2012 01:17:02 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753160Ab2KZOQ7 (ORCPT ); Mon, 26 Nov 2012 09:16:59 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:56772 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260Ab2KZOQ6 (ORCPT ); Mon, 26 Nov 2012 09:16:58 -0500 Received: by mail-wg0-f44.google.com with SMTP id dr13so2168469wgb.1 for ; Mon, 26 Nov 2012 06:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=d+dpnlpOxpfw59IoYXarAT3CBRsYLEbafgPRmxLA5K0=; b=BlvSBhxIBd0WMqWStaQ54uJJV0xg8dpWY6V4EDKRvCWezmhJBbKKlyGu4e33M+wTUM CEUawZEdnfM6t9BTHGGIQw5M/qH2NGPc1zs/neATXzA7SffLLxMu4V6EbbeqJuRxw60Q RNsFPvO/l4I2Vgf5cN6kzcMxTdC2aZNCjmZhnTdK/jbSWmVzGmSSnhFc7E8hvbQbXWae ayoh9utP3/GSt7x+OlKT/KmVtDUuiifzuOW36tgcrlL+EGo95a4cgasNnsb8iWOeiCMl vuF69/JVLzZeamvRBcQbTSCK1FtcNFREn17/RaJPMK6LouTILg2f+P3QxRaJI2uMjobV INVQ== Received: by 10.216.206.143 with SMTP id l15mr3883718weo.153.1353939416887; Mon, 26 Nov 2012 06:16:56 -0800 (PST) Received: from localhost.localdomain (espcolo-webproxy02.nokia.com. [192.100.120.42]) by mx.google.com with ESMTPS id ec3sm21272864wib.10.2012.11.26.06.16.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 06:16:56 -0800 (PST) From: Tommi Rantala To: netdev@vger.kernel.org Cc: Samuel Ortiz , "David S. Miller" , Dave Jones , Tommi Rantala Subject: [PATCH] irda: irttp: fix memory leak in irttp_open_tsap() error path Date: Mon, 26 Nov 2012 16:16:44 +0200 Message-Id: <1353939404-19264-1-git-send-email-tt.rantala@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Cleanup the memory we allocated earlier in irttp_open_tsap() when we hit this error path. The leak goes back to at least 1da177e4 ("Linux-2.6.12-rc2"). Discovered with Trinity (the syscall fuzzer). Signed-off-by: Tommi Rantala --- net/irda/irttp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 1002e33..ae43c62 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -441,6 +441,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) lsap = irlmp_open_lsap(stsap_sel, &ttp_notify, 0); if (lsap == NULL) { IRDA_DEBUG(0, "%s: unable to allocate LSAP!!\n", __func__); + __irttp_close_tsap(self); return NULL; }