1 From MAILER-DAEMON Tue Sep 23 08:37:13 2003
2 Date: 23 Sep 2003 08:37:13 +0000
3 From: Mail System Internal Data <MAILER-DAEMON@alpha.zarz.agh.edu.pl>
4 Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
5 X-IMAP: 1064306233 0000000000
8 This text is part of the internal format of your mail folder, and is not
9 a real message. It is created automatically by the mail system software.
10 If deleted, important folder data will be lost, and it will be re-created
11 with the data reset to initial values.
13 From cieciwa@alpha.zarz.agh.edu.pl Tue Sep 23 00:47:23 2003 +0000
17 Return-Path: <linux-kernel-owner+cieciwa=40alpha.zarz.agh.edu.pl@vger.kernel.org>
18 X-Original-To: cieciwa@alpha.zarz.agh.edu.pl
19 Delivered-To: cieciwa@alpha.zarz.agh.edu.pl
20 Received: from galaxy.uci.agh.edu.pl (galaxy.uci.agh.edu.pl [149.156.96.9])
21 by alpha.zarz.agh.edu.pl (Postfix) with ESMTP id D5104241A5
22 for <cieciwa@alpha.zarz.agh.edu.pl>; Tue, 23 Sep 2003 00:47:23 +0000 (UTC)
23 Received: from vger.kernel.org (vger.kernel.org [67.72.78.212])
24 by galaxy.uci.agh.edu.pl (Postfix) with ESMTP id 1E9D0AF3D2
25 for <cieciwa@alpha.zarz.agh.edu.pl>; Tue, 23 Sep 2003 00:59:49 +0200 (CEST)
26 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
27 id S261746AbTIVW4C (ORCPT <rfc822;cieciwa@alpha.zarz.agh.edu.pl>);
28 Mon, 22 Sep 2003 18:56:02 -0400
29 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261808AbTIVW4B
30 (ORCPT <rfc822;linux-kernel-outgoing>);
31 Mon, 22 Sep 2003 18:56:01 -0400
32 Received: from fw.osdl.org ([65.172.181.6]:9186 "EHLO mail.osdl.org")
33 by vger.kernel.org with ESMTP id S261746AbTIVWzV (ORCPT
34 <rfc822;linux-kernel@vger.kernel.org>);
35 Mon, 22 Sep 2003 18:55:21 -0400
36 Received: (from chrisw@localhost)
37 by mail.osdl.org (8.11.6/8.11.6) id h8MMtDR13235;
38 Mon, 22 Sep 2003 15:55:13 -0700
39 Date: Mon, 22 Sep 2003 15:55:13 -0700
40 From: Chris Wright <chrisw@osdl.org>
41 To: David Yu Chen <dychen@stanford.edu>
42 Cc: linux-kernel@vger.kernel.org, mc@cs.stanford.edu,
43 James.Bottomley@SteelEye.com
44 Subject: Re: [CHECKER] 32 Memory Leaks on Error Paths
45 Message-ID: <20030922155513.F18606@osdlab.pdx.osdl.net>
46 References: <200309160435.h8G4ZkQM009953@elaine4.Stanford.EDU>
48 Content-Type: text/plain; charset=us-ascii
49 Content-Disposition: inline
50 User-Agent: Mutt/1.2.5i
51 In-Reply-To: <200309160435.h8G4ZkQM009953@elaine4.Stanford.EDU>; from dychen@stanford.edu on Mon, Sep 15, 2003 at 09:35:46PM -0700
52 Sender: linux-kernel-owner@vger.kernel.org
54 X-Mailing-List: linux-kernel@vger.kernel.org
56 * David Yu Chen (dychen@stanford.edu) wrote:
57 > [FILE: 2.6.0-test5/drivers/scsi/scsi_debug.c]
58 > [FUNC: sdebug_add_adapter]
61 > 1607: memset(sdbg_host, 0, sizeof(*sdbg_host));
62 > 1608: INIT_LIST_HEAD(&sdbg_host->dev_info_list);
64 > 1610: devs_per_host = scsi_debug_num_tgts * scsi_debug_max_luns;
65 > 1611: for (k = 0; k < devs_per_host; k++) {
67 > 1612: sdbg_devinfo = kmalloc(sizeof(*sdbg_devinfo),GFP_KERNEL);
68 > 1613: if (NULL == sdbg_devinfo) {
69 > 1614: printk(KERN_ERR "%s: out of memory at line %d\n",
70 > 1615: __FUNCTION__, __LINE__);
71 > 1616: error = -ENOMEM;
74 > ... DELETED 29 lines ...
75 > 1647: kfree(sdbg_devinfo);
79 > 1651: kfree(sdbg_host);
83 Yes, this could leak sdbg_devinfo structs. Patch below. James, look ok?
88 ===== drivers/scsi/scsi_debug.c 1.44 vs edited =====
89 --- 1.44/drivers/scsi/scsi_debug.c Fri Aug 15 10:07:53 2003
90 +++ edited/drivers/scsi/scsi_debug.c Mon Sep 22 15:27:17 2003
92 printk(KERN_ERR "%s: out of memory at line %d\n",
93 __FUNCTION__, __LINE__);
98 memset(sdbg_devinfo, 0, sizeof(*sdbg_devinfo));
99 sdbg_devinfo->sdbg_host = sdbg_host;
100 @@ -1634,12 +1634,12 @@
101 error = device_register(&sdbg_host->dev);
107 ++scsi_debug_add_host;
112 list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) {
113 sdbg_devinfo = list_entry(lh, struct sdebug_dev_info,
115 @@ -1647,7 +1647,6 @@
124 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
125 the body of a message to majordomo@vger.kernel.org
126 More majordomo info at http://vger.kernel.org/majordomo-info.html
127 Please read the FAQ at http://www.tux.org/lkml/