History

LSM: restore certain default error codes

While in most cases commit b1d9e6b064 ("LSM: Switch to lists of hooks") retained previous error returns, in three cases it altered them without any explanation in the commit message. Restore all of them - in the security_old_inode_init_security() case this led to reiserfs using uninitialized data, sooner or later crashing the system (the only other user of this function - ocfs2 - was unaffected afaict, since it passes pre-initialized structures).

Jan Beulich committed 11 years ago

Commit e308fd31 parent b1713b11 file · +6 −5Browse files

Unified · Split

security/security.c+6−5
@@ -380,8 +380,8 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, · 379 unmodified lines
380380 return 0;
381381
382382 if (!initxattrs)
383− return call_int_hook(inode_init_security, 0, inode, dir, qstr,
384− NULL, NULL, NULL);
383+ return call_int_hook(inode_init_security, -EOPNOTSUPP, inode,
384+ dir, qstr, NULL, NULL, NULL);
385385 memset(new_xattrs, 0, sizeof(new_xattrs));
386386 lsm_xattr = new_xattrs;
387387 ret = call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, qstr,
@@ -409,8 +409,8 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir, · 21 unmodified lines
409409 {
410410 if (unlikely(IS_PRIVATE(inode)))
411411 return -EOPNOTSUPP;
412− return call_int_hook(inode_init_security, 0, inode, dir, qstr,
413− name, value, len);
412+ return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir,
413+ qstr, name, value, len);
414414 }
415415 EXPORT_SYMBOL(security_old_inode_init_security);
416416
@@ -1281,7 +1281,8 @@ int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, · 864 unmodified lines
12811281
12821282 int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
12831283 {
1284− return call_int_hook(socket_getpeersec_dgram, 0, sock, skb, secid);
1284+ return call_int_hook(socket_getpeersec_dgram, -ENOPROTOOPT, sock,
1285+ skb, secid);
12851286 }
12861287 EXPORT_SYMBOL(security_socket_getpeersec_dgram);
12871288

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t