Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6264205imu; Mon, 21 Jan 2019 06:04:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN4VFD5tM9V2aw8szn0C21kMdjzyX2AOyzVXy9JTa/JB5+9TiFWYaELPKauMYmTLA/LedQ21 X-Received: by 2002:a17:902:8484:: with SMTP id c4mr29568273plo.59.1548079475097; Mon, 21 Jan 2019 06:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079475; cv=none; d=google.com; s=arc-20160816; b=wBHIFP0DYIjEXNGeFd5b9Ofr0VDHWnbz5VChI78xHypS64MTpT9Y8nn5svoyaPGqZs P9TvL5ZpSVhax2Zn7BEO8Sbyh6nu8kzV6ihr+yRqsbFTgBv2aumWDGm+UeoZkmttV09W 48ZCKGgK/a2Tes59gTIkxEXOrZxOLQvP3CX/E2ZKU35Tji98SLLqwbtSyNuoXAcUbdRT yq6b5wBTvLP23EtHJwrPXNK3BtsXihcPOD6LSHYLt7h6VVkv197NjqSgzdv/hBYFV4Vw gz8SmpfrQi1fOb0ZmoMTxUZ9BbTnGTGM2tha25RaH8OT11GtvNOAVxZmyNfqY9w92l5N TB4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F69dFepC8sEWk9lAeriUB4CoV+x0UeAkxGejx3gvo/E=; b=ZLQwC1CNbAIbA/RddjT1zViijLnfScG20Nc2GdSSoLhPq3TjeT1l5gxLA3XcpkSzel V7lBPrkiQjKZPCh/72mk+2gwmXR12OR0GGwjLHYw+kak0/GPqIXMNScVLipldJ1SaxA6 59oeQ5Ft+hREQRnt4eYKUzsYoytKoy1Sn9pSaYBXGvD+3AxB+8fhyxPi6XDemmwvAE/n dBgtXLJo2puPQ86wLv3VXIBhoc1PePRfDCcPQk+YK7lEDFLPDgvdzFUXSIXXKYIoOxzK mp6w7Zyk4F2zq/hgaC/qUEHFHPESLoakcGKOOmjSjbhFXAfh08XBbaVr24OP0ioU7U0a iD0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1LRTjD1r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si13096234pgm.81.2019.01.21.06.04.07; Mon, 21 Jan 2019 06:04:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1LRTjD1r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732569AbfAUOBG (ORCPT + 99 others); Mon, 21 Jan 2019 09:01:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:47898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732545AbfAUOA7 (ORCPT ); Mon, 21 Jan 2019 09:00:59 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1122421019; Mon, 21 Jan 2019 14:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079258; bh=sVimhKRKUvf8mL2dqL9j8bIMjFJb5tJK6/99IC75Lus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1LRTjD1rpQo1B58La4zk40c2cQXRMIQ4uMjIb6yark3FhffuC+l0HNabCnMSNcrhM lplMbX71ObccmitG4kxbQJ71EfzAVpOBhWhHo1mgVYB8zsJggYcYApeJvfaXidYlYv Z84kA1KdF8EsNbywotBN7XG0d8Nc8130KL+8Jf8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , syzbot+53d5b2df0d9744411e2e@syzkaller.appspotmail.com, Mauro Carvalho Chehab Subject: [PATCH 4.19 62/99] media: vivid: fix error handling of kthread_run Date: Mon, 21 Jan 2019 14:48:54 +0100 Message-Id: <20190121134916.327226190@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans Verkuil commit 701f49bc028edb19ffccd101997dd84f0d71e279 upstream. kthread_run returns an error pointer, but elsewhere in the code dev->kthread_vid_cap/out is checked against NULL. If kthread_run returns an error, then set the pointer to NULL. I chose this method over changing all kthread_vid_cap/out tests elsewhere since this is more robust. Signed-off-by: Hans Verkuil Reported-by: syzbot+53d5b2df0d9744411e2e@syzkaller.appspotmail.com Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/vivid/vivid-kthread-cap.c | 5 ++++- drivers/media/platform/vivid/vivid-kthread-out.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/drivers/media/platform/vivid/vivid-kthread-cap.c +++ b/drivers/media/platform/vivid/vivid-kthread-cap.c @@ -865,8 +865,11 @@ int vivid_start_generating_vid_cap(struc "%s-vid-cap", dev->v4l2_dev.name); if (IS_ERR(dev->kthread_vid_cap)) { + int err = PTR_ERR(dev->kthread_vid_cap); + + dev->kthread_vid_cap = NULL; v4l2_err(&dev->v4l2_dev, "kernel_thread() failed\n"); - return PTR_ERR(dev->kthread_vid_cap); + return err; } *pstreaming = true; vivid_grab_controls(dev, true); --- a/drivers/media/platform/vivid/vivid-kthread-out.c +++ b/drivers/media/platform/vivid/vivid-kthread-out.c @@ -236,8 +236,11 @@ int vivid_start_generating_vid_out(struc "%s-vid-out", dev->v4l2_dev.name); if (IS_ERR(dev->kthread_vid_out)) { + int err = PTR_ERR(dev->kthread_vid_out); + + dev->kthread_vid_out = NULL; v4l2_err(&dev->v4l2_dev, "kernel_thread() failed\n"); - return PTR_ERR(dev->kthread_vid_out); + return err; } *pstreaming = true; vivid_grab_controls(dev, true);