Showing error 1866

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: fs/afs/security.c
Line in file: 192
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by 99b437a9257cb6b267bf32adfb7675948dc6d485
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

162
163        /* always update the anonymous mask */
164        _debug("anon access %x", vnode->status.anon_access);
165        auth_vnode->status.anon_access = vnode->status.anon_access;
166        if (key == vnode->volume->cell->anonymous_key)
167                goto out_unlock;
168
169        xpermits = auth_vnode->permits;
170        count = 0;
171        if (xpermits) {
172                /* see if the permit is already in the list
173                 * - if it is then we just amend the list
174                 */
175                count = xpermits->count;
176                permit = xpermits->permits;
177                for (loop = count; loop > 0; loop--) {
178                        if (permit->key == key) {
179                                permit->access_mask =
180                                        vnode->status.caller_access;
181                                goto out_unlock;
182                        }
183                        permit++;
184                }
185        }
186
187        permits = kmalloc(sizeof(*permits) + sizeof(*permit) * (count + 1),
188                          GFP_NOFS);
189        if (!permits)
190                goto out_unlock;
191
192        memcpy(permits->permits, xpermits->permits,
193               count * sizeof(struct afs_permit));
194
195        _debug("key %x access %x",
196               key_serial(key), vnode->status.caller_access);
197        permits->permits[count].access_mask = vnode->status.caller_access;
198        permits->permits[count].key = key_get(key);
199        permits->count = count + 1;
200
201        rcu_assign_pointer(auth_vnode->permits, permits);
202        if (xpermits)
Show full sources