Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp875740pxk; Thu, 17 Sep 2020 20:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCrhfJT5OyQ0mUhqgJDQFqy3/swcccXCDvjZjLKfp7RzIkUw9oaH/DW2ryXO1jTMXZCCgV X-Received: by 2002:a50:ab59:: with SMTP id t25mr35090176edc.364.1600398105590; Thu, 17 Sep 2020 20:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398105; cv=none; d=google.com; s=arc-20160816; b=D8Qf9AtGd/mN+krj6rlhbZQlh+lcqVAVUJWTDcSUT8VQOZ7q69jSxgV4w+SdYEj8GH 2m+jyMfCaiYuDLBPoZhotnQbxuiaZhmGf8/AcUgfPtJgHIED8wWKVG8OClkm8WdSSQ+O HKxvccXIvvfO7nrKUq+BF11sgGTrMzkplDOHp8mk4Gw3M1ZcXqaOtGbEM0i5bRMgFljm /p1G2kjoxLc4VcH1ueaqSzvzGn7xP/H3XvAgUtbrjw83Msz3knyEmSWhrAqHLneDmolY C3eBw5znDd2ac0Ao2lCiE0hvU5BJSV71zg5CyvYiwRn5AX0OLPCxZmqp8/QvDZb0Uckk ADQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gI/hafOEZsyV9L3vdwS88JmpvJEUd60LeHmeYHDvYeA=; b=DQUSwGPvyekugGGZKEfy2jnqA9o5nwVYmQtISjn3iUivFGBd6kT/QZKWC6hutUPElj +Z0/Uoa8+52g3cTD9Dwk8ok4FRokuBq+/TsLzQ8d0kyMCbRXUR5ZA02UdeeYdO4DB1H8 ASIIk3dNKh8awHrTBfjTw16RkPl1ZYl+ynyl1R/4Rvl7Exa8IgsjbbRSQccBI8AWvIXb ydb5duYMinDpFIyrLCE6eFrb4sQKqn18D9VLG/+LPOCMsdo11vC+7SYwWSpqSK08mdXt AFhUSLGBaOF4rvlsnJbft9Ldn6DIf2eyB4T2zV+D26XNFyQodyNmf/GS0dBt33alzgS/ D/IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q8wBvW5r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si1162535edw.144.2020.09.17.20.01.22; Thu, 17 Sep 2020 20:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q8wBvW5r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730391AbgIRC6C (ORCPT + 99 others); Thu, 17 Sep 2020 22:58:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727744AbgIRCGV (ORCPT ); Thu, 17 Sep 2020 22:06:21 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B1F8238D6; Fri, 18 Sep 2020 02:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394781; bh=jGhZISFgVL+/FUIGMcXqvuU+A9Nr5jP1pkKvf9EPlPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8wBvW5rzrK2nll1jwR17lkQ+J1P//CnOpQwo182EFNLcAQKMTYzhH4Pne/RjVnmB LSy8aNBHBFad9VnUnxMIBzDAM2v18Eie1g+8m377YvBSO+2zo+SuxGgtq8DfFrUfYf hON4Hm+41mKezodA5b1gzr1eWx0mti0IpdrB3bks= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 254/330] media: venus: vdec: Init registered list unconditionally Date: Thu, 17 Sep 2020 21:59:54 -0400 Message-Id: <20200918020110.2063155-254-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanimir Varbanov [ Upstream commit bc3d870e414b42d72cd386aa20a4fc3612e4feb7 ] Presently the list initialization is done only in dynamic-resolution-change state, which leads to list corruptions and use-after-free. Init list_head unconditionally in vdec_stop_capture called by vb2 stop_streaming without takeing into account current codec state. Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/vdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 59ae7a1e63bc2..05b80a66e80ed 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -987,13 +987,14 @@ static int vdec_stop_capture(struct venus_inst *inst) ret = hfi_session_flush(inst, HFI_FLUSH_OUTPUT); vdec_cancel_dst_buffers(inst); inst->codec_state = VENUS_DEC_STATE_CAPTURE_SETUP; - INIT_LIST_HEAD(&inst->registeredbufs); venus_helper_free_dpb_bufs(inst); break; default: - return 0; + break; } + INIT_LIST_HEAD(&inst->registeredbufs); + return ret; } -- 2.25.1