From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Kinglong Mee" <kinglongmee@gmail.com>,
"J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 3.2 63/92] NFSD: Call ->set_acl with a NULL ACL structure if no entries
Date: Sat, 07 Jun 2014 02:26:29 +0100 [thread overview]
Message-ID: <lsq.1402104389.335906640@decadent.org.uk> (raw)
In-Reply-To: <lsq.1402104388.385007124@decadent.org.uk>
3.2.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kinglong Mee <kinglongmee@gmail.com>
commit aa07c713ecfc0522916f3cd57ac628ea6127c0ec upstream.
After setting ACL for directory, I got two problems that caused
by the cached zero-length default posix acl.
This patch make sure nfsd4_set_nfs4_acl calls ->set_acl
with a NULL ACL structure if there are no entries.
Thanks for Christoph Hellwig's advice.
First problem:
............ hang ...........
Second problem:
[ 1610.167668] ------------[ cut here ]------------
[ 1610.168320] kernel BUG at /root/nfs/linux/fs/nfsd/nfs4acl.c:239!
[ 1610.168320] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC
[ 1610.168320] Modules linked in: nfsv4(OE) nfs(OE) nfsd(OE)
rpcsec_gss_krb5 fscache ip6t_rpfilter ip6t_REJECT cfg80211 xt_conntrack
rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables
ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6
ip6table_mangle ip6table_security ip6table_raw ip6table_filter
ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4
nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw
auth_rpcgss nfs_acl snd_intel8x0 ppdev lockd snd_ac97_codec ac97_bus
snd_pcm snd_timer e1000 pcspkr parport_pc snd parport serio_raw joydev
i2c_piix4 sunrpc(OE) microcode soundcore i2c_core ata_generic pata_acpi
[last unloaded: nfsd]
[ 1610.168320] CPU: 0 PID: 27397 Comm: nfsd Tainted: G OE
3.15.0-rc1+ #15
[ 1610.168320] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[ 1610.168320] task: ffff88005ab653d0 ti: ffff88005a944000 task.ti:
ffff88005a944000
[ 1610.168320] RIP: 0010:[<ffffffffa034d5ed>] [<ffffffffa034d5ed>]
_posix_to_nfsv4_one+0x3cd/0x3d0 [nfsd]
[ 1610.168320] RSP: 0018:ffff88005a945b00 EFLAGS: 00010293
[ 1610.168320] RAX: 0000000000000001 RBX: ffff88006700bac0 RCX:
0000000000000000
[ 1610.168320] RDX: 0000000000000000 RSI: ffff880067c83f00 RDI:
ffff880068233300
[ 1610.168320] RBP: ffff88005a945b48 R08: ffffffff81c64830 R09:
0000000000000000
[ 1610.168320] R10: ffff88004ea85be0 R11: 000000000000f475 R12:
ffff880068233300
[ 1610.168320] R13: 0000000000000003 R14: 0000000000000002 R15:
ffff880068233300
[ 1610.168320] FS: 0000000000000000(0000) GS:ffff880077800000(0000)
knlGS:0000000000000000
[ 1610.168320] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1610.168320] CR2: 00007f5bcbd3b0b9 CR3: 0000000001c0f000 CR4:
00000000000006f0
[ 1610.168320] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 1610.168320] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[ 1610.168320] Stack:
[ 1610.168320] ffffffff00000000 0000000b67c83500 000000076700bac0
0000000000000000
[ 1610.168320] ffff88006700bac0 ffff880068233300 ffff88005a945c08
0000000000000002
[ 1610.168320] 0000000000000000 ffff88005a945b88 ffffffffa034e2d5
000000065a945b68
[ 1610.168320] Call Trace:
[ 1610.168320] [<ffffffffa034e2d5>] nfsd4_get_nfs4_acl+0x95/0x150 [nfsd]
[ 1610.168320] [<ffffffffa03400d6>] nfsd4_encode_fattr+0x646/0x1e70 [nfsd]
[ 1610.168320] [<ffffffff816a6e6e>] ? kmemleak_alloc+0x4e/0xb0
[ 1610.168320] [<ffffffffa0327962>] ?
nfsd_setuser_and_check_port+0x52/0x80 [nfsd]
[ 1610.168320] [<ffffffff812cd4bb>] ? selinux_cred_prepare+0x1b/0x30
[ 1610.168320] [<ffffffffa0341caa>] nfsd4_encode_getattr+0x5a/0x60 [nfsd]
[ 1610.168320] [<ffffffffa0341e07>] nfsd4_encode_operation+0x67/0x110
[nfsd]
[ 1610.168320] [<ffffffffa033844d>] nfsd4_proc_compound+0x21d/0x810 [nfsd]
[ 1610.168320] [<ffffffffa0324d9b>] nfsd_dispatch+0xbb/0x200 [nfsd]
[ 1610.168320] [<ffffffffa00850cd>] svc_process_common+0x46d/0x6d0 [sunrpc]
[ 1610.168320] [<ffffffffa0085433>] svc_process+0x103/0x170 [sunrpc]
[ 1610.168320] [<ffffffffa032472f>] nfsd+0xbf/0x130 [nfsd]
[ 1610.168320] [<ffffffffa0324670>] ? nfsd_destroy+0x80/0x80 [nfsd]
[ 1610.168320] [<ffffffff810a5202>] kthread+0xd2/0xf0
[ 1610.168320] [<ffffffff810a5130>] ? insert_kthread_work+0x40/0x40
[ 1610.168320] [<ffffffff816c1ebc>] ret_from_fork+0x7c/0xb0
[ 1610.168320] [<ffffffff810a5130>] ? insert_kthread_work+0x40/0x40
[ 1610.168320] Code: 78 02 e9 e7 fc ff ff 31 c0 31 d2 31 c9 66 89 45 ce
41 8b 04 24 66 89 55 d0 66 89 4d d2 48 8d 04 80 49 8d 5c 84 04 e9 37 fd
ff ff <0f> 0b 90 0f 1f 44 00 00 55 8b 56 08 c7 07 00 00 00 00 8b 46 0c
[ 1610.168320] RIP [<ffffffffa034d5ed>] _posix_to_nfsv4_one+0x3cd/0x3d0
[nfsd]
[ 1610.168320] RSP <ffff88005a945b00>
[ 1610.257313] ---[ end trace 838254e3e352285b ]---
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
fs/nfsd/nfs4acl.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -373,8 +373,10 @@ sort_pacl(struct posix_acl *pacl)
* by uid/gid. */
int i, j;
- if (pacl->a_count <= 4)
- return; /* no users or groups */
+ /* no users or groups */
+ if (!pacl || pacl->a_count <= 4)
+ return;
+
i = 1;
while (pacl->a_entries[i].e_tag == ACL_USER)
i++;
@@ -498,13 +500,12 @@ posix_state_to_acl(struct posix_acl_stat
/*
* ACLs with no ACEs are treated differently in the inheritable
- * and effective cases: when there are no inheritable ACEs, we
- * set a zero-length default posix acl:
+ * and effective cases: when there are no inheritable ACEs,
+ * calls ->set_acl with a NULL ACL structure.
*/
- if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) {
- pacl = posix_acl_alloc(0, GFP_KERNEL);
- return pacl ? pacl : ERR_PTR(-ENOMEM);
- }
+ if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT))
+ return NULL;
+
/*
* When there are no effective ACEs, the following will end
* up setting a 3-element effective posix ACL with all
next prev parent reply other threads:[~2014-06-07 1:26 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-07 1:26 [PATCH 3.2 00/92] 3.2.60-rc1 review Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 03/92] ACPI / EC: Process rather than discard events in acpi_ec_clear Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 11/92] net: ipv4: current group_info should be put after using Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 25/92] skb: Add inline helper for getting the skb end offset from head Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 05/92] netfilter: Can't fail and free after table replacement Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 01/92] powerpc: Add vr save/restore functions Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 18/92] Revert "macvlan : fix checksums error when we are in bridge mode" Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 09/92] bonding: Remove debug_fs files when module init fails Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 21/92] ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 24/92] ipv4: initialise the itag variable in __mkroute_input Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 06/92] tracepoint: Do not waste memory on mods with no tracepoints Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 30/92] drm/vmwgfx: Make sure user-space can't DMA across buffer object boundaries v2 Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 17/92] sctp: reset flowi4_oif parameter on route lookup Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 19/92] tcp_cubic: fix the range of delayed_ack Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 07/92] l2tp: take PMTU from tunnel UDP socket Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 20/92] net: ipv4: ip_forward: fix inverted local_df test Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 27/92] thinkpad-acpi: fix issuing duplicated key events for brightness up/down Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 12/92] filter: prevent nla extensions to peek beyond the end of the message Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 22/92] macvlan: Don't propagate IFF_ALLMULTI changes on down interfaces Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 15/92] rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 13/92] tg3: update rx_jumbo_pending ring param only when jumbo frames are enabled Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 14/92] rtnetlink: Warn when interface's information won't fit in our packet Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 02/92] ACPI / EC: Clear stale EC events on Samsung systems Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 10/92] ipv6: Limit mtu to 65575 bytes Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 16/92] bridge: Handle IFLA_ADDRESS correctly when creating bridge device Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 28/92] rt2x00: fix beaconing on USB Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 26/92] net-gro: reset skb->truesize in napi_reuse_skb() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 29/92] Input: synaptics - add min/max quirk for ThinkPad Edge E431 Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 23/92] act_mirred: do not drop packets when fails to mirror it Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 04/92] tgafb: fix mode setting with fbset Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 08/92] net: core: don't account for udp header size when computing seglen Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 46/92] usb: storage: shuttle_usbat: fix discs being detected twice Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 48/92] USB: Nokia 305 should be treated as unusual dev Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 71/92] i2c: s3c2410: resume race fix Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 38/92] [SCSI] mpt2sas: Don't disable device twice at suspend Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 75/92] libceph: fix corruption when using page_count 0 page in rbd Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 90/92] futex: Validate atomic acquisition in futex_lock_pi_atomic() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 52/92] HID: usbhid: quirk for Synaptics Quad HD touchscreen Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 82/92] nfsd4: remove lockowner when removing lock stateid Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 76/92] perf: Limit perf_event_attr::sample_period to 63 bits Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 74/92] libceph: only call kernel_sendpage() via helper Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 61/92] sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 86/92] mm/memory-failure.c: fix memory leak by race between poison and unpoison Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 55/92] md: avoid possible spinning md thread at shutdown Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 51/92] HID: usbhid: quirk for Synaptics HD touchscreen Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 60/92] mm/page-writeback.c: fix divide by zero in pos_ratio_polynom Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 68/92] [media] V4L2: fix VIDIOC_CREATE_BUFS in 64- / 32-bit compatibility mode Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 89/92] futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid uaddr == uaddr2 in futex_requeue(..., requeue_pi=1) Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 53/92] HID: add NO_INIT_REPORTS quirk for Synaptics Touch Pad V 103S Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 73/92] PCI: shpchp: Check bridge's secondary (not primary) bus speed Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 35/92] kvm: remove .done from struct kvm_async_pf Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 77/92] perf: Prevent false warning in perf_swevent_add Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 78/92] drm/radeon: also try GART for CPU accessed buffers Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 67/92] [media] V4L2: ov7670: fix a wrong index, potentially Oopsing the kernel from user-space Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 36/92] KVM: async_pf: mm->mm_users can not pin apf->mm Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 39/92] hrtimer: Prevent all reprogramming if hang detected Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 43/92] rtl8192cu: Fix unbalanced irq enable in error path of rtl92cu_hw_init() Ben Hutchings
2014-06-07 1:26 ` Ben Hutchings [this message]
2014-06-07 1:26 ` [PATCH 3.2 59/92] Negative (setpoint-dirty) in bdi_position_ratio() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 80/92] can: peak_pci: Fix the way channels are linked together Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 54/92] Input: elantech - fix touchpad initialization on Gigabyte U2442 Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 88/92] futex: Prevent attaching to kernel threads Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 45/92] drm/nouveau/acpi: allow non-optimus setups to load vbios from acpi Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 40/92] hrtimer: Prevent remote enqueue of leftmost timers Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 66/92] hwmon: (emc1403) Support full range of known chip revision numbers Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 41/92] timer: Prevent overflow in apply_slack Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 70/92] i2c: designware: Mask all interrupts during i2c controller enable Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 81/92] can: peak_pci: prevent use after free at netdev removal Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 37/92] ftrace/module: Hardcode ftrace_module_init() call into load_module() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 65/92] hwmon: (emc1403) fix inverted store_hyst() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 56/92] NFSd: Move default initialisers from create_client() to alloc_client() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 34/92] kvm: free resources after canceling async_pf Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 42/92] rtlwifi: rtl8192cu: Fix too long disable of IRQs Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 85/92] hwpoison, hugetlb: lock_page/unlock_page does not match for handling a free hugepage Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 84/92] dma: mv_xor: Flush descriptors before activating a channel Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 91/92] futex: Always cleanup owner tid in unlock_pi Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 79/92] drm/radeon: handle non-VGA class pci devices with ATRM Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 49/92] USB: Nokia 5300 should be treated as unusual dev Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 44/92] [media] media-device: fix infoleak in ioctl media_enum_entities() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 33/92] crypto: caam - add allocation failure handling in SPRINTFCAT macro Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 69/92] x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 47/92] drivers/tty/hvc: don't free hvc_console_setup after init Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 62/92] trace: module: Maintain a valid user count Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 57/92] NFSd: call rpc_destroy_wait_queue() from free_client() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 58/92] posix_acl: handle NULL ACL in posix_acl_equiv_mode Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 92/92] futex: Make lookup_pi_state more robust Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 83/92] nfsd4: warn on finding lockowner without stateid's Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 31/92] Bluetooth: Fix redundant encryption request for reauthentication Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 72/92] x86-64, modify_ldt: Make support for 16-bit segments a runtime option Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 64/92] hrtimer: Set expiry time before switch_hrtimer_base() Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 50/92] HID: usbhid: quirk for Synaptics Large Touchccreen Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 32/92] Bluetooth: Add support for Lite-on [04ca:3007] Ben Hutchings
2014-06-07 1:26 ` [PATCH 3.2 87/92] futex: Add another early deadlock detection check Ben Hutchings
2014-06-07 2:23 ` [PATCH 3.2 00/92] 3.2.60-rc1 review Ben Hutchings
2014-06-07 16:33 ` Guenter Roeck
2014-06-07 17:00 ` Ben Hutchings
2014-06-09 23:25 ` Satoru Takeuchi
2014-06-09 23:48 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=lsq.1402104389.335906640@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=bfields@redhat.com \
--cc=kinglongmee@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox