From patchwork Fri Nov 22 10:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180004 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp38363ilf; Fri, 22 Nov 2019 02:55:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxOn0Q+rUrCu/KPMKZFtkOf/6R4sHLBCbWfCHdM//h9/zqVtXZor9PmUtHYCUOpzCdNxtDq X-Received: by 2002:a50:a691:: with SMTP id e17mr267592edc.151.1574420102000; Fri, 22 Nov 2019 02:55:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420101; cv=none; d=google.com; s=arc-20160816; b=oA0QJrfURiBCLYsRNjKvNpB/gh4gqQDlCckJ1O2eF9b10Ze3g0IK7jVr3HtOFACMep Iz9/QYs6z2ZV4/CDU0+EcSwvM1mtLrrdayXBw6UDfrRup92PREsbwT27+Xqn4DqvwRlf dXdZlSJoxAIEQwPQqpI370oCrnVmg9uUAgnXdDyqlO3vnruHQ1onMnB7ijQ7UIe8pg4x wJtzJzn+UCaOLkgSLKfovzMzfdj1gbX3IPb0s4u8eg2S9X0xVGBFit/cRTcopz04IjW4 /EopJH0DylFEQDlpNw9aM+tvrRFKWa5YsRsS7mdmbEWtCqzyY5znvS31yOVFtwU0jd31 Ky+g== 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=HJ/Ap/Ol1QfVwHAO8Wnda4Cb2aGLIq3ld34sORxjTeQ=; b=RCsAzUoUkVlRn1kcKaTzjdcM5A1LxwcNabPdfn1DUDs5hWSrUm61DUEJwmTIRpQ3Gs APgEFeN0kf0giIG3Ko3oJe63jju3zreTuw2slhB8bc/LyuZjUJWY1z1VNTEwt8/b8NAz 6ggWXe4MmDcbYH8zX+Pe/BuhkqwDcuFmhOHjTepcR93Zfn21s+qTFV5kWsmCQB0IKQsF yOrcUmF0O/r6OK36qaX2HWvQX4ja7P0QW+sFBH/N3JrItWyeZPMTbSiZk4FLajs+rZuL lqd69BdfakUxkRUyDnmGmAtUv2yMc7f1hVQfocESawdBlVdZZBzTf6x1hlvJ0ZCXWFWW F1hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rANbdL93; 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 l15si1189843ejd.187.2019.11.22.02.55.01; Fri, 22 Nov 2019 02:55:01 -0800 (PST) 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=rANbdL93; 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 S1728973AbfKVKzA (ORCPT + 26 others); Fri, 22 Nov 2019 05:55:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:41158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730394AbfKVKy6 (ORCPT ); Fri, 22 Nov 2019 05:54:58 -0500 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 20CE42071C; Fri, 22 Nov 2019 10:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420097; bh=GTMVDaXzuzU2Vu00XLlOwXvvEsFSRCcG11kDpNM1lzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rANbdL93v19VceodQY3smlEwk7Yak1rfD4iJTo7+WYAgWTIc/uMv6r5kDnEThrZbO Ch9tKxgxbL3UOHJ6wjqDniwLQvxc40KOzIyrCuX5daq7UdLNEStWtog6t6ElBYyIkS F5pfKSmtiIegLCI5faTQTfhiFbI6s+afrqezmOz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnaud Pouliquen , Suman Anna , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.14 078/122] remoteproc: Check for NULL firmwares in sysfs interface Date: Fri, 22 Nov 2019 11:28:51 +0100 Message-Id: <20191122100818.237329904@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100722.177052205@linuxfoundation.org> References: <20191122100722.177052205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna [ Upstream commit faeadbb64094757150a8c2a3175ca418dbdd472c ] The remoteproc framework provides a sysfs file 'firmware' for modifying the firmware image name from userspace. Add an additional check to ensure NULL firmwares are errored out right away, rather than getting a delayed error while requesting a firmware during the start of a remoteproc later on. Tested-by: Arnaud Pouliquen Signed-off-by: Suman Anna Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/remoteproc/remoteproc_sysfs.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.20.1 diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index 47be411400e56..3a4c3d7cafca3 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -48,6 +48,11 @@ static ssize_t firmware_store(struct device *dev, } len = strcspn(buf, "\n"); + if (!len) { + dev_err(dev, "can't provide a NULL firmware\n"); + err = -EINVAL; + goto out; + } p = kstrndup(buf, len, GFP_KERNEL); if (!p) {