lkml.org 
[lkml]   [2006]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][RFC][resend] potential NULL pointer deref in XFS on failed mount
On 16/11/06, Shailendra Tripathi <stripathi@agami.com> wrote:
> Hey Jesper,
> Rather, it can be done as below. Nothing to say that
> your code wouldn't work. Just that catch it early, so that potential
> function call overhead to call xfs_free_buftarg can be avoided.
>
Hi Shailendra,

The reason I want to fix it in the freeing function is that many other
functions in the kernel that free resources are safe to call with NULL
pointers and this would make xfs_free_buftarg() follow that
convention. This would perhaps also allow for some cleanups in other
places that call the function since then there's no longer a need for
explicit NULL checks any more (haven't checked if there's anything to
gain there though).
I don't think the function call overhead matters much since this is in
a case of a failed mount, so it should happen very rarely.

> void
> xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr)
> {
> if (mp->m_logdev_targp && (mp->m_logdev_targp != mp->m_ddev_targp))
> xfs_free_buftarg(mp->m_logdev_targp, 1);
> if (mp->m_rtdev_targp)
> xfs_free_buftarg(mp->m_rtdev_targp, 1);
> xfs_free_buftarg(mp->m_ddev_targp, 0);
> }
>


--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-16 22:47    [W:0.044 / U:18.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site