From patchwork Tue Mar 31 08:58:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 228631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36560C2D0E8 for ; Tue, 31 Mar 2020 09:13:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DFFA20772 for ; Tue, 31 Mar 2020 09:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585646025; bh=0geW2N5yklwjKb6rivq1v7IxgkL4xJnOpRV3pgTthvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZNF6/0UZOgJVfv1/PvyPL5dlz7b0XvamAaRJesEv+4mJR2c8Lg8ECsE7gmiC6Ut5U kXeXcxIpppVD8y99eRuP7tZCRaovTdO2uwBRirCiyvxeiTaCn6djix2oZOm72u68gN Br95P87XgY0p2HjcuBM2LHmjjSKunIIwLdVLevzg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731640AbgCaJNn (ORCPT ); Tue, 31 Mar 2020 05:13:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:33206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731560AbgCaJNn (ORCPT ); Tue, 31 Mar 2020 05:13:43 -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 E39B52072E; Tue, 31 Mar 2020 09:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585646022; bh=0geW2N5yklwjKb6rivq1v7IxgkL4xJnOpRV3pgTthvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vRTIWVvSfC8s1MDVEZK3MWqzaDeozXOrahXJPg+CVmvHixHSA6UurVIIRrr1h0M/9 Rkh9uZLEORVa2w6abIzZBmZInXhRbIlnaGx27z8Of7UlYJQp8VjQD2WoGLEP+oS1v5 jU7t9hbAYbyk6hcDG50DKjTKzrdfQvPvdUJ4qkH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tycho Andersen , Tejun Heo , Sasha Levin Subject: [PATCH 5.4 058/155] cgroup1: dont call release_agent when it is "" Date: Tue, 31 Mar 2020 10:58:18 +0200 Message-Id: <20200331085425.071082026@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085418.274292403@linuxfoundation.org> References: <20200331085418.274292403@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tycho Andersen [ Upstream commit 2e5383d7904e60529136727e49629a82058a5607 ] Older (and maybe current) versions of systemd set release_agent to "" when shutting down, but do not set notify_on_release to 0. Since 64e90a8acb85 ("Introduce STATIC_USERMODEHELPER to mediate call_usermodehelper()"), we filter out such calls when the user mode helper path is "". However, when used in conjunction with an actual (i.e. non "") STATIC_USERMODEHELPER, the path is never "", so the real usermode helper will be called with argv[0] == "". Let's avoid this by not invoking the release_agent when it is "". Signed-off-by: Tycho Andersen Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cgroup-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 2db582706ec5c..f684c82efc2ea 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -784,7 +784,7 @@ void cgroup1_release_agent(struct work_struct *work) pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL); - if (!pathbuf || !agentbuf) + if (!pathbuf || !agentbuf || !strlen(agentbuf)) goto out; spin_lock_irq(&css_set_lock);