Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp359573ybb; Thu, 19 Mar 2020 23:59:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsk/wXpKYfGF29ce+JV6LXNIvddSyMuvyS8KwXRIaFtQ7GJErWbYkx54ZKUULlKhJiRpKEJ X-Received: by 2002:aca:646:: with SMTP id 67mr5083734oig.4.1584687581828; Thu, 19 Mar 2020 23:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584687581; cv=none; d=google.com; s=arc-20160816; b=DyfTbj0RW1hP9tYepO+nyzVzWSqxA+f0yAhvd9ZQaTBIRZ9rnN5Yeb1osgR+4XTgGt N465jhT7S9vWV8P/LWGuyd7B+ej6wOW0fsKmtZElVkOK3O3COBKyV73MikqKTQ8DZWdS sYAxhBvRR/Kf+8Rn8vuGYjdHzjTaidSn72LqDAbolyVpJY6q/+oaa+jM0izcK5nqhnk/ SQoX2vhv0p3vt7rvVE+dNOXTL55o4DYibEKJLBvfYMeRF4GZ7+PiJ4Bp10jbUcmt0uIK +oALrLC/fzYK5NH3lkAk8kEtzrfwRwKpOhF0mFg0il57fIqtbo5ymtTW1TLRsFuM6CKr t6LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=arTu60Q5v+LBrlglRRjvc68IzlUYX2l2QVwIQ+eYQ/8=; b=vAsvohV/7peehUxy6TG6mgNnOM9cBdsfmSqD09/Yj37H2ONEuu2aG3LRX06zQZ2dbu uU3wXYInXQ+d7n9p8CPwySkjfa80s0kUJZWBM3wEZT8zi6HACn+ND+6gJsz9WNQoQlMq RsyDPBRAPImyueZrxA38SQweA485Kny/y+Ge8X7iT+cuDomLM0zWNMHPeaVxNNzBJeyk 7tUEoqABJ+DbDLupBuTw0vsl1phWSWfQ8GV2uYvJOfGSJPbniV9CcxQT0TtxhfcVNwYn cqxBjV9F1BUCIAEHxEu8Bc6CJW2+yx/NZ+17FvTrIuava+ZwRfLBPC/Z1W1lWMqViVxo pD0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HfVVJ8Ed; 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 v25si2540878oth.274.2020.03.19.23.59.29; Thu, 19 Mar 2020 23:59:41 -0700 (PDT) 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=HfVVJ8Ed; 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 S1726690AbgCTG6D (ORCPT + 99 others); Fri, 20 Mar 2020 02:58:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:58828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgCTG6C (ORCPT ); Fri, 20 Mar 2020 02:58:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 39C7220724; Fri, 20 Mar 2020 06:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584687481; bh=PIsypC08bJWE4+6MHuQaFuvnG+0cWY+CmeuIGkWOgCY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HfVVJ8Ed99pmOAmwj9fvwyf8AtF0zak3Pa6CBMSeoWFfBk0ww+GnBdFynv9p6gm8O Fy6/2pfT2jRwoq8pN4MIRj/m2k3sLMyEebmJqP+bRuxZPv5njZTlz5EozE9ZqNGK3T TxJZ4rLXzGdZyLqjHDDtPz0cUacPKSBO+iZegXFY= Date: Fri, 20 Mar 2020 07:57:59 +0100 From: Greg Kroah-Hartman To: Eric Biggers Cc: Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, syzkaller-bugs@googlegroups.com, Eric Dumazet , Nicolas Pitre Subject: Re: [PATCH v2 1/2] vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console Message-ID: <20200320065759.GA307955@kroah.com> References: <20200318222704.GC2334@sol.localdomain> <20200318223810.162440-1-ebiggers@kernel.org> <20200318223810.162440-2-ebiggers@kernel.org> <2f762aee-720b-9bec-620f-61129c724de6@suse.com> <20200320051049.GA1315@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200320051049.GA1315@sol.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 19, 2020 at 10:10:49PM -0700, Eric Biggers wrote: > On Thu, Mar 19, 2020 at 08:36:28AM +0100, Jiri Slaby wrote: > > On 18. 03. 20, 23:38, Eric Biggers wrote: > > > --- a/drivers/tty/vt/vt.c > > > +++ b/drivers/tty/vt/vt.c > > > @@ -1102,6 +1102,9 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ > > > tty_port_init(&vc->port); > > > INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); > > > > > > + /* if this wasn't the case, we'd have to implement port->ops.destruct */ > > > + BUILD_BUG_ON(offsetof(struct vc_data, port) != 0); > > > + > > > > This is 3 lines, implementing destruct would be like 4-5 :)? Please > > implement destruct instead. > > > > Otherwise looks good. > > > > Actually implementing destruct would be 12 lines, see below. Remember there is > no tty_port_operations defined yet so we'd have to define it just for destruct. > > Do you still prefer it? > > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c > index ec34f1f5f3bb5..309a39197be0a 100644 > --- a/drivers/tty/vt/vt.c > +++ b/drivers/tty/vt/vt.c > @@ -1075,6 +1075,17 @@ static void visual_deinit(struct vc_data *vc) > module_put(vc->vc_sw->owner); > } > > +static void vc_port_destruct(struct tty_port *port) > +{ > + struct vc_data *vc = container_of(port, struct vc_data, port); > + > + kfree(vc); > +} > + > +static const struct tty_port_operations vc_port_ops = { > + .destruct = vc_port_destruct, > +}; > + > int vc_allocate(unsigned int currcons) /* return 0 on success */ > { > struct vt_notifier_param param; > @@ -1100,11 +1111,9 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ > > vc_cons[currcons].d = vc; > tty_port_init(&vc->port); > + vc->port.ops = &vc_port_ops; > INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); > > - /* if this wasn't the case, we'd have to implement port->ops.destruct */ > - BUILD_BUG_ON(offsetof(struct vc_data, port) != 0); > - > visual_init(vc, currcons, 1); > > if (!*vc->vc_uni_pagedir_loc) Yes, this is good to have, thanks for doing this. greg k-h