Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp812212lqg; Sat, 2 Mar 2024 02:56:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUl7P/kJE0eYuIz8QEJcVakVg3AfyjpYmrEriXIK0wbYfOrYYEhbf1Kw3p34Q1kGXjzyQSjRs0Mq+YLAArm27/Caej7bTO3E92aDl2Fg== X-Google-Smtp-Source: AGHT+IH8jRfldFEr/rDf+y2i3H4zzBQ0i0icoVAh4h3Nuon5Tl+t3CbOV9bZUxV8SL+d+L2/2w3z X-Received: by 2002:a05:622a:2cf:b0:42e:b547:c23a with SMTP id a15-20020a05622a02cf00b0042eb547c23amr5027224qtx.65.1709377003095; Sat, 02 Mar 2024 02:56:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709377003; cv=pass; d=google.com; s=arc-20160816; b=sm0zEkP7ire8m8Ag0u5KIk2m0wDNlr53rEu/GBOdG8GFuHiSWqf7EdpeQEvKQu8xKS cf5mUzfgiJoSFY5tfMVNDoZaO4LggLq42fEJyFb0UIu/GiYBns7W2pHBSsYkveA4bdKy PAnlMG/hHij4iYk+R8pnc58aFA3xZ/RBE7IejDN+UmHs645ZktGLBZr3WMJTgL/ClXHX 2yu0kl3xgAGMudS6znOQwYQcwRHMddR8Apys7cqN0WzXPMpMtK5u9FFwR340E1G5gV66 rNETYe+dQyyZ+EEkRKdlccLPh7tq9LMroyBZErnpuGKXUcWqNeyR5jN2g2WxZ8yb+Arw r0ug== 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=qvoG1ndTTs/npFXY4ha1wKgUwM5nat1WiC+S7jn8b0o=; fh=JO7To4pFc6SFYdmoeBh2kRSDZFOrQ57XCPf3A992MCg=; b=f/HrYo4f8NCP89cebe0R5LEej6qZjhqTIkEeuGwAQ20n0Qu0Qo18f90mi7+IhyGi8J +SmHRXgru/YrknXYrOJ0Oy5ewj+Og22ZPT0D4SbWPsnVR2uqjAXM8UOH1gqHzHDOXqRd empG8gBgP9aHDJozSWPVq7/wi6VufE8mE3tZQyWCea4GLTjrI9mLHJCH4QsdsINRWKjz 1BuGHh3q0qzxmdK83qGgDTzAznGYo3q1OGiqb7LoEoKjMEG5MwWOtUkD9cdi1oDoFANw n+kkP8iJDp4u1SNl3BlNbGptQ1DDcMFnPqVY1ur+n3f+NSJS65h0cf2bM7f9hPw4aHhS BaOw==; 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-89423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89423-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 j6-20020a05622a038600b0042d24a32838si5761499qtx.54.2024.03.02.02.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 02:56:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89423-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-89423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89423-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 8DF741C215AC for ; Sat, 2 Mar 2024 10:56:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0391714293; Sat, 2 Mar 2024 10:56:37 +0000 (UTC) Received: from mail115-76.sinamail.sina.com.cn (mail115-76.sinamail.sina.com.cn [218.30.115.76]) (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 486D2111AA for ; Sat, 2 Mar 2024 10:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709376996; cv=none; b=LEoWmGXGpggYxIhXMIY3z6pKt2vgM/A5vOmi8CBg2AH8Rh+K1gNWnHKSZvnrFVlRSZUmxX5aDGwWRjS0u4QxKJcQS/QqU2Lmbp+WIrY/z0/5TR/dx18oVprzeangHTlguKFiNYzeRECpwSBmgBMpvt5ZOZdqh6Y3WjE7eiH5Dac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709376996; c=relaxed/simple; bh=hZFOvbQPEDGmTgeovQ4UwGsq5+k0H4RphcUCC2vd0eA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pFUKkU6Rzx51JjPKTLlNge3lcPvly5o46geOWQrZbeG4loLS7H79GTQkjxoBRJam/gxXiunaQ4uwPsWzj/4LFIcCwkLEgjqIY4yaYMe33pvwaqgAEn2w35PNghT21GpIZQEf7zlVJiSJUpCwu4GSgS/d9vNyOadAGy4F5EZe878= 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.76 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.109]) by sina.com (10.75.12.45) with ESMTP id 65E305D300008B1C; Sat, 2 Mar 2024 18:56:23 +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: 16710631457660 X-SMAIL-UIID: 1159B31607ED43CBBF2940A7E6D7CCBD-20240302-185623-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: KASAN: use-after-free Read in v4l2_fh_open Date: Sat, 2 Mar 2024 18:56:11 +0800 Message-Id: <20240302105611.1139-1-hdanton@sina.com> In-Reply-To: <00000000000017937c05bb617f1d@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 Mon, 15 Feb 2021 07:18:22 -0800 > syzbot found the following issue on: > > HEAD commit: 291009f6 Merge tag 'pm-5.11-rc8' of git://git.kernel.org/p.. > git tree: upstream > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17179dd4d00000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master --- x/drivers/media/usb/em28xx/em28xx-video.c +++ y/drivers/media/usb/em28xx/em28xx-video.c @@ -2152,6 +2152,10 @@ static int em28xx_v4l2_open(struct file if (mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; + if (!dev->v4l2) { + mutex_unlock(&dev->lock); + return -ENODEV; + } ret = v4l2_fh_open(filp); if (ret) { dev_err(&dev->intf->dev, @@ -2161,6 +2165,7 @@ static int em28xx_v4l2_open(struct file return ret; } + v4l2 = dev->v4l2; if (v4l2->users == 0) { em28xx_set_mode(dev, EM28XX_ANALOG_MODE); --