From patchwork Thu Apr 27 13:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 677954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41F80C7EE23 for ; Thu, 27 Apr 2023 13:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243520AbjD0NeA (ORCPT ); Thu, 27 Apr 2023 09:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243615AbjD0Nd5 (ORCPT ); Thu, 27 Apr 2023 09:33:57 -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 52F731B8; Thu, 27 Apr 2023 06:33:56 -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 0099A1FE31; 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=66U18+mtQGCyxXC0M1Viz0RN7ENmrIwJoeJCXyBN1ds=; b=NmejHtbin+lt361qaGQBDureWP0SETBpWpDhTqTc9Y3QRGtPbcvm1Jio13dAjE+KK0DAUQ 0KjV/tLxF5PFRj0jORn7gPVcZALgcLmGAa3SiZ9G6aTu0oxh97D7muMS8eFdDGGoGhFCHw ZE4eKXOKjF9E5RBgjD/xj5p8qbt/uT0= 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 ABCC2138F9; Thu, 27 Apr 2023 13:33:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8EkMKMJ5SmSVeQAAMHmgww (envelope-from ); Thu, 27 Apr 2023 13:33:54 +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 4/8] pcwd_usb: do not leave a freed URB active Date: Thu, 27 Apr 2023 15:33:46 +0200 Message-Id: <20230427133350.31064-5-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 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Fix disconnect so that the URB is killed. Not doing so leaves this to error handling in the case of physical disconnect. This fixes the case of a soft disconnect and prevents multiple accesses to freed memory. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Oliver Neukum --- drivers/watchdog/pcwd_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index ed3be8926a15..fe58ec84ce8c 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -815,6 +815,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) /* We should now stop communicating with the USB PCWD device */ usb_pcwd->exists = 0; + usb_kill_urb(usb_pcwd->intr_urb); /* Deregister */ misc_deregister(&usb_pcwd_miscdev);