From patchwork Wed Nov 8 19:54:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 118332 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp54995edl; Wed, 8 Nov 2017 11:54:28 -0800 (PST) X-Google-Smtp-Source: ABhQp+Re4kHFcjKTEMvYmliBhAITAVzSNaxV735WtjmbKHwLrTRdujGaVFHC0v+aAdGKysnF49AX X-Received: by 10.84.142.131 with SMTP id 3mr1429224plx.26.1510170868305; Wed, 08 Nov 2017 11:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510170868; cv=none; d=google.com; s=arc-20160816; b=zDlvMTiInmxtQamz/1e0Vyy3dA7R92wUine9BDBwdChm+DTslLqF21IG7sL0R5YhR8 3RiHUJMkLC8UIaCfC1JSUDsZtBB4m7PCGcsOOw+p1WDhRroId/Ldul0W6TJML/+3neCg rKf13CU4Bh/01a/xiFXO9lf+2aV4QaXDc59pxgtA8jx1j1q4dMWFQtmeiIOe6VOT6qLI u07RVonCWujiXMjqgv3cJJ/Hmm06hCkpgTeeRFm2aAqFgRiebGgM3hKhWCWJocQv5nNl LH/N3vWp7MU90fSNONdoGc7ExESxXyfbFliTxn12lWBzougD03ZD2D0A/XO5UqB43don AyuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LVAq5AWaYJHDixhW1FXa5cCKQAyAXegpMPLi7i2CN/U=; b=h4fJdO8DPVBYkIlnRToVTCEDNfjiT2NKMaHgM+2yEp0BaAsjLXElpgL6Je+qoPceIu pFByzFI8Hk+/PrcvAfIhlvI7qJR5lCRPmjPk83I9bdwaVBeXo65a1vjl0kj5AdYWkhTM jvFY+jrLSWqB5RaRQ2thLlaHU2Px926jz/abfl780CyroqA0qtrYDjRzhaosuVb46pcQ 3lUBacnBo5C5eahqBTQdF3LS3nT6G7tI6HyqSbplemLgBqSLvQfYZXKhT0knuj//c8tz 0V4n1crbykgIsq7MNx0ORYfSCZE5G5cuPjskhEMAxBrgUzrZ6p84kwiIB9Ww4PfSjhMT jYpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jT7QQHUM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si4413061plo.19.2017.11.08.11.54.28; Wed, 08 Nov 2017 11:54:28 -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=@linaro.org header.s=google header.b=jT7QQHUM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752559AbdKHTy0 (ORCPT + 9 others); Wed, 8 Nov 2017 14:54:26 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:52795 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751749AbdKHTyX (ORCPT ); Wed, 8 Nov 2017 14:54:23 -0500 Received: by mail-pf0-f193.google.com with SMTP id e64so2487028pfk.9 for ; Wed, 08 Nov 2017 11:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LVAq5AWaYJHDixhW1FXa5cCKQAyAXegpMPLi7i2CN/U=; b=jT7QQHUMw1ajNTilr8V+zQ7jxRrrTnoNmQRQwgCRCi9Pn5i+ue0bBgJMeeO1QDyuQQ a6ukIVk6EwAsvlON18iST/oF5Q6d+OHvDOs42VHuvPmmys9CbHoKk388KrzjRNYpIbOz kL/8w/J1mL2eRafmLTDiXuV7auJRYL8/qwad8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LVAq5AWaYJHDixhW1FXa5cCKQAyAXegpMPLi7i2CN/U=; b=Hu6o0DvL569iqzIiA0yVC65Li793VqVcJrrEUSlN1/pVecrFLo3mKeQ27JuRfackkF 7dJ7POki4VZB3eSCGFazV/nFXCX2b+gLxn3mGboJ6waCRjI04NXo41lZL+gPaqIbT9ih 2fUoM7N6AJRW4WW2G3r+8Tb9kHlYnQUMBC91F9rB72XWjBXRPuCNc8iHJAMqKlu3z45M xN0xqEsOBmoPSnQqYQIRdmkaUn6pRkP94+fJh21a9CdP5FhDF327UsGF7izGBbr6QBpL r57xSL1ROUItmoxkNvnOAT9C7WaYYPb+TVKRkK5sTzy+SEyFL4OQG5sn2ocr/TeKsJrO AVgg== X-Gm-Message-State: AJaThX4zcXp1sB9LbuTg4Rpkc7MpRkvUeXfOWIkeH0a7X5rAINHzsdkl 43fay+FZBbPhozY4pQJrz24DGQ== X-Received: by 10.99.113.5 with SMTP id m5mr1517831pgc.9.1510170863243; Wed, 08 Nov 2017 11:54:23 -0800 (PST) Received: from localhost.localdomain ([106.51.18.232]) by smtp.gmail.com with ESMTPSA id p83sm10021226pfd.61.2017.11.08.11.54.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 11:54:22 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Stable , Fengguang Wu , Shuah Khan , "Luis R . Rodriguez" , Brian Norris , Sumit Semwal , Shuah Khan Subject: [PATCH for-4.4.y 1/4] test: firmware_class: report errors properly on failure Date: Thu, 9 Nov 2017 01:24:09 +0530 Message-Id: <1510170852-32052-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> References: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Brian Norris commit 47e0bbb7fa985a0f1b5794a8653fae4f8f49de77 upstream. request_firmware() failures currently won't get reported at all (the error code is discarded). What's more, we get confusing messages, like: # echo -n notafile > /sys/devices/virtual/misc/test_firmware/trigger_request [ 8280.311856] test_firmware: loading 'notafile' [ 8280.317042] test_firmware: load of 'notafile' failed: -2 [ 8280.322445] test_firmware: loaded: 0 # echo $? 0 Report the failures via write() errors, and don't say we "loaded" anything. Signed-off-by: Brian Norris Acked-by: Kees Cook Signed-off-by: Shuah Khan Signed-off-by: Amit Pundir --- lib/test_firmware.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 86374c1c49a4..841191061816 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -65,14 +65,19 @@ static ssize_t trigger_request_store(struct device *dev, release_firmware(test_firmware); test_firmware = NULL; rc = request_firmware(&test_firmware, name, dev); - if (rc) + if (rc) { pr_info("load of '%s' failed: %d\n", name, rc); - pr_info("loaded: %zu\n", test_firmware ? test_firmware->size : 0); + goto out; + } + pr_info("loaded: %zu\n", test_firmware->size); + rc = count; + +out: mutex_unlock(&test_fw_mutex); kfree(name); - return count; + return rc; } static DEVICE_ATTR_WO(trigger_request); From patchwork Wed Nov 8 19:54:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 118333 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp55015edl; Wed, 8 Nov 2017 11:54:30 -0800 (PST) X-Google-Smtp-Source: ABhQp+Th/0I7arHDgXtS709ckySoD+JuYync3utF6iFnIXAncFkPXxAhleKjAcsDB54v2JXdYiHQ X-Received: by 10.99.43.6 with SMTP id r6mr1472212pgr.353.1510170869990; Wed, 08 Nov 2017 11:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510170869; cv=none; d=google.com; s=arc-20160816; b=KxCBMhFGaKS+w8dp+E0EOWqdKEn2i5f4FNEZADPBHXYPXz+rrhe30DgvI48C9s5aOI zg4sLloEhxNk+50Hu+2FBmC354rKLFzvyQ73b+NKKnzoRYFAJPkZxHt3YuopTLr5N8uT G6YPsrX5D5iqxAtqIGFnpkDZ0AVDy+r4nnQ0ic94GJReiqjCouvSbq4CsCzFHoNusPr1 FIr9o+8GfDK2lqUMNTp+wYV5sSvbtBtm6n5oa3/tZotV58EOWOLInI4wFQyJRqebOdEY OE/FstsooNAE+jbwiWOPw7OcFdWYbQehmJVw17GO6TrgjM7PGcObV63XI1vYNrVAWBj3 fmWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=u5yWdHmpt/O/FxwiK85l0WrpO0aTIsb2302qRRd+LLg=; b=njCZLUizNDMCMQ16kHgmr2h6xtN3Ex9UnV3jHOMmGv+Qwf62csb86b65T9c5woiYBW 5hZS8Ux2oUHfDRmMHOs3snS4RHByeQYOXZETuxo7PrmSZB+5YhDKhuAcetkfLiLvdI7z C3bLRCobpZS0qpq8nIok8PGKg3bP8QWQOQx30xaUrpvGj17pCAvaNHuy/3jdEwMlo+Gu 59P6L2lNY2QoPgJwF7A3JX7Pxj/bngmc78hf7IdsxMt5E5VDh78p3TwHCD8czcDjlk8e GbG0Uf9x2GTbnQmPXzxZ1CF15iBZAAVmpRh2ifJfimTDc/AsZHy4ovp9MbNRvLNgY3y9 3Rqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TgXy43Jd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si4413061plo.19.2017.11.08.11.54.29; Wed, 08 Nov 2017 11:54:29 -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=@linaro.org header.s=google header.b=TgXy43Jd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751749AbdKHTy2 (ORCPT + 9 others); Wed, 8 Nov 2017 14:54:28 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46575 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdKHTy1 (ORCPT ); Wed, 8 Nov 2017 14:54:27 -0500 Received: by mail-pf0-f193.google.com with SMTP id p87so2493965pfj.3 for ; Wed, 08 Nov 2017 11:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u5yWdHmpt/O/FxwiK85l0WrpO0aTIsb2302qRRd+LLg=; b=TgXy43JdlY2rxleqV1ep9viN5u0DwE82Gbdqb2m/DJhl6AyuYgCwq6esDmLJz0O2Rr gq44tofh/L7LBSgoPjYCv36uo8nIatVcEqFfq7W0ChbdABHr9w0w7lBfEMoEUXEzP+NN 0VeBePGyb7TZdesr5jSqq1R4ynmlw7CsD4suE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u5yWdHmpt/O/FxwiK85l0WrpO0aTIsb2302qRRd+LLg=; b=VVU1tbDY/1sQDbMeR0PcspharAcx3zQrr+zjC3fQxwq/VIupJ4NuaP1x1mPsiavtF2 t3VeWXjxM0MCCo5/8a8Yl7I9nfIZm0P1IMtuMWY8K9ugTS8EmjWvEHPXIZqkiKatpjyM kRXCdjU7BuPZXu/DTR5VPIvFIPHCu3I72n3CkkD3tXhKNVWDKhJP6EyoTDA5xz4kf+yp sl73AaDLSMsMwZb5hfPrku0EghyYjEZRq/UDoFqvXNPQoBLLoMnZ5CfvhIjd17RsAwPe /iymJlWde1mDNg9NODzbocS/a8w+54TorUuDMspO2Qw6yklwIqUa62mwu8Cqo1XHIidu WjiQ== X-Gm-Message-State: AJaThX64s3aZW2qT7UQd1dHvqi9MC+0IwbbRP87uSzIja1QN4UxnyIlQ WkFoU1ScA3pw2525lObLHl8fwM3GDD0= X-Received: by 10.101.72.196 with SMTP id o4mr1480257pgs.147.1510170867095; Wed, 08 Nov 2017 11:54:27 -0800 (PST) Received: from localhost.localdomain ([106.51.18.232]) by smtp.gmail.com with ESMTPSA id p83sm10021226pfd.61.2017.11.08.11.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 11:54:25 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Stable , Fengguang Wu , Shuah Khan , "Luis R . Rodriguez" , Brian Norris , Sumit Semwal , Shuah Khan Subject: [PATCH for-4.4.y 2/4] selftests: firmware: add empty string and async tests Date: Thu, 9 Nov 2017 01:24:10 +0530 Message-Id: <1510170852-32052-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> References: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Brian Norris commit 1b1fe542b6f010cf6bc7e1c92805e1c0e133e007 upstream. Now that we've added a 'trigger_async_request' knob to test the request_firmware_nowait() API, let's use it. Also add tests for the empty ("") string, since there have been a couple errors in that handling already. Since we now have real ways that the sysfs write might fail, let's add the appropriate check on the 'echo' lines too. Signed-off-by: Brian Norris Acked-by: Kees Cook Signed-off-by: Shuah Khan [AmitP: Dropped the async trigger testing parts from original commit] Signed-off-by: Amit Pundir --- tools/testing/selftests/firmware/fw_filesystem.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh index c4366dc74e01..e9f563fd200a 100755 --- a/tools/testing/selftests/firmware/fw_filesystem.sh +++ b/tools/testing/selftests/firmware/fw_filesystem.sh @@ -48,8 +48,16 @@ echo "ABCD0123" >"$FW" NAME=$(basename "$FW") +if printf '\000' >"$DIR"/trigger_request; then + echo "$0: empty filename should not succeed" >&2 + exit 1 +fi + # Request a firmware that doesn't exist, it should fail. -echo -n "nope-$NAME" >"$DIR"/trigger_request +if echo -n "nope-$NAME" >"$DIR"/trigger_request; then + echo "$0: firmware shouldn't have loaded" >&2 + exit 1 +fi if diff -q "$FW" /dev/test_firmware >/dev/null ; then echo "$0: firmware was not expected to match" >&2 exit 1 From patchwork Wed Nov 8 19:54:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 118334 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp55077edl; Wed, 8 Nov 2017 11:54:34 -0800 (PST) X-Google-Smtp-Source: ABhQp+RApOuihn0rDl9aEMNovAtOqzz5uf7ECoBa8q6VFqPW1c7L2fGbTHcRzNHgnSxOXdKs5CZ7 X-Received: by 10.98.3.7 with SMTP id 7mr1608910pfd.160.1510170873879; Wed, 08 Nov 2017 11:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510170873; cv=none; d=google.com; s=arc-20160816; b=HO9ZJTP1eb/g9Il22S5hq3Q5Y2KBXcO/Inw37Ceu4gOYopoGxn4F+b9Z4PLiZsSKBs El8Pzo114JGmWheeo9GgkK01fMo3ItAAtU0/U0EW1/q5Ved5OBd+V6x0EmWP1iAAiyb7 5uwzqdNGUdh0YwZETT/+m74XQHQ3HovMxCFbCogRDrPl8i2cAaMWs1Ul9ktk0+v9j0zc s3qhhQNlpcX3Form5+NDf2ItRJLr5EdE/UqNVb3j3loXGM8VjDHg5njbKu/coyodxDqA lpKeaBhszlEwjL250T84yFPANcKgLttbLMdS1rhiVlH3QwTG+SV7PgFeJVWfkw2zwq9n LRKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7HR8fZkuhOQjyEN0XiRUOtLQVGkqsFXw2NVkBEcxcaE=; b=dkCC7/v4KlRPOLUqPc21pESZpC/X/hDorXuOy2RQD/3nq2w7IlHMkRPZdCSMhqVdh5 kZU9IQS556HRW2kTkRi39rP1cZdB5Zzv8F+qIxJ93dxKL8jZzJ9w9wdcRk831w0B50Rp Uj6ue3q9Eri/ZVvKlOoSRpC4TfELDJlH7hg27BAGaLGawC77FgR/yx9w0FA/tdNJ9fxu YsEoKcYplBlL0DXw/qLSPQLDBRW3ATSjRaLxNYJahlJCOqFJejW4AYN+Cn/NIfzT4OV8 RPFY3wUkxPnBfg8Pi1BxzeBNfMCSFoBkTcYPI58OElYmy9yzMIUz99KJUW4n6MLbq+UT 8KpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AtZLdJ8H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si4413061plo.19.2017.11.08.11.54.33; Wed, 08 Nov 2017 11:54:33 -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=@linaro.org header.s=google header.b=AtZLdJ8H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbdKHTyc (ORCPT + 9 others); Wed, 8 Nov 2017 14:54:32 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:56664 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdKHTyb (ORCPT ); Wed, 8 Nov 2017 14:54:31 -0500 Received: by mail-pf0-f196.google.com with SMTP id b85so2473294pfj.13 for ; Wed, 08 Nov 2017 11:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7HR8fZkuhOQjyEN0XiRUOtLQVGkqsFXw2NVkBEcxcaE=; b=AtZLdJ8H7QayUOAeqxc+186SY7TpgoCLE5Jlz9HuMmdvyEvzJWaV0ZouD5EhVhxiAg Ofj5Rgst9B2qZc5kyoU2PtZAfY6wBQPVtjTvVKLHBcogMBeJ9hFU0N7JnZeg0/9mb1L4 IBUIIbeReT2zMXnc85LfJH9UJJ3QNpFYvzqz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7HR8fZkuhOQjyEN0XiRUOtLQVGkqsFXw2NVkBEcxcaE=; b=APwAKfWJF02zocTWBGAs+pTY7GnK0hW13Rsf9QZgE9pxZjeZ+JO1UWuMqLEwrQsrlT wO2mEWIFOIm8yptRn6UkHjgLlBgL/WiQ8BYTa+zMCdyvd7w099I835/NqWXvbhqR0yC4 6hbYkP5DD8v0E2nkOM5w9JU1mKywU8hK6czUIaxcVsVZydgdIjRViEnVEZZx0hmyUi2H AOWyInpQkIm+NTcFUmGI7OPWDOLvK0/TBnep70O+8oNioKnJ/DA9oj//tUkx43syRMsv YpohdE4IXBUTXlIgSTJexhbcIw7fpgUBQ9gCfggdUUg21zLVq6kTNAwO9CqNttD5U3wL u0yw== X-Gm-Message-State: AJaThX76mhEJ2hW25KMhZdjNnoRzkeBjH8Tq+ujIJwQjWGrrsCWgru54 OQ8FwsCqlJJImkKSeELD7ailkw== X-Received: by 10.98.245.152 with SMTP id b24mr1641426pfm.56.1510170870499; Wed, 08 Nov 2017 11:54:30 -0800 (PST) Received: from localhost.localdomain ([106.51.18.232]) by smtp.gmail.com with ESMTPSA id p83sm10021226pfd.61.2017.11.08.11.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 11:54:29 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Stable , Fengguang Wu , Shuah Khan , "Luis R . Rodriguez" , Brian Norris , Sumit Semwal Subject: [PATCH for-4.4.y 3/4] selftests: firmware: send expected errors to /dev/null Date: Thu, 9 Nov 2017 01:24:11 +0530 Message-Id: <1510170852-32052-4-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> References: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: "Luis R. Rodriguez" commit 880444e214cfd293a2e8cc4bd3505f7ffa6ce33a upstream. Error that we expect should not be spilled to stdout. Without this we get: ./fw_filesystem.sh: line 58: printf: write error: Invalid argument ./fw_filesystem.sh: line 63: printf: write error: No such device ./fw_filesystem.sh: line 69: echo: write error: No such file or directory ./fw_filesystem.sh: filesystem loading works ./fw_filesystem.sh: async filesystem loading works With it: ./fw_filesystem.sh: filesystem loading works ./fw_filesystem.sh: async filesystem loading works Signed-off-by: Luis R. Rodriguez Signed-off-by: Greg Kroah-Hartman [AmitP: Dropped the async trigger testing parts from original commit] Signed-off-by: Amit Pundir --- tools/testing/selftests/firmware/fw_filesystem.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh index e9f563fd200a..856a1f327b3f 100755 --- a/tools/testing/selftests/firmware/fw_filesystem.sh +++ b/tools/testing/selftests/firmware/fw_filesystem.sh @@ -48,13 +48,13 @@ echo "ABCD0123" >"$FW" NAME=$(basename "$FW") -if printf '\000' >"$DIR"/trigger_request; then +if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then echo "$0: empty filename should not succeed" >&2 exit 1 fi # Request a firmware that doesn't exist, it should fail. -if echo -n "nope-$NAME" >"$DIR"/trigger_request; then +if echo -n "nope-$NAME" >"$DIR"/trigger_request 2> /dev/null; then echo "$0: firmware shouldn't have loaded" >&2 exit 1 fi From patchwork Wed Nov 8 19:54:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 118335 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp55141edl; Wed, 8 Nov 2017 11:54:38 -0800 (PST) X-Google-Smtp-Source: ABhQp+SwKW/SAxP8GO9H8pqVdSvCit01LvIBOZmjEjoQ0pXDINVmIZ4ODK8QHPrXeuPkDF67Mc4Y X-Received: by 10.99.130.74 with SMTP id w71mr1507131pgd.25.1510170878783; Wed, 08 Nov 2017 11:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510170878; cv=none; d=google.com; s=arc-20160816; b=VRRWIP5tu9yyw/bczQiacymFWSzgj0wCVMT39w5F3vA3tHPPK5awgVWi4b8/PWBWj8 /5lLmLx6gd0xlz9+hjWLNls2y6k33P/4JlKrFAylq0COW+4KYmMdeAsiBQzJcLkoVO0q Z8p6a6eXd83g6IlS2H5X36NlemzkROvswwDzHCDjur0w8je36S/zK1OephG5orIJhrmx UxsqjlRRkSGOWGJVfrCsbMRhz25LCGnnsCuoeZVl+CiT0TuVSjbLTcyQ4R9RWJxv1P2I ex223xKuZ8ESu2R5lB9Lzg+yN2YxV1dIDJVTWWXmYbdP7yhw6WSGWQyZWl0Q7XunOoe8 M2ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=pzsdlHdpN5vTv50f8nw5RsnlOLB4qHzGoAgFe9mnzvE7z5Klz3YGV6u81uOg395H5/ dY10jWT/KhY85+2/9IT+h0QCQhud/Iy0gVBLHfbB5EgP3Lwa2xscG7oqbIG7Ay7iZHMN yJeHX+hYgrAvpy0Y57DumQnES5f/pLEIb9BDHs3MD/u04ZQG/BUg0PrNzQmXUfyswhhV sDfvYzo2oSh/fFpeIWq5YkPdq0CMVRZsRin4vfBKspxMnrSNvHWMm0Ql2BRo9hcLq9Eb ckB5238il/22xBRYGzoTWr+D4GPElkCOD3YsJd0rbWRHlOOPZn1Kb2F5sA80lPVg6b5X 5gKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NDAOK6Xv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si4413061plo.19.2017.11.08.11.54.38; Wed, 08 Nov 2017 11:54:38 -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=@linaro.org header.s=google header.b=NDAOK6Xv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdKHTyh (ORCPT + 9 others); Wed, 8 Nov 2017 14:54:37 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43698 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdKHTye (ORCPT ); Wed, 8 Nov 2017 14:54:34 -0500 Received: by mail-pg0-f67.google.com with SMTP id s75so2737670pgs.0 for ; Wed, 08 Nov 2017 11:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=NDAOK6XvCkmd5ugfsidvKtkmWLnT/1iLcadBi3V3cht6N7ssCx4qTfdmVx719zm9x/ qEG/ce+5773QECajCRJQSNUGEE9jkIbYm9XK8Tm9rk54x5tlM7v+0/n5anY6qcZ+HbOe DNnhH9wp0tAkmqgf77RTsK0E1nug9+TQ5y/1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=qJmpPAOOzLYKAulG3Rhe2glwpGMyp8qcO5+uC0Bim8OilO73VTvpbSn9FHNSUIghR+ adGddwVi/jLMZ51wUtr90QV4MaZbSFUkiQC9CINbaL67CArIlVx2m5DzCHoTKkJsIABv 7x8FI/e9X3i/43j9c+bm6nvZ5hV53IcNNNKtwKy7uQEq+dUo7/jpIqiW+lwky6axz2um ZUigTX0sghghTOX60bDRuLs+F37qqHJVYGaRwfExmNI8e4AjLo8Cz+XxWDwd/ohJ7zjh laoMwpfeJe7ihAYZ1U8oPh99pXxDbwlDXjv4+1dc9giXTy7RwM9TUddg73JAq5h7eAJO T8Kg== X-Gm-Message-State: AJaThX7WxJHVdFM2d2JJQEzOjeEkGB2wAZfZ2Dt37shvK7P8kKT3hlbU 7s6MoEcWuujSlBE60TO1SFn5WA== X-Received: by 10.101.71.132 with SMTP id e4mr1479881pgs.206.1510170874115; Wed, 08 Nov 2017 11:54:34 -0800 (PST) Received: from localhost.localdomain ([106.51.18.232]) by smtp.gmail.com with ESMTPSA id p83sm10021226pfd.61.2017.11.08.11.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 11:54:32 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Stable , Fengguang Wu , Shuah Khan , "Luis R . Rodriguez" , Brian Norris , Sumit Semwal Subject: [PATCH for-4.4.y 4/4] tools: firmware: check for distro fallback udev cancel rule Date: Thu, 9 Nov 2017 01:24:12 +0530 Message-Id: <1510170852-32052-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> References: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: "Luis R. Rodriguez" commit afb999cdef69148f366839e74470d8f5375ba5f1 upstream. Some distributions (Debian, OpenSUSE) have a udev rule in place to cancel all fallback mechanism uevents immediately. This would obviously make it hard to test against the fallback mechanism test interface, so we need to check for this. Signed-off-by: Luis R. Rodriguez Signed-off-by: Greg Kroah-Hartman Signed-off-by: Amit Pundir --- tools/testing/selftests/firmware/fw_userhelper.sh | 28 +++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/firmware/fw_userhelper.sh b/tools/testing/selftests/firmware/fw_userhelper.sh index b9983f8e09f6..01c626a1f226 100755 --- a/tools/testing/selftests/firmware/fw_userhelper.sh +++ b/tools/testing/selftests/firmware/fw_userhelper.sh @@ -64,9 +64,33 @@ trap "test_finish" EXIT echo "ABCD0123" >"$FW" NAME=$(basename "$FW") +DEVPATH="$DIR"/"nope-$NAME"/loading + # Test failure when doing nothing (timeout works). -echo 1 >/sys/class/firmware/timeout -echo -n "$NAME" >"$DIR"/trigger_request +echo -n 2 >/sys/class/firmware/timeout +echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null & + +# Give the kernel some time to load the loading file, must be less +# than the timeout above. +sleep 1 +if [ ! -f $DEVPATH ]; then + echo "$0: fallback mechanism immediately cancelled" + echo "" + echo "The file never appeared: $DEVPATH" + echo "" + echo "This might be a distribution udev rule setup by your distribution" + echo "to immediately cancel all fallback requests, this must be" + echo "removed before running these tests. To confirm look for" + echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules" + echo "and see if you have something like this:" + echo "" + echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\"" + echo "" + echo "If you do remove this file or comment out this line before" + echo "proceeding with these tests." + exit 1 +fi + if diff -q "$FW" /dev/test_firmware >/dev/null ; then echo "$0: firmware was not expected to match" >&2 exit 1