From: Jan Hudec Subject: Re: [PATCH] Use of getblk differs between locations Date: Tue, 11 Oct 2005 14:35:35 +0200 Message-ID: <20051011123535.GD16249@djinn> References: <20051010204517.GA30867@br.ibm.com> <20051010214605.GA11427@br.ibm.com> <20051010223636.GB11427@br.ibm.com> <20051010163648.3e305b63.akpm@osdl.org> <20051011000734.GC13399@br.ibm.com> <20051011000503.GR7992@ftp.linux.org.uk> <20051011004043.GD13399@br.ibm.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9dgjiU4MmWPVapMU" Cc: Al Viro , Andrew Morton , Anton Altaparmakov , mikulas@artax.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, ext2-devel@lists.sourceforge.net, hirofumi@mail.parknet.co.jp, linux-ntfs-dev@lists.sourceforge.net, aia21@cantab.net, hch@infradead.org, viro@zeniv.linux.org.uk Return-path: Received: from cimice0.lam.cz ([212.71.168.90]:61887 "EHLO cimice.yo.cz") by vger.kernel.org with ESMTP id S932086AbVJKMgH (ORCPT ); Tue, 11 Oct 2005 08:36:07 -0400 To: Glauber de Oliveira Costa Content-Disposition: inline In-Reply-To: <20051011004043.GD13399@br.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org --9dgjiU4MmWPVapMU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 10, 2005 at 21:40:43 -0300, Glauber de Oliveira Costa wrote: > [...] > In the code you commented, I thought that we get the same case testing > from or to conditions, and thus, it would be correct to threat them in > the same way. In that code (below), the first test can safely just return. But the second has to undo the first call before returning. When you test new, the bh is already non-null. So you must release it. > [...] >=20 > On Tue, Oct 11, 2005 at 01:05:03AM +0100, Al Viro wrote: > > On Mon, Oct 10, 2005 at 09:07:34PM -0300, Glauber de Oliveira Costa wro= te: > > > if (!bh) > > > return -EIO; > > > new =3D sb_getblk(sb, to); > > > + if (!new) > > > + return -EIO; > >=20 > > You've just introduced a leak here, obviously. > >=20 > > Please, read the code before "fixing" that stuff; slapping returns at r= andom > > and hoping that it will help is not a good way to deal with that - the = only > > thing you achieve is hiding the problem. > >=20 > > The same goes for the rest of patch - in each case it's not obvious tha= t your > > changes are correct. -- Jan 'Bulb' Hudec --9dgjiU4MmWPVapMU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDS7GXRel1vVwhjGURAoORAJ9jPv/2FNOD1HKnsmKQ7RaC9GqWzACgyKN/ oCAjOpt4ltlnKWKK3zHmLmM= =E4oh -----END PGP SIGNATURE----- --9dgjiU4MmWPVapMU--