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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 D00ACC47082 for ; Wed, 26 May 2021 22:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3385613CA for ; Wed, 26 May 2021 22:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233148AbhEZWMi (ORCPT ); Wed, 26 May 2021 18:12:38 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:43212 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhEZWMe (ORCPT ); Wed, 26 May 2021 18:12:34 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lm1jw-00AiDR-L7; Wed, 26 May 2021 16:11:01 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=fess.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1lm1jv-0002hQ-H0; Wed, 26 May 2021 16:11:00 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Yang Yingliang Cc: , References: <20210526143805.2549649-1-yangyingliang@huawei.com> Date: Wed, 26 May 2021 17:10:43 -0500 In-Reply-To: <20210526143805.2549649-1-yangyingliang@huawei.com> (Yang Yingliang's message of "Wed, 26 May 2021 22:38:05 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1lm1jv-0002hQ-H0;;;mid=;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/k7+ezPaBxFas8ZXSyR8onGsoWUMRXnZc= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH -next] cred: add missing return error code when set_cred_ucounts() failed X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yang Yingliang writes: > If set_cred_ucounts() failed, we need return the error code. Alex how does this look to you? This is showing up now as I have finally dropped the code in linux-next and other people are looking at it. At a quick fix looks correct to me. > Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred") > Reported-by: Hulk Robot > Signed-off-by: Yang Yingliang > --- > kernel/cred.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/cred.c b/kernel/cred.c > index db7c46bf36e5..e6fd2b3fc31f 100644 > --- a/kernel/cred.c > +++ b/kernel/cred.c > @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags) > ret = create_user_ns(new); > if (ret < 0) > goto error_put; > - if (set_cred_ucounts(new) < 0) > + ret = set_cred_ucounts(new); > + if (ret < 0) > goto error_put; > }