From patchwork Thu Apr 27 13:33:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 88266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp273277vqo; Thu, 27 Apr 2023 06:36:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hpdpAPuTvO4dRdtwnRfoNwTWOO4c1LKQDhLS9ByNCJsy36UnEv7uaO6wuQCTi4jkz1g8y X-Received: by 2002:a17:902:e809:b0:1a6:46d7:77f0 with SMTP id u9-20020a170902e80900b001a646d777f0mr7389913plg.0.1682602579491; Thu, 27 Apr 2023 06:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682602579; cv=none; d=google.com; s=arc-20160816; b=EmFDjMzTLQ/eEgfyjJyaafnXIfaLtxz2sMVr/0agLiSzytukq+B0xuGy7b4cy1whqn hrHMjUSb4bnLf7P39ELRBXH5a8kqYmlcZQwCYpbe0rYFsK9XRsLCJh1HxAHezpjTeEG2 GjupjEO0N+3iwAfeX4BcMUydkwZO6eeqi+DpLLdzXTasErFfK9lMpao9A1TNbTFkjZsO oMu6KX1xntFg2qZkj8Sq+JFLEvqhh9KL9mkt4SMFo0gVwVOE3bqU9CcjEGhGTZEYWVHl CsKBoBVUpqxcHvg+WaoYp3p7rGG1FyuD4nkSv/S6u6zGocX8BFGq1gawrhCZ3Ya9xaqu jQtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fzOUYOYTdUfKOUVVhjGpyqN36+sVZOkD6XplvoiqEIk=; b=g0DKo1J3kMMFdkYoQWqdqcxR+PmXUlFSTf1IMjYRAsNA0CYd3JakPURJ8H97lgNdxf L2iLT9qM59DEYclPOQLQaXRkUXqrsgwmFtJ34W4zuylCqPgQpyHjMUVBHwLWnYTIklHj CMO1GScSMib3f/d8i2G5pq8d3H7F7l/I3WP0uB9SQcjAJNYBSc6fB2LvgUj8cxgcMG7a fZGsYq8rrzJ4p6N5q30faGlXD/5vYztI390T0Rr9l41ct6w+gWglReY6UDAtWtSUAmCG W3oNWd77FRAhnIk1D4thAovcBfLZcH+uHp9ZwRXdNqieczx7NGOr9hOXUQRFiY6eqP1+ qpnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=RfcGL9hV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a170902b7ca00b00194a5108613si18078249plz.177.2023.04.27.06.36.06; Thu, 27 Apr 2023 06:36:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=RfcGL9hV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243839AbjD0NeT (ORCPT + 99 others); Thu, 27 Apr 2023 09:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243650AbjD0Nd6 (ORCPT ); Thu, 27 Apr 2023 09:33:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40690E72; Thu, 27 Apr 2023 06:33:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EB06B1FE34; Thu, 27 Apr 2023 13:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1682602435; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fzOUYOYTdUfKOUVVhjGpyqN36+sVZOkD6XplvoiqEIk=; b=RfcGL9hVqZn+FTge+Biq/qbpy49KMMeI7c6VcIRV5dE3Umqat1BtbwtRO6kBvqqmV/hatr dI/0p3dI1afm9M3FrG7poUIG3dy2Qi/SGPZgXK1y9ji7lHqlK6pejDLPhlCm0f4Jwjc0tB DPFAZ22No0hP+TJI9BeXffmuwffYFKA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A92E7138F9; Thu, 27 Apr 2023 13:33:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mGxhJsN5SmSVeQAAMHmgww (envelope-from ); Thu, 27 Apr 2023 13:33:55 +0000 From: Oliver Neukum To: wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH 7/8] usb_pcwd: WDIOC_SETTIMEOUT: prevent preemption Date: Thu, 27 Apr 2023 15:33:49 +0200 Message-Id: <20230427133350.31064-8-oneukum@suse.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427133350.31064-1-oneukum@suse.com> References: <20230427133350.31064-1-oneukum@suse.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764336682476032652?= X-GMAIL-MSGID: =?utf-8?q?1764336682476032652?= Delays between altering the watchdog and giving the keepalive need to be controlled. Do not allow preemption. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Oliver Neukum --- drivers/watchdog/pcwd_usb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 50ba88019ed6..09cae7a6ad07 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -459,10 +459,14 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, if (get_user(new_heartbeat, p)) return -EFAULT; - if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat)) + preempt_disable(); /* we are on a clock now */ + if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat)) { + preempt_enable(); return -EINVAL; + } usb_pcwd_keepalive(usb_pcwd_device); + preempt_enable(); } fallthrough;