lkml.org 
[lkml]   [2021]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 4/9] cxl/mem: Add basic IOCTL interface
On Sat, Feb 20, 2021 at 8:33 AM Ben Widawsky <ben.widawsky@intel.com> wrote:
>
> On 21-02-19 20:22:00, Konrad Rzeszutek Wilk wrote:
> > ..snip..
> > > +static int handle_mailbox_cmd_from_user(struct cxl_mem *cxlm,
> > > + const struct cxl_mem_command *cmd,
> > > + u64 in_payload, u64 out_payload,
> > > + s32 *size_out, u32 *retval)
> > > +{
> > > + struct device *dev = &cxlm->pdev->dev;
> > > + struct mbox_cmd mbox_cmd = {
> > > + .opcode = cmd->opcode,
> > > + .size_in = cmd->info.size_in,
> > > + .size_out = cmd->info.size_out,
> > > + };
> > > + int rc;
> > > +
> > > + if (cmd->info.size_out) {
> > > + mbox_cmd.payload_out = kvzalloc(cmd->info.size_out, GFP_KERNEL);
> > > + if (!mbox_cmd.payload_out)
> > > + return -ENOMEM;
> > > + }
> > > +
> > > + if (cmd->info.size_in) {
> > > + mbox_cmd.payload_in = vmemdup_user(u64_to_user_ptr(in_payload),
> > > + cmd->info.size_in);
> > > + if (IS_ERR(mbox_cmd.payload_in))
> > > + return PTR_ERR(mbox_cmd.payload_in);
> >
> > Not that this should happen, but what if info.size_out was set? Should
> > you also free mbox_cmd.payload_out?
> >
>
> Thanks Konrad.
>
> Dan, do you want me to send a fixup patch? This bug was introduced from v4->v5.

Yes, please, incremental to libnvdimm-for-next which I'm planning to
send to Linus on Tuesday.

\
 
 \ /
  Last update: 2021-02-20 18:51    [W:0.039 / U:1.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site