Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp310200pxj; Thu, 20 May 2021 09:49:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXPhkNX5b3ovoOfopgbUxNahcIKQP+vlPoN0v5dvRiTug7IMaAKhuqxnXC1GDvE9sK4ckX X-Received: by 2002:a17:906:2bd0:: with SMTP id n16mr5783208ejg.110.1621529385263; Thu, 20 May 2021 09:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621529385; cv=none; d=google.com; s=arc-20160816; b=afSjXi9fxdKQc/ofX9/xFQrMrdFVPTfo8vfCF28AxQ0A9RPs3g1hgyjdE1IFYJGMWH beJo80j7em/kkeJiTl+xLgivnT6OPh3X1rwxVQJBWgTrvRy8YvC2gMC+aogTzYbcb1ek 51a1aLBqH3OiSNe4xJbqrc8bAuWzJux9Xo5kqtZ4jriaoC9pQ8f0pYdkU98si06Xm09v rifEMPztxsms7OfEUbqICYkXpGWUmQwfoRiiDsePbkCA6ASmql4zGWCzU4IzVvqWr1LR QBv6E3wVEzSmD214mRQqGke5o83f1w8rmSlIdScsqrH+q/5YkMi+PkWqoGLpINe7Cgu7 agmw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fI7OW+fVQPo4AkExBiFr6W0JKCSvzjyBKUfHAARrwco=; b=NoC3W2gswYB0dGgaeLZAJfrHIHrb/zFr/fTncLl/csgdZQKyvtUGYcLliwPXz+stHx aNxluCLJc0/ZkURpYidO9rmRhxMq/YmJ5ihZ4Da23m9RR1tQzx9Ti3l7JhEVP3uFrudX r+JokEDKackREoj75BedC4ZyvxqemM1feh0hChq+J1HU+lf+HVBtRoLR6kMtTjJ2gQ/W 6Aah24P0G7DOKIYdBW/Id2HESdOvE3rgMqmHvNUGqzE6JgbekkFnmGjeYsYJ8TyJ0LTn 7kmaxxeYXTuhfBYB6LOVFojB7qUlEuaDTz7Rp0S85LtaLm2Z0zKj/i6Inv6qHBms8KXd KsBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eIQQo24T; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k26si3239761eds.205.2021.05.20.09.49.21; Thu, 20 May 2021 09:49: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=@linuxfoundation.org header.s=korg header.b=eIQQo24T; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbhETJur (ORCPT + 99 others); Thu, 20 May 2021 05:50:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:47526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbhETJsE (ORCPT ); Thu, 20 May 2021 05:48:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7CB36145D; Thu, 20 May 2021 09:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503272; bh=5z2S7BWpzHDIj/6UVUuVzuxxk/uHsYvZBwRLRGpfgY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eIQQo24T+gfAuzGPGfkvWwbAV6nbz110/n32D41SqbgrTDzJ19nV4SEY2ZRIQj500 B2EMi6VePw3Q/UWUXSpSo64LOfIhfzd16n6PFl1R2CELoYE+es8B2RNvn7xCgGPVK7 olB1qwBZ4M7JYlQEvWfVCVYaiJUfhDygo7YeZehk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bcc922b19ccc64240b42@syzkaller.appspotmail.com, Pavel Skripkin Subject: [PATCH 4.19 112/425] tty: fix memory leak in vc_deallocate Date: Thu, 20 May 2021 11:18:01 +0200 Message-Id: <20210520092135.129893654@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin commit 211b4d42b70f1c1660feaa968dac0efc2a96ac4d upstream. syzbot reported memory leak in tty/vt. The problem was in VT_DISALLOCATE ioctl cmd. After allocating unimap with PIO_UNIMAP it wasn't freed via VT_DISALLOCATE, but vc_cons[currcons].d was zeroed. Reported-by: syzbot+bcc922b19ccc64240b42@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Cc: stable Link: https://lore.kernel.org/r/20210327214443.21548-1-paskripkin@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1380,6 +1380,7 @@ struct vc_data *vc_deallocate(unsigned i atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, ¶m); vcs_remove_sysfs(currcons); visual_deinit(vc); + con_free_unimap(vc); put_pid(vc->vt_pid); vc_uniscr_set(vc, NULL); kfree(vc->vc_screenbuf);