From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbZHOHRU (ORCPT ); Sat, 15 Aug 2009 03:17:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752962AbZHOHRU (ORCPT ); Sat, 15 Aug 2009 03:17:20 -0400 Received: from claw.goop.org ([74.207.240.146]:33185 "EHLO claw.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752191AbZHOHRT (ORCPT ); Sat, 15 Aug 2009 03:17:19 -0400 Message-ID: <4A8660FB.20102@goop.org> Date: Sat, 15 Aug 2009 00:17:15 -0700 From: Jeremy Fitzhardinge User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 MIME-Version: 1.0 To: iceberg CC: linux-kernel@vger.kernel.org, James Morris Subject: Re: BUG memory leakage at ./security/selinux/hooks.c References: <200908101253.40317.strakh@ispras.ru> In-Reply-To: <200908101253.40317.strakh@ispras.ru> X-Enigmail-Version: 0.96a Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Added cc: On 08/10/09 01:53, iceberg wrote: > ????????KERNEL_VERSION: 2.6.30.4?? > Looks like you got some kind of charset conversion problem going on. > ????????SUBJECT: ?in function inode_doinit_with_dentry memory is not released > on error path (if rc<0). > ????????DESCRIBE: > ????????In ./security/selinux/hooks.c in function inode_doinit_with_dentry:?? > 1. If in the line 1278 we successfully allocate memory and assign it to > context variablehen > 2. if in the line 1284 getxattr returns -ERANGE and > 3. if in the line 1288 getxattr returns rc<0 > then we go to out_unlock without releasing memory pointed to by context > variable. > > 1278 ????????????????context?=?kmalloc(len,?GFP_NOFS); > 1279 ????????????????if?(!context)?{ > 1280 ????????????????????????rc?=?-ENOMEM; > 1281 ????????????????????????dput(dentry); > 1282 ????????????????????????goto?out_unlock; > 1283 ????????????????} > 1284 ????????????????rc?=?inode->i_op->getxattr(dentry,?XATTR_NAME_SELINUX, > 1285 ???????????????????????????????????????????context,?len); > 1286 ????????????????if?(rc?==?-ERANGE)?{ > 1287 ????????????????????????/*?Need?a?larger?buffer.??Query?for?the > right?size.?*/ > 1288 ????????????????????????rc?=?inode->i_op->getxattr(dentry, > XATTR_NAME_SELINUX, > 1289 ???????????????????????????????????????????????????NULL,?0); > 1290 ????????????????????????if?(rc? 1291 ????????????????????????????????dput(dentry); > 1292 ????????????????????????????????goto?out_unlock; > 1293 ????????????????????????} > 1294 ????????????????????????kfree(context); > 1295 ????????????????????????len?=?rc; > 1296 ????????????????????????context?=?kmalloc(len,?GFP_NOFS); > -- > 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/ > >