From patchwork Tue Dec 28 21:09:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 528747 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 57F11C433F5 for ; Tue, 28 Dec 2021 21:09:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236318AbhL1VJU (ORCPT ); Tue, 28 Dec 2021 16:09:20 -0500 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:65341 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232906AbhL1VJU (ORCPT ); Tue, 28 Dec 2021 16:09:20 -0500 Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id 2Jign9Hrmw2Xx2JignvJl9; Tue, 28 Dec 2021 22:09:19 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Tue, 28 Dec 2021 22:09:19 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: jikos@kernel.org, benjamin.tissoires@redhat.com, jose.exposito89@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] HID: magicmouse: Fix an error handling path in magicmouse_probe() Date: Tue, 28 Dec 2021 22:09:17 +0100 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org If the timer introduced by the commit below is started, then it must be deleted in the error handling of the probe. Otherwise it would trigger once the driver is no more. Fixes: 0b91b4e4dae6 ("HID: magicmouse: Report battery level over USB") Signed-off-by: Christophe JAILLET Reported-by: syzbot+a437546ec71b04dfb5ac@syzkaller.appspotmail.com --- drivers/hid/hid-magicmouse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index eba1e8087bfd..b8b08f0a8c54 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -873,6 +873,7 @@ static int magicmouse_probe(struct hid_device *hdev, return 0; err_stop_hw: + del_timer_sync(&msc->battery_timer); hid_hw_stop(hdev); return ret; }