From patchwork Tue Apr 4 11:16:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9661399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C543602B9 for ; Tue, 4 Apr 2017 11:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E1F827813 for ; Tue, 4 Apr 2017 11:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12AF3284DB; Tue, 4 Apr 2017 11:16:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C735E27813 for ; Tue, 4 Apr 2017 11:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753856AbdDDLQ3 (ORCPT ); Tue, 4 Apr 2017 07:16:29 -0400 Received: from mout.web.de ([212.227.17.11]:62679 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855AbdDDLQ2 (ORCPT ); Tue, 4 Apr 2017 07:16:28 -0400 Received: from [192.168.1.2] ([77.181.94.222]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MAvKi-1cnhSb1X2i-009z8S; Tue, 04 Apr 2017 13:16:06 +0200 Subject: [PATCH 3/3] selinux: Use an other error code for an input validation failure in sidtab_insert() From: SF Markus Elfring To: Casey Schaufler , Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts , linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov Cc: LKML , kernel-janitors@vger.kernel.org References: <5704e656-708a-b611-5611-70fc65dc67e8@users.sourceforge.net> Message-ID: <38273216-97ad-7955-941a-68485534d39f@users.sourceforge.net> Date: Tue, 4 Apr 2017 13:16:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <5704e656-708a-b611-5611-70fc65dc67e8@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:M90XAnKv2FRWgQPmhGiKCfvvM4EMkfJzF7J9yUGNaPGSmO8ifAc P/p8Nzkpf/stk98prrCdkDlLCRW051/IShBdg0vPqMu/ZzhfUAFJOkohmw0T86tHjsJRsxW bCHIVyEpIewRf2QXgcWcQ8ANKbV1v/V7tEt4CkMroTScAHqoGxzooKS0boTa1WqkhF1Xlxs FXzyJZgDxs5LWXDR7wyNA== X-UI-Out-Filterresults: notjunk:1; V01:K0:tRsYuQZlNsY=:6FD65ig+kK9SKclECclr5Z +JgUvglZ4lhN7VugMtDNmb5icDsfAwFh46HSwWDYlR9FMoktNWQVr0tbZfIO96E39te3bNrKq oSksFLvj/WS4uCEhxji1rn2lKppyJmhoKVbQmdZtt2iiJydyr3CIhQkBsFr2gwd4/wJhqi420 y0EOSRE+ana3LBA84Q8b9rXF42incBzNmQT6HS8IQwOOim01zKKCwSWZ8hm/4v/ePF+KdHhUB kStzv9WeGK+8YgdrFYs/fZUPtIjvRP/8/rz+/FRj6G7O1ymL94k5inwfSxNzOwYS1mvVgz+LA B+gaZBx3UiBtU+rVb4gKwIqMCZA3stWE+Zx4wvMW2HO2dJVFY7H5QgFDXioFPgmSb+fBq9jHH ce19je8c8i/sLd4DXcGfbelo3NRV5ZOpnD7B+7U3Ve+aYz8ykBLYjZs3Wu61ihLrL21vUe9jq Ulee4wtBdUiecZFgubd3SoLRceVX5eCyABF9XFDcCE2v5UGLWrF+g3L9Osw+Ft1oAfkJXO5uk PNUPvOkfFroSBM/mcdlSwqEpbuo5CBnurdSRbC0mWwW9Wtkg2XhhogBsjdS2uBkDSzUog3X7B zWIObKOyys/bhpDPYacHVQkYSszfPaMjG636iX/+yzqROQIMgnAztSy1IcmoaomNLaBsnlLVd i2FUURih2hHbf/s7b80wTKrS4fgsnGssasFhX02alvRVDRJV4RQAkf/3t+uUbzNGkBLMZ1Lmd TdWtIc1ZkvGCnMTgkRFfiN9kW8tni9MuqVFHFE73uW/9Hw46UEjyjLXOqJk8xSWccbFhuhJjH rjIcUw/ Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 4 Apr 2017 12:23:41 +0200 The error code "-ENOMEM" was also returned so far when the parameter "s" of this function contained a null pointer. Now I find that the code "-EINVAL" is more appropriate in this case. Signed-off-by: Markus Elfring --- security/selinux/ss/sidtab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c index c5f436b15d19..2eb2a54b88d2 100644 --- a/security/selinux/ss/sidtab.c +++ b/security/selinux/ss/sidtab.c @@ -36,7 +36,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context) struct sidtab_node *prev, *cur, *newnode; if (!s) - return -ENOMEM; + return -EINVAL; hvalue = SIDTAB_HASH(sid); prev = NULL;