Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbWHSIOj (ORCPT ); Sat, 19 Aug 2006 04:14:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751472AbWHSIOj (ORCPT ); Sat, 19 Aug 2006 04:14:39 -0400 Received: from smtp.osdl.org ([65.172.181.4]:20353 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S1751479AbWHSIOi convert rfc822-to-8bit (ORCPT ); Sat, 19 Aug 2006 04:14:38 -0400 Date: Sat, 19 Aug 2006 01:14:28 -0700 From: Andrew Morton To: =?ISO-8859-1?B?Qmr2cm4=?= Steinbrink Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Return real errno from execve in ____call_usermodehelper Message-Id: <20060819011428.05ec2ae4.akpm@osdl.org> In-Reply-To: <20060819073031.GA25711@atjola.homenet> References: <20060819073031.GA25711@atjola.homenet> X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.17; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 35 On Sat, 19 Aug 2006 09:30:31 +0200 Bj?rn Steinbrink wrote: > If execve fails in ____call_usermodehelper we treat its return value as > error code, but as execve is a syscall, we actually want -errno there. > > Signed-off-by: Bj?rn Steinbrink > > -- > > diff --git a/kernel/kmod.c b/kernel/kmod.c > index 1d32def..865abc0 100644 > --- a/kernel/kmod.c > +++ b/kernel/kmod.c > @@ -149,8 +149,10 @@ static int ____call_usermodehelper(void > set_cpus_allowed(current, CPU_MASK_ALL); > > retval = -EPERM; > - if (current->fs->root) > - retval = execve(sub_info->path, sub_info->argv,sub_info->envp); > + if (current->fs->root) { > + execve(sub_info->path, sub_info->argv, sub_info->envp); > + retval = -errno; > + } > > /* Exec failed? */ > sub_info->retval = retval; ug. I wish we could find some way of using do_execve() here. Or hoist sys_execve() out of the architectures. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/