Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2490173pxj; Mon, 10 May 2021 04:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ9sfFmYkxZhOS+HO5BOgB3NAi2gVYHxzazxegQ6YiFF+WUyDQpCZ6lhleWMAkDFk32fOc X-Received: by 2002:a17:906:2510:: with SMTP id i16mr25122513ejb.488.1620645697948; Mon, 10 May 2021 04:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645697; cv=none; d=google.com; s=arc-20160816; b=rPHvlFXn6dx5TRlW9cBoJgJb9gtnFcqz6LXgr6m31ww1ByHR1sohifk3dvk7CuM9rc iULHZHxsXURBoVqi8I0t5x0ALQ/Fzpjfqb8v9D6zIN1W1MsV4/IXfGk30IDpZrDN/xkO L/RWpFmI5UCFW5mb9FHyhoF1yRSfred8EkcpbhD+5ym5XquiHp9HPSqUOHjL2I8fYi7j U5VsfeJZYi4PJTUNQjFJlVnxB57QpPVHPZaIr1Pzw3vFbfZHnj6l3F2eeX/CuUEGlG1n Oc28tCgfSpv9wYYmADN5GN1MeNaWZ8uw1JCO0XrGTY8X5L/HJew2/tItMmibu5QrVDOB cNnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jnqwtEPfnxQmD7TtiBC83cExiJnxlHKBC3zqopS5YkI=; b=e5SR6p/dUovtcdcl9EEoLR1ucRtwTiw1eTwOgzSf1E7l1XAo/gDu7FsOYH0NWpf0In eXF8nI5+mU4z1nv9L9225wvTWBXS65aaOD03+EC6KF7ldnpCmlradFAD9fXaF0K0mSnN KxjI9DQwzS7TRFpBaH+HiB+mmeUinDBx6MWfORh3UtLaVn/SfNy80NR9C2T4XiAgd04V 2+it0eYUADkQNE5/+j6ZraZ0BOksirIIAXOivcuAKDnNKXN61IMp1WNvwpUN+Ppqfy8/ n8Ns/MS7U3lOVwQHoZwrbwiatB/mBcVa+cd4WmPiNRfakDMlhJ1NUuiOiKyq6gB0f7qR Hikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p1AstEKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si12868081ejd.49.2021.05.10.04.21.13; Mon, 10 May 2021 04:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p1AstEKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237616AbhEJLPn (ORCPT + 99 others); Mon, 10 May 2021 07:15:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:41824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233736AbhEJKud (ORCPT ); Mon, 10 May 2021 06:50:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26C6E6195F; Mon, 10 May 2021 10:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643219; bh=HYu738Z9hfd84mR0bu7eMoQor2MK106Intwa8Fm57JE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1AstEKKWbpZgmYq5ddRCcz2Fsb5h4zcoX9FtmfNZS1eTGlYnC7TV+hmfFrmqT+I7 uSxcECycmYCl/c4J88zb5KkEZdI0JI32turZILwV3s00FL7j3zPDjaCnMYRJk9MuNS JbcNr6oAn3p3b/kOYUXt3oQ07z4QsloBFnuGsPuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luis Henriques , Stefan Hajnoczi , Vivek Goyal , Miklos Szeredi Subject: [PATCH 5.10 225/299] virtiofs: fix memory leak in virtio_fs_probe() Date: Mon, 10 May 2021 12:20:22 +0200 Message-Id: <20210510102012.378106676@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luis Henriques commit c79c5e0178922a9e092ec8fed026750f39dcaef4 upstream. When accidentally passing twice the same tag to qemu, kmemleak ended up reporting a memory leak in virtiofs. Also, looking at the log I saw the following error (that's when I realised the duplicated tag): virtiofs: probe of virtio5 failed with error -17 Here's the kmemleak log for reference: unreferenced object 0xffff888103d47800 (size 1024): comm "systemd-udevd", pid 118, jiffies 4294893780 (age 18.340s) hex dump (first 32 bytes): 00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N.......... ff ff ff ff ff ff ff ff 80 90 02 a0 ff ff ff ff ................ backtrace: [<000000000ebb87c1>] virtio_fs_probe+0x171/0x7ae [virtiofs] [<00000000f8aca419>] virtio_dev_probe+0x15f/0x210 [<000000004d6baf3c>] really_probe+0xea/0x430 [<00000000a6ceeac8>] device_driver_attach+0xa8/0xb0 [<00000000196f47a7>] __driver_attach+0x98/0x140 [<000000000b20601d>] bus_for_each_dev+0x7b/0xc0 [<00000000399c7b7f>] bus_add_driver+0x11b/0x1f0 [<0000000032b09ba7>] driver_register+0x8f/0xe0 [<00000000cdd55998>] 0xffffffffa002c013 [<000000000ea196a2>] do_one_initcall+0x64/0x2e0 [<0000000008f727ce>] do_init_module+0x5c/0x260 [<000000003cdedab6>] __do_sys_finit_module+0xb5/0x120 [<00000000ad2f48c6>] do_syscall_64+0x33/0x40 [<00000000809526b5>] entry_SYSCALL_64_after_hwframe+0x44/0xae Cc: stable@vger.kernel.org Signed-off-by: Luis Henriques Fixes: a62a8ef9d97d ("virtio-fs: add virtiofs filesystem") Reviewed-by: Stefan Hajnoczi Reviewed-by: Vivek Goyal Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/virtio_fs.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -896,6 +896,7 @@ static int virtio_fs_probe(struct virtio out_vqs: vdev->config->reset(vdev); virtio_fs_cleanup_vqs(vdev, fs); + kfree(fs->vqs); out: vdev->priv = NULL;