From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10CA5C433E4 for ; Tue, 28 Jul 2020 22:40:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF3982075D for ; Tue, 28 Jul 2020 22:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729855AbgG1Wkj (ORCPT ); Tue, 28 Jul 2020 18:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729628AbgG1Wkj (ORCPT ); Tue, 28 Jul 2020 18:40:39 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66393C061794; Tue, 28 Jul 2020 15:40:39 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0YGR-004arw-Eo; Tue, 28 Jul 2020 22:40:03 +0000 Date: Tue, 28 Jul 2020 23:40:03 +0100 From: Al Viro To: Casey Schaufler Cc: Deven Bowers , agk@redhat.com, axboe@kernel.dk, snitzer@redhat.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, paul@paul-moore.com, eparis@redhat.com, jannh@google.com, dm-devel@redhat.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-audit@redhat.com, tyhicks@linux.microsoft.com, linux-kernel@vger.kernel.org, corbet@lwn.net, sashal@kernel.org, jaskarankhurana@linux.microsoft.com, mdsakib@microsoft.com, nramas@linux.microsoft.com, pasha.tatashin@soleen.com Subject: Re: [RFC PATCH v5 05/11] fs: add security blob and hooks for block_device Message-ID: <20200728224003.GC951209@ZenIV.linux.org.uk> References: <20200728213614.586312-1-deven.desai@linux.microsoft.com> <20200728213614.586312-6-deven.desai@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Tue, Jul 28, 2020 at 03:22:59PM -0700, Casey Schaufler wrote: > > + hlist_for_each_entry(p, &security_hook_heads.bdev_setsecurity, list) { > > + rc = p->hook.bdev_setsecurity(bdev, name, value, size); > > + > > + if (rc == -ENOSYS) > > + rc = 0; > > + > > + if (rc != 0) > > Perhaps: > else if (rc != 0) > > > + break; > > + } > > + > > + return rc; hlist_for_each_entry(p, &security_hook_heads.bdev_setsecurity, list) { rc = p->hook.bdev_setsecurity(bdev, name, value, size); if (rc && rc != -ENOSYS) return rc; } return 0; Easier to reason about that way... From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CEEFC433E0 for ; Wed, 29 Jul 2020 12:40:39 +0000 (UTC) Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A09DD2083E for ; Wed, 29 Jul 2020 12:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A09DD2083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-audit-bounces@redhat.com 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-291-IwM6MkK4M1Wg9hjM9sWBTg-1; Wed, 29 Jul 2020 08:40:35 -0400 X-MC-Unique: IwM6MkK4M1Wg9hjM9sWBTg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B37A80183C; Wed, 29 Jul 2020 12:40:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2447C90E63; Wed, 29 Jul 2020 12:40:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A2E1495A67; Wed, 29 Jul 2020 12:40:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06SN2b3j030746 for ; Tue, 28 Jul 2020 19:02:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 877452018283; Tue, 28 Jul 2020 23:02:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 815022026D69 for ; Tue, 28 Jul 2020 23:02:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 263378007A4 for ; Tue, 28 Jul 2020 23:02:35 +0000 (UTC) Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-AgVAghHkNhCmMlosey3adw-1; Tue, 28 Jul 2020 19:02:32 -0400 X-MC-Unique: AgVAghHkNhCmMlosey3adw-1 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k0YGR-004arw-Eo; Tue, 28 Jul 2020 22:40:03 +0000 Date: Tue, 28 Jul 2020 23:40:03 +0100 From: Al Viro To: Casey Schaufler Subject: Re: [RFC PATCH v5 05/11] fs: add security blob and hooks for block_device Message-ID: <20200728224003.GC951209@ZenIV.linux.org.uk> References: <20200728213614.586312-1-deven.desai@linux.microsoft.com> <20200728213614.586312-6-deven.desai@linux.microsoft.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: linux-audit@redhat.com X-Mailman-Approved-At: Wed, 29 Jul 2020 08:39:41 -0400 Cc: snitzer@redhat.com, Deven Bowers , zohar@linux.ibm.com, dm-devel@redhat.com, tyhicks@linux.microsoft.com, agk@redhat.com, sashal@kernel.org, corbet@lwn.net, jmorris@namei.org, nramas@linux.microsoft.com, serge@hallyn.com, pasha.tatashin@soleen.com, jannh@google.com, linux-block@vger.kernel.org, axboe@kernel.dk, mdsakib@microsoft.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-audit@redhat.com, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, jaskarankhurana@linux.microsoft.com X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Jul 28, 2020 at 03:22:59PM -0700, Casey Schaufler wrote: > > + hlist_for_each_entry(p, &security_hook_heads.bdev_setsecurity, list) { > > + rc = p->hook.bdev_setsecurity(bdev, name, value, size); > > + > > + if (rc == -ENOSYS) > > + rc = 0; > > + > > + if (rc != 0) > > Perhaps: > else if (rc != 0) > > > + break; > > + } > > + > > + return rc; hlist_for_each_entry(p, &security_hook_heads.bdev_setsecurity, list) { rc = p->hook.bdev_setsecurity(bdev, name, value, size); if (rc && rc != -ENOSYS) return rc; } return 0; Easier to reason about that way... -- Linux-audit mailing list Linux-audit@redhat.com https://www.redhat.com/mailman/listinfo/linux-audit