From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC3A6363095 for ; Mon, 22 Jun 2026 09:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782119384; cv=none; b=MHpnLXN4X6eATUAu0wf1wN+kNIwa87hr/jkCKByUtkDW+jxir2AccPIPC64Of6X/fDtAY7ZWOJ7Zat0yAQdaZc9uOn8TYGCmCWb3tu69x/SuhoyywEtbyPoIWKsTtf1ArtR4Hu3nQFk+OBger6+jA6qhare6yy3aX05aYqEsPdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782119384; c=relaxed/simple; bh=Ku+iUkufAwmtJpETezJUe09aZfxio81saVT3fFwz4ME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WbViQva01mAHNm9KBygKgfGhkw2P7QSyp9HdcoJYQmiCT3m9KTOMeebre34cBstmlwT+IMYsMvu27oL3fufkbOywfdv/ukoxDNpHcMklUnwwMekZEt2HuQVuZSMGQ5rE30atnmqGFjvD9z90MVsvuSbTPenE6PqxxDBTcZFh498= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=T6BnOSPV; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T6BnOSPV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782119381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GFX3o+6uVpWAIF9G35ytiuiiBM53y5xUy8RADSTHhfg=; b=T6BnOSPVK8XkPYo43oU6C0XmVBz+75GGpcpgdNwp2Y+UW2tvdinhkW/kPnqj+fyfjgeUQe G6OJaP+WLCfMMEO0C27ogXUN3hMoSTXMml/XKT2tTg5+tCPW7ND8lsircdZXlX1KRZqE7v z0s61Uq67o4cHpoqIGmGrl+Lp1yIRJ0= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-h0S8YdqIOA2lmLEB9oWR1A-1; Mon, 22 Jun 2026 05:09:37 -0400 X-MC-Unique: h0S8YdqIOA2lmLEB9oWR1A-1 X-Mimecast-MFC-AGG-ID: h0S8YdqIOA2lmLEB9oWR1A_1782119376 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3BF841800361; Mon, 22 Jun 2026 09:09:35 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.44.48.242]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC2291956096; Mon, 22 Jun 2026 09:09:32 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Marc Dionne , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Zilin Guan Subject: [PATCH v4 07/21] afs: use kvfree() to free memory allocated by kvcalloc() Date: Mon, 22 Jun 2026 10:08:41 +0100 Message-ID: <20260622090856.2746629-8-dhowells@redhat.com> In-Reply-To: <20260622090856.2746629-1-dhowells@redhat.com> References: <20260622090856.2746629-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 From: Zilin Guan op->more_files is allocated with kvcalloc() but released via afs_put_operation(), which uses kfree() internally. This mismach prevents the resource from being released properly and may lead to undefined behavior. Fix this by using kvfree() to free op->more_files to match its allocation method. Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: Zilin Guan Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/fs_operation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c index c0dbbc6d3716..20801b29521d 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -348,7 +348,7 @@ int afs_put_operation(struct afs_operation *op) for (i = 0; i < op->nr_files - 2; i++) if (op->more_files[i].put_vnode) iput(&op->more_files[i].vnode->netfs.inode); - kfree(op->more_files); + kvfree(op->more_files); } if (op->estate) {