From patchwork Fri Nov 22 10:28:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 180011 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp46937ilf; Fri, 22 Nov 2019 03:02:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyzc3zEoDYwxj314YikDSHUnSmF3g4k/01qu4YE3XFtXmZBCgO9cqtnlBiMZ9WEf+uOyu8g X-Received: by 2002:aa7:c9c7:: with SMTP id i7mr296073edt.270.1574420527742; Fri, 22 Nov 2019 03:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420527; cv=none; d=google.com; s=arc-20160816; b=NfCo/ZhEpM0M8IIeB6/L8N/dD2Bp/GRlDZABdqEh11dyw2XsAeASJ2l3MMzed2J5Tq GpSEzlqPmJGIpLaA6IsoHCFO0qoyyyhylDd0zlb7NzqG1IjheEOpURSG6Ifdkh75ke+6 3YjQEaZZMTIv7ibzkHq4LKXoscIGJg/QF3khcJl9fvB+5fD4qYqAEldVgLh5/XiFfpqg 01aO06vlZNkIOPsw128yfBGYYr+wvuiChCT1BBrPvRjvcAI/ldAFli/cZIfDa3w8jJoY dELflAwTTitUVlhlgFHoqw5ReqLh1sG4TlNA5nsMZWLzn/53PfrbA0y0nzPblRVgaC8m 8x3g== 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=HbJZ/eSluNnUPbx3wIog+khWfpOTQxQ5M8Fd5Igz0Znf9bwioSL97usroaxcRZqhQ8 RzOs0TUYRq4xfTtPMUrBv7vGG+3Ev5RmqWTcNOZoI7dAMn+4J3kPze/ovGt6zC2ING8A sIqrWXjJGrlDJXdp9cl0CTJ4GeH9yhQDgXMinU6Huhl1zXg6D+yMEyJHcftfh9XkDmQ/ x6DkSaPKmPyG8WplO/xN35TiNUr8bZUgS22rHp7shiA86c5zDVRHmigt8dE+QrZ3/yVa tEH08tvWenc7hZNtdia+QcCtDcWwgk0JCHDpup72J1z+a6hqX/tOdtTPKiVaz1HnQSSA Pjqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GcsgfTUg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 ce3si4978402edb.441.2019.11.22.03.02.07; Fri, 22 Nov 2019 03:02:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=GcsgfTUg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731254AbfKVLCE (ORCPT + 15 others); Fri, 22 Nov 2019 06:02:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:55380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731241AbfKVLCD (ORCPT ); Fri, 22 Nov 2019 06:02:03 -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 245032075B; Fri, 22 Nov 2019 11:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420522; bh=GTMVDaXzuzU2Vu00XLlOwXvvEsFSRCcG11kDpNM1lzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GcsgfTUgtCiBfmAOtsrhR8N5XHfap5gBMTiFgf+kpWLXIwqpDSqrAIeBqPDazeLKU 5Wuq1DMWgBHjMZfAdH4d6ZtKE3RnOug/pbbGCGTOpNAqvLqPnG6X75cvkKkBnH0aGL 1wxWFCWWBbZhrT00CfoB/Kql+Pv8KGAxJelt86PY= 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.19 136/220] remoteproc: Check for NULL firmwares in sysfs interface Date: Fri, 22 Nov 2019 11:28:21 +0100 Message-Id: <20191122100922.594417540@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@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: 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) {