Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp189820lqf; Fri, 26 Apr 2024 04:03:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXY4/4tJbDRIA8izA4RDO1c8RwG1H6AWqm0ocR0zmm9Kn823vUNmQez+JOo9Ofr60dl6FSmqivMVTaTFQKW9cfKxmiglW7zekVlw531yg== X-Google-Smtp-Source: AGHT+IEQDCiaIZzmnI3IZyNgz11Tg/jRhHAnEOatfruloLtcNuGSvKZPUIU7X/MRZ43T8ix1u2/d X-Received: by 2002:a05:6102:2851:b0:47c:f12:d410 with SMTP id az17-20020a056102285100b0047c0f12d410mr2227466vsb.1.1714129389527; Fri, 26 Apr 2024 04:03:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714129389; cv=pass; d=google.com; s=arc-20160816; b=d+g6qXRPhTOB1qfEDtHq1EZQ6jFqElwVkaAJi3DLisf5qiIvMuWVPSz7vjXBw03oyD 7moPzJIEULWxRb9kj9JQ1+WGSTPtBHDbr0eihTGpQep7wqoszaFkKENxCN/w4l+pNAMb T1ErTI5IGtQmkCvPDsDGTCw+Z4sB5KEMI27JzEreQIF0m0tSliqzk2OEvVcG2rqctS/a hyrlxmiyyrhKpcHs2VxY0K6FCaA1FI/y0Q6YWf4pwvxRzpYcMcJs82t6NIitlPnnkDXR Bjr5eNOIQpa061tXlExfy2kGuP2DKeqWyGkBMPbIjTHqK2bW7gn/rIsdgSGkqwwcD5rM cIHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=VKVBU9P480IpGHsY102p8AqI1tnAyOnHbDwgnflKPOM=; fh=ojmz70qjpJGyox9KmZaRuVKX7PIEUYZuBxa1rmnOIxU=; b=ACfD01cuG9aZHFCp68gzHROcChVf8yXWMPDSy04dB8ws54yOcBozkBYUO7S/3YNy30 aoIt6ZUnw7zyEP0ACLWIcjhFMwIxg3XWDDyANN/COoNIyhObJ3iXvWwjC+mXpUuRFshx 8/Euh5Q1JyseIzMWnx6zDFi0q9CZSupq2+CZ2n9248ss6LkPvTemOGc7esopa+sVrZtr ftaeSI9WEse6+Hgv8/sE3v2yVm9tf35Cq7GypphaER7bIBjvCJ2xZpsAGxxzaBGOO9ho o7qKs6YbvM5vvz4N1cvzLrAXhq1ZNYmrtSxkIyhqDvMapIuscFR+Gcvdf7ZwCovyx7mP e2jA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-159920-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159920-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ih2-20020a0561022d0200b0047bf4e7b805si2175032vsb.626.2024.04.26.04.03.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 04:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159920-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-159920-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159920-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 147771C21C58 for ; Fri, 26 Apr 2024 11:03:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D48BA144D12; Fri, 26 Apr 2024 11:03:03 +0000 (UTC) Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A91C0139D10 for ; Fri, 26 Apr 2024 11:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.24 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714129383; cv=none; b=mRoIiZ/L4lESaXeJqQvFvTvyL652+uhc8i9zPB0MJV8CvTMu+YnnN1/mMXfT/yEmSNHiciLFEImTim+YY+pjxTvfF6Oi8fTZxgpwMmKbCzwtCuzfXK1YnQadNxNQBnpKiV1w5kVdfLOSLYYuCkUKrXlLtUoXHjRhZaS9b6BO9c8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714129383; c=relaxed/simple; bh=SKY8NIXn9wTOCTm1F8TUSlwijVfID6it5MLVkFT2Ars=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=akfg4v6czekvXZwciWV5KipUNJgo1s6nFpGvEa/bXn+7K2OspkqYVLeQpimz7eMwh4hgCrxJcZI6dSEBZLn/sQLYhfMF0AUPpvTMJr2sZLZoiZzhThKztljncGpu18Dx4OuvPz4BE11hptCaZCVIWcf7AkMO9fNNqCb3ZGgwqjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([116.24.11.235]) by sina.com (10.75.12.45) with ESMTP id 662B89B400003792; Fri, 26 Apr 2024 19:02:14 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 78058831457764 X-SMAIL-UIID: 432CAA4E330142D89BBD018D7A4A5C10-20240426-190214-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [input?] [ext4?] possible deadlock in uinput_request_submit Date: Fri, 26 Apr 2024 19:02:15 +0800 Message-Id: <20240426110215.3361-1-hdanton@sina.com> In-Reply-To: <000000000000cb5a8d0616f8872d@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, 25 Apr 2024 21:42:26 -0700 > syzbot found the following issue on: > > HEAD commit: 7b4f2bc91c15 Add linux-next specific files for 20240418 > git tree: linux-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14b59430980000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 7b4f2bc91c15 --- x/drivers/input/misc/uinput.c +++ y/drivers/input/misc/uinput.c @@ -311,8 +311,11 @@ static int uinput_create_device(struct u struct input_dev *dev = udev->dev; int error, nslot; + lockdep_assert_held(&udev->mutex); + if (udev->state != UIST_SETUP_COMPLETE) { printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); + mutex_unlock(&udev->mutex); return -EINVAL; } @@ -362,9 +365,12 @@ static int uinput_create_device(struct u input_set_drvdata(udev->dev, udev); + mutex_unlock(&udev->mutex); error = input_register_device(udev->dev); - if (error) + if (error) { + mutex_lock(&udev->mutex); goto fail2; + } udev->state = UIST_CREATED; @@ -372,6 +378,7 @@ static int uinput_create_device(struct u fail2: input_ff_destroy(dev); fail1: uinput_destroy_device(udev); + mutex_unlock(&udev->mutex); return error; } @@ -901,8 +908,7 @@ static long uinput_ioctl_handler(struct goto out; case UI_DEV_CREATE: - retval = uinput_create_device(udev); - goto out; + return uinput_create_device(udev); case UI_DEV_DESTROY: uinput_destroy_device(udev); --