Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp657335rdb; Fri, 26 Jan 2024 07:03:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmlUySyBzJZZjI1OIacT4YWECCSGGs+NaUeq96wMFel6dTqjlpAcw6XSUeFmXyMyul8Npc X-Received: by 2002:a05:6102:2927:b0:46b:3782:8dfe with SMTP id cz39-20020a056102292700b0046b37828dfemr120087vsb.43.1706281383382; Fri, 26 Jan 2024 07:03:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706281383; cv=pass; d=google.com; s=arc-20160816; b=RpbWZUs4la+TE2SKNsimMEUxTERAfBf0YPviqqeaklCKHBbq/YBQYmkpxhYEgrQDAH k2hn9YyQtifwNQx/d01xRBt98OiALrXZNKW1kNf191PaqjE2nQ4WfS5Arpfb8Exc2E5S eCklmnRFj+L5bKlx14WXW9np/rPPoPt2IKxguBWfVoIGWH8fmsdUaFEN2tcDkEjSS52H a/qOqZkOC5xiGcASDovNg5LiQ4dDcPnpP0PptBbcmx4YUqzWj8zMRh5/udtsEZpm7MA0 au4gtfJx3EZCo7O6UXV/TAP6XtVRNB9TQTY3371pYIXs7DafH0DQ+b+Sxu5AkpnP8sbI qKfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=JsxP7toU+yaQhyM85mOfisB9eNURYXeJZZvgfcckwgo=; fh=Bz5xjJJJtA8pxtj6QE44s7geN+mSE44V4M+eWTrT47s=; b=F6zOSn9tCVesL0tjWJpms1Huzk6m2nKLt6kD9ej3K9XgeORiPZMI8szNevaoRCHhNC 9ag0Ndhj47JIJzEZp8XnZ6rBQy0xZlgvsMST869mM/rxXIbkwkSMWE4H4p9mHiowHMyW Ek6igsSMNHdgcIXlDNj6Nrc3W/KUpTu2nH9P+0fPN4AGHHdUTxBRsp8YNg6akglBCkyX 6Cuz2Prke9NSAXDO3z7A3YGK4sq1u+N8G5Xqzt1twO+t33N92mhkmIqTdZONWJ979Qyt EuE/kdx+cKmfqk4j5lOkXKTM2CQaQJO6UX8mxFdbpenTt80MZ8YsPgk7rqLwd/W6oDl0 M6Lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dubeyko-com.20230601.gappssmtp.com header.s=20230601 header.b="CRZ/YJgz"; arc=pass (i=1 spf=pass spfdomain=dubeyko.com dkim=pass dkdomain=dubeyko-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-40239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40239-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dh21-20020a056102579500b0046b199062besi177220vsb.541.2024.01.26.07.03.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:03:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@dubeyko-com.20230601.gappssmtp.com header.s=20230601 header.b="CRZ/YJgz"; arc=pass (i=1 spf=pass spfdomain=dubeyko.com dkim=pass dkdomain=dubeyko-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-40239-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40239-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 217671C21127 for ; Fri, 26 Jan 2024 15:03:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 342341CD36; Fri, 26 Jan 2024 15:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dubeyko-com.20230601.gappssmtp.com header.i=@dubeyko-com.20230601.gappssmtp.com header.b="CRZ/YJgz" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 231CD1B970 for ; Fri, 26 Jan 2024 15:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706281372; cv=none; b=KfG+iZ6UnjzfqKARpEBPqgCdFKXDq59zDs0KbM1TK8kNtzK1BvAKehII7ZTcmXAySmod0hU25FVO1aczXwctfkVnv83/R3Lf8mJzbD9uKOzJJQ/XKoX/IwvNkcT5o+47AvvdR8iwr/2dNw4xpAchhy2H20R9dYbZvmL1EykZt70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706281372; c=relaxed/simple; bh=JsxP7toU+yaQhyM85mOfisB9eNURYXeJZZvgfcckwgo=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=u7c0rAT1UKG7CfP5RvunwvphlY1hSZZiXj/bBJsR3i6O/9Nx+I73DV7bTSsKaYFxrVizbM+x/x56PtKVCg5ia6UIvM9exs8d34zvXWFFTrvMAE6gYGTegMxpuNKgsEqKkPGDgvfugW66y59NjHMxZzj3VJxa/5gmwRzksNwpDyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dubeyko.com; spf=pass smtp.mailfrom=dubeyko.com; dkim=pass (2048-bit key) header.d=dubeyko-com.20230601.gappssmtp.com header.i=@dubeyko-com.20230601.gappssmtp.com header.b=CRZ/YJgz; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dubeyko.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dubeyko.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5101ae8ac40so582794e87.3 for ; Fri, 26 Jan 2024 07:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dubeyko-com.20230601.gappssmtp.com; s=20230601; t=1706281367; x=1706886167; darn=vger.kernel.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JsxP7toU+yaQhyM85mOfisB9eNURYXeJZZvgfcckwgo=; b=CRZ/YJgzYD5N5KWq15AxTWpEQ5RWgQVuC+8pw6Lmu17LHhvJuTQo6m6/Bt6cN2G4HH cTn7xc2CAKgpNc5V25fhwxnBz73WsRD1nzDkTO4D/wkBtQ6cuTqrdmDWlmKqSB/PLFtq WBqmC7Ex6wtlApJav4DkWpw9AJHhOzP5vPu9Vx9g+213U9N783A6M677B+3up8GKLcR7 yyGP6teEDyPddKv3HCM/om9pM48/OKFmw94kpWkKmu5cNzEGGRXEZoubixGSNPTS9TtX Xpfolc963eYBi22isSrSQMYTAfVYvfIVmpzTtpw8WqNSmViBDSJ5egiZdhEQzuIoG6uz s/oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706281367; x=1706886167; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JsxP7toU+yaQhyM85mOfisB9eNURYXeJZZvgfcckwgo=; b=s4M+uhxsEehkmUaO2d+jITndasUYT7HlifvaJmxYN2nqfh3ddJkT8AsEjEIeyf1hWn ZzPqRUU9tgbtI2lSl8gNAqs0hURUOm7spCJZWjZuHvnx9efnu48TYD8SVR4Lfj2k7KMw /S9j3mBkrPcfn75Q8RDX9LVI8mLt+AaaMMeJsxLXTzP9XFFgqdA9Wufov75ck0wHR7rn 2I0wYh0BuVY8VgpIXE0wjwYahwc70Ktgv6T3wqK7tMuH2AsWQkWOz6jMuEDHENhVWitx crmNodnOp8uCvcvZvZqKhxEIjozk/FDmZUme2KMCdqIZSIGTxrz3G6fzTXlp6qe8/Zz0 VomA== X-Gm-Message-State: AOJu0YzgeaGmSZBqgphIz5aUFRolHTqVYegypoPCQn7tToWePHPP6xYk 59RK0MVU9DXY2OBnLiggEIloF4Q3LvhX+iYx78nwxAir9727aGescOqCVoKXAfU= X-Received: by 2002:ac2:563a:0:b0:510:1721:4784 with SMTP id b26-20020ac2563a000000b0051017214784mr724538lff.72.1706281366950; Fri, 26 Jan 2024 07:02:46 -0800 (PST) Received: from smtpclient.apple ([84.252.147.253]) by smtp.gmail.com with ESMTPSA id x23-20020a19e017000000b0050e758ee006sm204457lfg.205.2024.01.26.07.02.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2024 07:02:45 -0800 (PST) Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\)) Subject: Re: [PATCH] hfs: fix a memleak in hfs_find_init From: Viacheslav Dubeyko In-Reply-To: <20240122172719.3843098-1-alexious@zju.edu.cn> Date: Fri, 26 Jan 2024 18:02:34 +0300 Cc: Andrew Morton , Desmond Cheong Zhi Xi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20240122172719.3843098-1-alexious@zju.edu.cn> To: Zhipeng Lu X-Mailer: Apple Mail (2.3774.400.31) > On 22 Jan 2024, at 20:27, Zhipeng Lu wrote: >=20 > When the switch statment goes to default and return an error, ptr = should > be freed since it is allocated in hfs_find_init. >=20 Do you have any memory leaks report? Could you share it in the comments? Which use-case reproduces the issue? It will be easier to review the fix If you can share the path of reproduction. Thanks, Slava. > Fixes: b3b2177a2d79 ("hfs: add lock nesting notation to = hfs_find_init") > Signed-off-by: Zhipeng Lu > --- > fs/hfs/bfind.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c > index ef9498a6e88a..7aa3b9aba4d1 100644 > --- a/fs/hfs/bfind.c > +++ b/fs/hfs/bfind.c > @@ -36,6 +36,7 @@ int hfs_find_init(struct hfs_btree *tree, struct = hfs_find_data *fd) > mutex_lock_nested(&tree->tree_lock, ATTR_BTREE_MUTEX); > break; > default: > + kfree(fd->search_key); > return -EINVAL; > } > return 0; > --=20 > 2.34.1 >=20