Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2332582pxa; Mon, 17 Aug 2020 07:11:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyS/wwLbsMHAQqO3DT22IHyYTxDHQQHUite/1pAN62gvx53ZxwspDtuAqsL1J2PmZ6AyJIt X-Received: by 2002:a17:906:260c:: with SMTP id h12mr16169926ejc.457.1597673467833; Mon, 17 Aug 2020 07:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597673467; cv=none; d=google.com; s=arc-20160816; b=xBuyZLPf3SZp8iXrU41rf+93ir3OlTyttU0J0U/+pmh3B1gjDmZOTMzysbGepQknwF evM8sjpK690qC+jMW5TqATbbj9PPoNDE7nWT5cz6UoM+n13qBDrrzqBl0r2kughK6J7y FFjUIAMoQpwHgf83TpqV9MN+EjBjUtnUirVipxylErt3lJfqn0vdtPA302XoC5A/YgFZ QoawcBT5YQda2fAoglg4rkIUiC6BdziRmxzrqmdxFQZ5VSaqhn5XWN0AM84L3Y3utaJV e+lMK+bYr2Egcgf6al8KV3s76PlB4n0DrsejEhvbPOmgSLwNRIfXmqVcnKN8yUIUI59z pw3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3ND/esKGMRL5ZPUChC4jbz00fcc6iemDjh98b20FEHI=; b=S1Dnsw7RL0pzVrfWGlqwAKk9GQIAKiPvZjbJbPPUoRemmuiQ0+k/tStaigwBHnpW4S Ip5jojGfIoJrkE3dWv8LuNLpQb2gtRj6tlbiuGVjfFe39pdmLH3U9KuL4YnA3iANtDCS Ps07wOgn6RNyWbmsfsmp5FC61G1x8gkBksyy/IeLr5IgTmNyPcNgT90Ts6fuDSOGbUCo ikQorH/JcYtnE/COx+C5nO4CIrcbcN9IMJBZ3R2jBdelFTKJhe+FoeXwbqS6Yot+Zc4x 2skXdZNXNhQdrxpI3Nmob1MKi6JUbj5FjJvm4xsUuJ0JkXTrNNjClV5eKWpBQNVEmDR7 4S5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Od2oMIms; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si11166172eju.89.2020.08.17.07.10.44; Mon, 17 Aug 2020 07:11:07 -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=@redhat.com header.s=mimecast20190719 header.b=Od2oMIms; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728886AbgHQOJv (ORCPT + 99 others); Mon, 17 Aug 2020 10:09:51 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:47789 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728399AbgHQOJu (ORCPT ); Mon, 17 Aug 2020 10:09:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597673389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3ND/esKGMRL5ZPUChC4jbz00fcc6iemDjh98b20FEHI=; b=Od2oMIms49/LjyBuqRTyKbtNs0Y4yRExZt/G7XxVrjmj0BiL/LeZjSti41t8FlfjlzGKJH cnDytshgrNJ9yJ2Y2GWhvDdhoH6kHfOYHeC1JGT2XpR5gGBBkjWejHmniwaCBSGs9kFAmz VYEZAdMcQFE4MmIAF0HvpmDumMhKvG8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-FA3l1lKOOGCg_in2VFoMHQ-1; Mon, 17 Aug 2020 10:09:46 -0400 X-MC-Unique: FA3l1lKOOGCg_in2VFoMHQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A069E10082E6; Mon, 17 Aug 2020 14:09:45 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.59]) by smtp.corp.redhat.com (Postfix) with SMTP id 0C3175C3E0; Mon, 17 Aug 2020 14:09:43 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 17 Aug 2020 16:09:45 +0200 (CEST) Date: Mon, 17 Aug 2020 16:09:42 +0200 From: Oleg Nesterov To: Davidlohr Bueso Cc: akpm@linux-foundation.org, axboe@kernel.dk, linux-kernel@vger.kernel.org, Greg Thelen , Davidlohr Bueso Subject: Re: [PATCH 2/2] block: fix ioprio_get/set(IOPRIO_WHO_PGRP) vs setuid(2) Message-ID: <20200817140942.GD29865@redhat.com> References: <20200817003148.23691-1-dave@stgolabs.net> <20200817003148.23691-3-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817003148.23691-3-dave@stgolabs.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/16, Davidlohr Bueso wrote: > > --- a/block/ioprio.c > +++ b/block/ioprio.c > @@ -119,11 +119,13 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio) > pgrp = task_pgrp(current); > else > pgrp = find_vpid(who); > + read_lock(&tasklist_lock); > do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { > ret = set_task_ioprio(p, ioprio); > if (ret) > break; > } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); > + read_unlock(&tasklist_lock); > break; > case IOPRIO_WHO_USER: > uid = make_kuid(current_user_ns(), who); > @@ -207,6 +209,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) > pgrp = task_pgrp(current); > else > pgrp = find_vpid(who); > + read_lock(&tasklist_lock); > do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { > tmpio = get_task_ioprio(p); > if (tmpio < 0) > @@ -216,6 +219,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) > else > ret = ioprio_best(ret, tmpio); > } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); > + read_unlock(&tasklist_lock); Acked-by: Oleg Nesterov