All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree
@ 2017-10-24 14:04 Serge E. Hallyn
  2017-10-24 19:43 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Serge E. Hallyn @ 2017-10-24 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: colin.king, james.l.morris, serge, stable

On Tue, Oct 24, 2017 at 09:41:57AM +0200, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 4.13-stable tree.

yeah it's not relevant because the namespaced file capabilities patch is not
applied there.

thanks,
serge

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree
  2017-10-24 14:04 FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree Serge E. Hallyn
@ 2017-10-24 19:43 ` Greg KH
  2017-10-24 20:21   ` Serge E. Hallyn
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-10-24 19:43 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: colin.king, james.l.morris, stable

On Tue, Oct 24, 2017 at 09:04:06AM -0500, Serge E. Hallyn wrote:
> On Tue, Oct 24, 2017 at 09:41:57AM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.13-stable tree.
> 
> yeah it's not relevant because the namespaced file capabilities patch is not
> applied there.

then the fact that it was tagged for stable is a bit odd...

oh well,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree
  2017-10-24 19:43 ` Greg KH
@ 2017-10-24 20:21   ` Serge E. Hallyn
  0 siblings, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2017-10-24 20:21 UTC (permalink / raw)
  To: Greg KH; +Cc: Serge E. Hallyn, colin.king, james.l.morris, stable

On Tue, Oct 24, 2017 at 09:43:03PM +0200, Greg KH wrote:
> On Tue, Oct 24, 2017 at 09:04:06AM -0500, Serge E. Hallyn wrote:
> > On Tue, Oct 24, 2017 at 09:41:57AM +0200, gregkh@linuxfoundation.org wrote:
> > > 
> > > The patch below does not apply to the 4.13-stable tree.
> > 
> > yeah it's not relevant because the namespaced file capabilities patch is not
> > applied there.
> 
> then the fact that it was tagged for stable is a bit odd...
> 
> oh well,
> 
> greg k-h

Agreed.  Sorry for the distraction.

-serge

^ permalink raw reply	[flat|nested] 4+ messages in thread

* FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree
@ 2017-10-24  7:41 gregkh
  0 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2017-10-24  7:41 UTC (permalink / raw)
  To: colin.king, james.l.morris, serge; +Cc: stable


The patch below does not apply to the 4.13-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 76ba89c76f2c74e208d93a9e7c698e39eeb3b85c Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Mon, 4 Sep 2017 18:50:05 +0100
Subject: [PATCH] commoncap: move assignment of fs_ns to avoid null pointer
 dereference

The pointer fs_ns is assigned from inode->i_ib->s_user_ns before
a null pointer check on inode, hence if inode is actually null we
will get a null pointer dereference on this assignment. Fix this
by only dereferencing inode after the null pointer check on
inode.

Detected by CoverityScan CID#1455328 ("Dereference before null check")

Fixes: 8db6c34f1dbc ("Introduce v3 namespaced file capabilities")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: stable@vger.kernel.org
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>

diff --git a/security/commoncap.c b/security/commoncap.c
index c25e0d27537f..fc46f5b85251 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -585,13 +585,14 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
 	struct vfs_ns_cap_data data, *nscaps = &data;
 	struct vfs_cap_data *caps = (struct vfs_cap_data *) &data;
 	kuid_t rootkuid;
-	struct user_namespace *fs_ns = inode->i_sb->s_user_ns;
+	struct user_namespace *fs_ns;
 
 	memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data));
 
 	if (!inode)
 		return -ENODATA;
 
+	fs_ns = inode->i_sb->s_user_ns;
 	size = __vfs_getxattr((struct dentry *)dentry, inode,
 			      XATTR_NAME_CAPS, &data, XATTR_CAPS_SZ);
 	if (size == -ENODATA || size == -EOPNOTSUPP)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-24 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 14:04 FAILED: patch "[PATCH] commoncap: move assignment of fs_ns to avoid null pointer" failed to apply to 4.13-stable tree Serge E. Hallyn
2017-10-24 19:43 ` Greg KH
2017-10-24 20:21   ` Serge E. Hallyn
  -- strict thread matches above, loose matches on Subject: below --
2017-10-24  7:41 gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.