aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 17:16:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 17:16:13 -0500
commit2cfa1cd3da14814a1e9ec6a4fce8612637d3ee3d (patch)
treea3d5f2dcb3fd5db19e48fe9c7e0b7c96db8c1f72
parent3dbc4f548519f9882676843b4fcdb4e61668baf8 (diff)
parent4b14752ec4e0d87126e636384cf37c8dd9df157c (diff)
Merge tag 'selinux-pr-20180130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux updates from Paul Moore: "A small pull request this time, just three patches, and one of these is just a comment update (swap the FSF physical address for a URL). The other two patches are small bug fixes found by szybot/syzkaller; they individual patch descriptions should tell you all you ever wanted to know" * tag 'selinux-pr-20180130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: skip bounded transition processing if the policy isn't loaded selinux: ensure the context is NUL terminated in security_context_to_sid_core() security: replace FSF address with web source in license notices
-rw-r--r--security/selinux/include/netlabel.h3
-rw-r--r--security/selinux/netlabel.c3
-rw-r--r--security/selinux/ss/services.c21
3 files changed, 13 insertions, 14 deletions
diff --git a/security/selinux/include/netlabel.h b/security/selinux/include/netlabel.h
index 75686d53df07..e77a5e307955 100644
--- a/security/selinux/include/netlabel.h
+++ b/security/selinux/include/netlabel.h
@@ -19,8 +19,7 @@
19 * the GNU General Public License for more details. 19 * the GNU General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * 23 *
25 */ 24 */
26 25
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index aaba6677ee2e..2c297b995b16 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
@@ -22,8 +22,7 @@
22 * the GNU General Public License for more details. 22 * the GNU General Public License for more details.
23 * 23 *
24 * You should have received a copy of the GNU General Public License 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software 25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 * 26 *
28 */ 27 */
29 28
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 33cfe5d3d6cb..8900ea5cbabf 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -867,6 +867,9 @@ int security_bounded_transition(u32 old_sid, u32 new_sid)
867 int index; 867 int index;
868 int rc; 868 int rc;
869 869
870 if (!ss_initialized)
871 return 0;
872
870 read_lock(&policy_rwlock); 873 read_lock(&policy_rwlock);
871 874
872 rc = -EINVAL; 875 rc = -EINVAL;
@@ -1413,27 +1416,25 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
1413 if (!scontext_len) 1416 if (!scontext_len)
1414 return -EINVAL; 1417 return -EINVAL;
1415 1418
1419 /* Copy the string to allow changes and ensure a NUL terminator */
1420 scontext2 = kmemdup_nul(scontext, scontext_len, gfp_flags);
1421 if (!scontext2)
1422 return -ENOMEM;
1423
1416 if (!ss_initialized) { 1424 if (!ss_initialized) {
1417 int i; 1425 int i;
1418 1426
1419 for (i = 1; i < SECINITSID_NUM; i++) { 1427 for (i = 1; i < SECINITSID_NUM; i++) {
1420 if (!strcmp(initial_sid_to_string[i], scontext)) { 1428 if (!strcmp(initial_sid_to_string[i], scontext2)) {
1421 *sid = i; 1429 *sid = i;
1422 return 0; 1430 goto out;
1423 } 1431 }
1424 } 1432 }
1425 *sid = SECINITSID_KERNEL; 1433 *sid = SECINITSID_KERNEL;
1426 return 0; 1434 goto out;
1427 } 1435 }
1428 *sid = SECSID_NULL; 1436 *sid = SECSID_NULL;
1429 1437
1430 /* Copy the string so that we can modify the copy as we parse it. */
1431 scontext2 = kmalloc(scontext_len + 1, gfp_flags);
1432 if (!scontext2)
1433 return -ENOMEM;
1434 memcpy(scontext2, scontext, scontext_len);
1435 scontext2[scontext_len] = 0;
1436
1437 if (force) { 1438 if (force) {
1438 /* Save another copy for storing in uninterpreted form */ 1439 /* Save another copy for storing in uninterpreted form */
1439 rc = -ENOMEM; 1440 rc = -ENOMEM;