Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3287279ybb; Tue, 31 Mar 2020 02:08:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuKe3UzWmJn3cFKamqFGz0RVdd5rOYWbQ/vsQk2X+ykIMQvgQMqmKwwzdtCC0KNQr+k9HC2 X-Received: by 2002:a05:6830:22e8:: with SMTP id t8mr2624397otc.48.1585645716833; Tue, 31 Mar 2020 02:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645716; cv=none; d=google.com; s=arc-20160816; b=mlHVqgZjvJjfOuNLcYw9lgrHtfgVMw6bveka9l6mtYyLXgL6giUhegC54IZ8CbeeFf 44OOCGRllRqgqNcMyH8kM+Z5RBrNEBDV5qgc0ux9poHT9Yy6LyQd4xmINauO9q4PvbJ9 k9K9SEgJcljGypF+/XJE0pU/rLlzjiejYLmSVMgsrx36krbE9sv0/se1RwEiKgdvwKrh jNN0W/EhFuncHKuiSox9HEbpHkZWX8kJOpkIW1S2IACLqPQwUhcPLQKhUaivCSdy3icf 9CHE/AMBYbQiU4wYFF2cwfhsiwq8gDxeZXNe545ONRI2h7tWLRklA8ziyGwj+TbhoqRO AGLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G1uUgZsDnZX811WI+vxyEcqB7rNEzEOLveMmBNC2ACQ=; b=pBV0TxLpphMeg0Dbt+sqXdj/UnagYR70aJxoQ8MDbvGkX2TihyyBXHLfgepeA4vsJW 03MYkbYKlMdHGpEEMDoV1DVjCT+dBoOpm25LY7LHSM750a5FmHvMXAy1noKs7ekB7W4b w4OlH017+CITrZQ+Q4gC1AYYw/ID0U1cnZdTrRGTqau/lPL+q9i0pXICazOxpcPu+u1p eyCXWjdPlBRvk8wGyLRbO5XFy4yFqS3TWfx+vESoEi64gV7MG2k2lTPxPwoaz9dNh4Qm 9KnodKAq8Fq0R6oxG5T8Z02qLPhUc+1Vk7d2GOCv0MpZc6OFOYHRCRJilS6uK3J2PDfo 9pUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mui0GmKB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z29si7516020ood.32.2020.03.31.02.08.24; Tue, 31 Mar 2020 02:08:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mui0GmKB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731312AbgCaJIK (ORCPT + 99 others); Tue, 31 Mar 2020 05:08:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:50306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730922AbgCaJIG (ORCPT ); Tue, 31 Mar 2020 05:08:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AAC85212CC; Tue, 31 Mar 2020 09:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645686; bh=mJQ0BF9iUHKFsG4Vqthf273UpMIufUGa1gqjsyWZtUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mui0GmKB9mEqQD4R0v6ACVAhrtBDLmtK1D4REtWw6TQ0ZFPr8bZwVC2vLNw1P19WV mY9XeKO9MuD/ZI60v/CifQyUoMzdJxeAwpkM8Zq0YCNYoLK5YlbBNlIUxiC7Vjjuky PznrrghSkRe9EKSwcXaWS6ko4mVjC5DTOnxNqABE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Marc Dionne , Linus Torvalds Subject: [PATCH 5.5 132/170] afs: Fix unpinned address list during probing Date: Tue, 31 Mar 2020 10:59:06 +0200 Message-Id: <20200331085437.674920880@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells commit 9efcc4a129363187c9bf15338692f107c5c9b6f0 upstream. When it's probing all of a fileserver's interfaces to find which one is best to use, afs_do_probe_fileserver() takes a lock on the server record and notes the pointer to the address list. It doesn't, however, pin the address list, so as soon as it drops the lock, there's nothing to stop the address list from being freed under us. Fix this by taking a ref on the address list inside the locked section and dropping it at the end of the function. Fixes: 3bf0fb6f33dd ("afs: Probe multiple fileservers simultaneously") Signed-off-by: David Howells Reviewed-by: Marc Dionne Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/afs/fs_probe.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/afs/fs_probe.c +++ b/fs/afs/fs_probe.c @@ -145,6 +145,7 @@ static int afs_do_probe_fileserver(struc read_lock(&server->fs_lock); ac.alist = rcu_dereference_protected(server->addresses, lockdep_is_held(&server->fs_lock)); + afs_get_addrlist(ac.alist); read_unlock(&server->fs_lock); atomic_set(&server->probe_outstanding, ac.alist->nr_addrs); @@ -163,6 +164,7 @@ static int afs_do_probe_fileserver(struc if (!in_progress) afs_fs_probe_done(server); + afs_put_addrlist(ac.alist); return in_progress; }