From patchwork Mon Mar 19 09:12:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10291909 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 27854602BD for ; Mon, 19 Mar 2018 09:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1900D29194 for ; Mon, 19 Mar 2018 09:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7692919D; Mon, 19 Mar 2018 09:12:56 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 85D0A29194 for ; Mon, 19 Mar 2018 09:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932675AbeCSJMw (ORCPT ); Mon, 19 Mar 2018 05:12:52 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:58678 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932665AbeCSJMs (ORCPT ); Mon, 19 Mar 2018 05:12:48 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2J9ChaR113847; Mon, 19 Mar 2018 09:12:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=DZrGGlWHRDFYqBtxV0Y8xe3J6JnrLctgVfyaa7JOY8s=; b=NCSQ87sj3lXJwomaFHCEc2sazQTRAm0tNYZGiMXxn8whsG2WB6CDn/WsVib11FL+ibPQ SwpVLJcuTnAHxR2k563prM2z304UCFU96jVQBOM2TnILpAl58sxbJObjikeGPHH3JoYM E1zFWthdarOM4nz5stZhoySqYexIK4HVXlIXx32N3n/ZmURIzV+skOvSiUDNyDaQOKHP 7SKo8gwaZ44lRaNW3w1GRaeRaFiX4D5e/fUbo7+0FchOeIR1vYXWnbcw5cAMQ3+xWaI3 EqYJbMs4RXRhJ+ZoSowlyusooJjkf1B96MmzYy4syWoLeOB+1uvkapHXqR9VhWRKhopG Hw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2gtacg000c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Mar 2018 09:12:43 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2J9Ce82009827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Mar 2018 09:12:40 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2J9Cccm023478; Mon, 19 Mar 2018 09:12:39 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 19 Mar 2018 02:12:38 -0700 Date: Mon, 19 Mar 2018 12:12:31 +0300 From: Dan Carpenter To: John Johansen Cc: James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] apparmor: Fix an error code in verify_table_headers() Message-ID: <20180319091231.GA7409@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8836 signatures=668693 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=661 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803190007 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP We accidentally return a positive EPROTO instead of a negative -EPROTO. Since 71 is not an error pointer, that means it eventually results in an Oops in the caller. Fixes: d901d6a298dc ("apparmor: dfa split verification of table headers") Signed-off-by: Dan Carpenter Acked-by: John Johansen --- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/security/apparmor/match.c b/security/apparmor/match.c index dd4c995c5e25..280eba082c7b 100644 --- a/security/apparmor/match.c +++ b/security/apparmor/match.c @@ -198,7 +198,7 @@ static int verify_table_headers(struct table_header **tables, int flags) static int verify_dfa(struct aa_dfa *dfa) { size_t i, state_count, trans_count; - int error = EPROTO; + int error = -EPROTO; state_count = dfa->tables[YYTD_ID_BASE]->td_lolen; trans_count = dfa->tables[YYTD_ID_NXT]->td_lolen;