selinux/stable-5.1 PR 20190321

-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCAAyFiEES0KozwfymdVUl37v6iDy2pc3iXMFAlyTmOoUHHBhdWxAcGF1
 bC1tb29yZS5jb20ACgkQ6iDy2pc3iXN4nRAAvpgX3ZuPmgjWzhWzgq0yZ44hw7ru
 Za51yagIBG7m8PiL2pychqdNQ9rjQPbMqt1YWuXJl1hS5+jMqrMBZs4/8zGAw8Di
 tw1KwW8vCzB6rRlXJPVR6PgUvYGOyu6RYWRSV7SbUYAmao2yUkhgc9g3j5woCcd9
 B8eo6vIJUQgMgp2aSbuym4le4+re681d8N9oUMO9AaSx77/inseDwuFppqDTRbCz
 FTGBYdqT67XwgsR7920TpxBWbZHIckdMZlbcfpLtZ7Fw0BqdeB94YfVQ/F6IfS+a
 D7cIxCRtvL5nCVYmLCawrKFO1S3CFrlxD2pi+CfXGiCt1jx/2MPYJGcfdmXbyxH5
 vkq/b8CLZg1cnRhxcD6oGORjEKCdHAw+R+9iuNQQL9mtgHAeSrZBree+V6PqwY7n
 rGz4S4UELEkBH/2Wx1ZmET9DTgK2fblRv9duyXxDqyZOolQSONXYdA78xrMcyuhB
 jdciAz6UyG2YtU3iUvo0DJrYMyVjzsFqa+dXTqtFE9OKJEiEPr5YUedmwqMHwd4Q
 f1fK1H6kWBkfFjaMoSYE/XGBLE0iQzS3N2Aj541UUMork2HCsP4KLm6yXj+Gun5s
 pnqd1cklbhgrdwyKF821f972z5AriRowf5joQtTygIO4zkuuRf+tpEjgyGpPDfdV
 Wc3Gbr+A5WtMgTk=
 =/2fx
 -----END PGP SIGNATURE-----

Merge tag 'selinux-pr-20190321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull selinux fix from Paul Moore:
 "Another small SELinux fix for v5.1"

* tag 'selinux-pr-20190321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  selinux: fix NULL dereference in policydb_destroy()
This commit is contained in:
Linus Torvalds 2019-03-21 11:12:56 -07:00
commit fb549c5547

View File

@ -828,9 +828,11 @@ void policydb_destroy(struct policydb *p)
hashtab_map(p->range_tr, range_tr_destroy, NULL);
hashtab_destroy(p->range_tr);
for (i = 0; i < p->p_types.nprim; i++)
ebitmap_destroy(&p->type_attr_map_array[i]);
kvfree(p->type_attr_map_array);
if (p->type_attr_map_array) {
for (i = 0; i < p->p_types.nprim; i++)
ebitmap_destroy(&p->type_attr_map_array[i]);
kvfree(p->type_attr_map_array);
}
ebitmap_destroy(&p->filename_trans_ttypes);
ebitmap_destroy(&p->policycaps);
@ -2496,10 +2498,13 @@ int policydb_read(struct policydb *p, void *fp)
if (!p->type_attr_map_array)
goto bad;
/* just in case ebitmap_init() becomes more than just a memset(0): */
for (i = 0; i < p->p_types.nprim; i++)
ebitmap_init(&p->type_attr_map_array[i]);
for (i = 0; i < p->p_types.nprim; i++) {
struct ebitmap *e = &p->type_attr_map_array[i];
ebitmap_init(e);
if (p->policyvers >= POLICYDB_VERSION_AVTAB) {
rc = ebitmap_read(e, fp);
if (rc)