Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753439Ab1EPJUf (ORCPT ); Mon, 16 May 2011 05:20:35 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:41927 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753202Ab1EPJUd (ORCPT ); Mon, 16 May 2011 05:20:33 -0400 From: Julia Lawall To: Greg Kroah-Hartman Cc: kernel-janitors@vger.kernel.org, Vipin Mehta , Joe Perches , "Luis R. Rodriguez" , Naveen Singh , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/staging/ath6kl/os/linux/cfg80211.c: Add missing call to cfg80211_put_bss Date: Mon, 16 May 2011 11:20:29 +0200 Message-Id: <1305537629-29876-1-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1901 Lines: 63 From: Julia Lawall A call to cfg80211_get_bss hould be accompanied by a call to cfg80211_put_bss in error-handling code. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @r exists@ local idexpression struct cfg80211_bss * x; expression ra,rr; position p1,p2; @@ x = cfg80211_get_bss@p1(...) ... when != x = rr when != cfg80211_put_bss(x,...) when != if (...) { ... cfg80211_put_bss(x,...) ...} if(...) { ... when != x = ra when forall when != cfg80211_put_bss(x,...) \(return <+...x...+>; \| return@p2...; \) } @script:python@ p1 << r.p1; p2 << r.p2; @@ cocci.print_main("cfg80211_get_bss",p1) cocci.print_secs("return",p2) // Signed-off-by: Julia Lawall --- I don't really understand the use of the bss variable later. Afterwards, along the normal execution path, there is also a call to cfg80211_put_bss, but at this point bss has been redefined, and I don't have the impression that it still points to the same value. drivers/staging/ath6kl/os/linux/cfg80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c index efd4ae5..1e6a343 100644 --- a/drivers/staging/ath6kl/os/linux/cfg80211.c +++ b/drivers/staging/ath6kl/os/linux/cfg80211.c @@ -545,6 +545,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel, if(!ieeemgmtbuf) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ieeeMgmtbuf alloc error\n", __func__)); + cfg80211_put_bss(bss); return; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/